public function delete() { if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL) { $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute_combination WHERE id_attribute = ' . (int) $this->id); $products = array(); foreach ($result as $row) { $combination = new Combination($row['id_product_attribute']); $new_request = Db::getInstance()->executeS('SELECT id_product, default_on FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product_attribute = ' . (int) $row['id_product_attribute']); foreach ($new_request as $value) { if ($value['default_on'] == 1) { $products[] = $value['id_product']; } } $combination->delete(); } foreach ($products as $product) { $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product = ' . (int) $product . ' LIMIT 1'); foreach ($result as $row) { if (Validate::isLoadedObject($product = new Product((int) $product))) { $product->deleteDefaultAttributes(); $product->setDefaultAttribute($row['id_product_attribute']); } } } // Delete associated restrictions on cart rules CartRule::cleanProductRuleIntegrity('attributes', $this->id); /* Reinitializing position */ $this->cleanPositions((int) $this->id_attribute_group); } $return = parent::delete(); if ($return) { Hook::exec('actionAttributeDelete', array('id_attribute' => $this->id)); } return $return; }
public function delete() { $address = new Address($this->id_address); if (Validate::isLoadedObject($address) and !$address->delete()) { return false; } if (parent::delete()) { CartRule::cleanProductRuleIntegrity('manufacturers', $this->id); return $this->deleteImage(); } }
public function delete() { if (!$this->hasMultishopEntries()) { $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute_combination WHERE id_attribute = ' . (int) $this->id); foreach ($result as $row) { $combination = new Combination($row['id_product_attribute']); $combination->delete(); } // Delete associated restrictions on cart rules CartRule::cleanProductRuleIntegrity('attributes', $this->id); /* Reinitializing position */ $this->cleanPositions((int) $this->id_attribute_group); } $return = parent::delete(); if ($return) { Hook::exec('actionAttributeDelete', array('id_attribute' => $this->id)); } return $return; }
/** * @see ObjectModel::delete() */ public function delete() { if (parent::delete()) { CartRule::cleanProductRuleIntegrity('suppliers', $this->id); return $this->deleteImage(); } }
public function delete() { if ((int) $this->id === 0 || (int) $this->id === (int) Configuration::get('PS_ROOT_CATEGORY')) { return false; } $this->clearCache(); $deleted_children = $all_cat = $this->getAllChildren(); $all_cat[] = $this; foreach ($all_cat as $cat) { /** @var Category $cat */ $cat->deleteLite(); if (!$this->hasMultishopEntries()) { $cat->deleteImage(); $cat->cleanGroups(); $cat->cleanAssoProducts(); // Delete associated restrictions on cart rules CartRule::cleanProductRuleIntegrity('categories', array($cat->id)); Category::cleanPositions($cat->id_parent); /* Delete Categories in GroupReduction */ if (GroupReduction::getGroupsReductionByCategoryId((int) $cat->id)) { GroupReduction::deleteCategory($cat->id); } } } /* Rebuild the nested tree */ if (!$this->hasMultishopEntries() && (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)) { Category::regenerateEntireNtree(); } Hook::exec('actionCategoryDelete', array('category' => $this, 'deleted_children' => $deleted_children)); return true; }
public function deleteFromCartRules() { CartRule::cleanProductRuleIntegrity('products', $this->id); return true; }