public static function getByHandle($akHandle)
 {
     $db = Database::get();
     $q = "SELECT ak.akID\n            FROM AttributeKeys ak\n            INNER JOIN AttributeKeyCategories akc ON ak.akCategoryID = akc.akCategoryID\n            WHERE ak.akHandle = ?\n            AND akc.akCategoryHandle = 'store_product'";
     $akID = $db->GetOne($q, array($akHandle));
     if ($akID > 0) {
         $ak = StoreProductKey::getByID($akID);
     }
     if ($ak === -1) {
         return false;
     }
     return $ak;
 }
Exemple #2
0
 public function edit($akID = 0)
 {
     if ($this->post('akID')) {
         $akID = $this->post('akID');
     }
     $key = StoreProductKey::getByID($akID);
     $type = $key->getAttributeType();
     $this->set('key', $key);
     $this->set('type', $type);
     $this->set('category', AttributeKeyCategory::getByHandle('store_product'));
     if ($this->isPost()) {
         $cnt = $type->getController();
         $cnt->setAttributeKey($key);
         $e = $cnt->validateKey($this->post());
         if ($e->has()) {
             $this->set('error', $e);
         } else {
             $type = AttributeType::getByID($this->post('atID'));
             $args = array('akHandle' => $this->post('akHandle'), 'akName' => $this->post('akName'), 'akIsSearchable' => $this->post('akIsSearchable'), 'akIsSearchableIndexed' => $this->post('akIsSearchableIndexed'), 'akIsAutoCreated' => 0, 'akIsEditable' => 1);
             $key->update($this->post());
             $this->redirect('/dashboard/store/products/attributes', 'updated');
         }
     }
 }
Exemple #3
0
 public function edit($akID = 0)
 {
     if ($this->post('akID')) {
         $akID = $this->post('akID');
     }
     $key = StoreProductKey::getByID($akID);
     $type = $key->getAttributeType();
     $this->set('key', $key);
     $this->set('type', $type);
     $this->set('category', AttributeKeyCategory::getByHandle('store_product'));
     if ($this->isPost()) {
         $cnt = $type->getController();
         $cnt->setAttributeKey($key);
         $e = $cnt->validateKey($this->post());
         if ($e->has()) {
             $this->set('error', $e);
         } else {
             $key->update($this->post());
             $this->redirect('/dashboard/store/products/attributes', 'updated');
         }
     }
 }