Ejemplo n.º 1
0
 public function delete()
 {
     if ($this->isAdmin == true) {
         if ($_REQUEST['id'][0] != "") {
             $attributeValueModel = new AttributeValueModel();
             foreach ($_REQUEST['id'] as $id) {
                 $attributeValueModel->setAid($id);
                 $attributeValueModel->deleteByAttribute();
                 $this->attributeModel->setId($id);
                 $this->attributeModel->delete();
             }
             $this->listing();
         }
     }
 }
Ejemplo n.º 2
0
 protected function insertAttributes($pid, $cids, $attributes)
 {
     $avm = new AttributeValueModel();
     $filter['atr_categories'] = $cids;
     $cidsArr = explode(",", $cids);
     $atrs = $this->attributeModel->fetchAttributes(null, $filter);
     $attributes_colon = explode("#", $attributes);
     foreach ($cidsArr as $cid) {
         foreach ($attributes_colon as $k => $v) {
             $attribute = explode(":", $v);
             foreach ($atrs as $atr) {
                 if ($atr->getCid() == $cid && strtolower($atr->getName()) == strtolower(trim($attribute[0]))) {
                     $avm->setApValue($attribute[1]);
                     $avm->setAid($atr->getId());
                     $avm->setCid($cid);
                     $avm->setPid($pid);
                     $avm->insert();
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function saveProductAttributesValue($attrsv_arr, $pid)
 {
     if (is_array($attrsv_arr) && count($attrsv_arr) > 0 && $pid != "") {
         $this->attrValModel->setPid($pid);
         $this->attrValModel->deleteByProduct();
         $this->attrValModel = new AttributeValueModel();
         $attrs = $this->attrModel->fetchAttributes(array(), array("atr_aids" => implode(",", array_keys($attrsv_arr))));
         foreach ($attrs as $ai => $atr) {
             if (array_key_exists($atr->getId(), $attrsv_arr)) {
                 $atrmodel = new AttributeValueModel();
                 $atrmodel->setCid($atr->getCid());
                 $atrmodel->setAid($atr->getId());
                 $atrmodel->setPid($pid);
                 $atrmodel->setApValue($attrsv_arr[$atr->getId()]);
                 $atrmodel->insert();
             }
         }
     }
 }