Beispiel #1
0
    public function delete()
    {
        $res = true;
        $images = $this->image;
        foreach ($images as $image) {
            if (preg_match('/sample/', $image) === 0) {
                if ($image) {
                    if (file_exists(dirname(__FILE__) . '/images/' . $image)) {
                        $res &= @unlink(dirname(__FILE__) . '/images/' . $image);
                    }
                    if (file_exists(dirname(__FILE__) . '/images/thumb_' . $image)) {
                        $res &= @unlink(dirname(__FILE__) . '/images/thumb_' . $image);
                    }
                    if (file_exists(dirname(__FILE__) . '/images/resize_' . $image)) {
                        $res &= @unlink(dirname(__FILE__) . '/images/resize_' . $image);
                    }
                }
            }
        }
        $res &= $this->reOrderPositions();
        $res &= Db::getInstance()->execute('
			DELETE FROM `' . _DB_PREFIX_ . 'homesliderpro`
			WHERE `id_homeslider_slides` = ' . (int) $this->id);
        $res &= parent::delete();
        return $res;
    }
Beispiel #2
0
 public function delete()
 {
     if (parent::delete()) {
         return $this->cleanPositions($this->id_cms_category);
     }
     return false;
 }
Beispiel #3
0
 public function delete()
 {
     if (($result = Db::getInstance()->ExecuteS('SELECT `id_product_attribute` FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE `' . $this->identifier . '` = ' . (int) $this->id)) != false) {
         return false;
     }
     $combinationIds = array();
     if (Db::getInstance()->numRows()) {
         foreach ($result as $row) {
             $combinationIds[] = (int) $row['id_product_attribute'];
         }
         if (Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE `' . $this->identifier . '` = ' . (int) $this->id) === false) {
             return false;
         }
         if (Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `id_product_attribute` IN (' . implode(', ', $combinationIds) . ')') === false) {
             return false;
         }
     }
     if (!$this->deleteImage()) {
         return false;
     }
     $return = parent::delete();
     if ($return) {
         Module::hookExec('afterDeleteAttribute', array('id_attribute' => $this->id));
     }
     return $return;
 }
Beispiel #4
0
 public function delete()
 {
     /* Select children in order to find linked combinations */
     $attributeIds = Db::getInstance()->ExecuteS('SELECT `id_attribute` FROM `' . _DB_PREFIX_ . 'attribute` WHERE `id_attribute_group` = ' . intval($this->id));
     if ($attributeIds === false) {
         return false;
     }
     /* Removing attributes to the found combinations */
     $toRemove = array();
     foreach ($attributeIds as $attribute) {
         $toRemove[] = intval($attribute['id_attribute']);
     }
     if (!empty($toRemove) and Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE `id_attribute` IN (' . implode(', ', $toRemove) . ')') === false) {
         return false;
     }
     /* Remove combinations if they do not possess attributes anymore */
     if (!self::cleanDeadCombinations()) {
         return false;
     }
     /* Also delete related attributes */
     if (Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'attribute_lang` WHERE `id_attribute` IN (SELECT id_attribute FROM `' . _DB_PREFIX_ . 'attribute` WHERE `id_attribute_group` = ' . intval($this->id) . ')') === false or Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'attribute` WHERE `id_attribute_group` = ' . intval($this->id)) === false) {
         return false;
     }
     return parent::delete();
 }
Beispiel #5
0
 public function delete()
 {
     if (parent::delete()) {
         return Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'access` WHERE `id_profile` = ' . intval($this->id));
     }
     return false;
 }
Beispiel #6
0
 public function delete()
 {
     if (parent::delete()) {
         return Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'access` WHERE `id_profile` = ' . (int) $this->id) && Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'module_access` WHERE `id_profile` = ' . (int) $this->id);
     }
     return false;
 }
Beispiel #7
0
 public function delete()
 {
     if (!Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'order:shipment` WHERE `id_order_shipment` = ' . intval($this->id))) {
         return false;
     }
     return parent::delete();
 }
Beispiel #8
0
 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     return Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'cart_rule_country WHERE id_country = ' . (int) $this->id);
 }
Beispiel #9
0
 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()
 {
     if (!empty($this->file_name)) {
         @unlink(_PS_UPLOAD_DIR_ . $this->file_name);
     }
     return parent::delete();
 }
Beispiel #11
0
 public function delete()
 {
     $id = $this->id;
     parent::delete();
     // remove associated zip codes & tax rule
     return County::deleteZipCodeByIdCounty($id) and TaxRule::deleteTaxRuleByIdCounty($id);
 }
 /**
  * Delete object
  *
  * @param bool $deleteFile if true delete the file on disk
  * @return bool success
  */
 public function delete($deleteFile = false)
 {
     if ($deleteFile) {
         $this->deleteFile();
     }
     return parent::delete();
 }
Beispiel #13
0
 public function delete()
 {
     if ((int) $this->id === 0) {
         return false;
     }
     return SimpleBlogCategory::deleteCover($this) && parent::delete() && $this->cleanPositions($this->id_parent);
 }
    public function delete()
    {
        if (!parent::delete()) {
            return false;
        }
        if ($this->hasMultishopEntries()) {
            return true;
        }
        if (!$this->deleteProductAttributeImage() || !$this->deleteImage()) {
            return false;
        }
        // update positions
        $result = Db::getInstance()->executeS('
			SELECT *
			FROM `' . _DB_PREFIX_ . 'image`
			WHERE `id_product` = ' . (int) $this->id_product . '
			ORDER BY `position`
		');
        $i = 1;
        if ($result) {
            foreach ($result as $row) {
                $row['position'] = $i++;
                Db::getInstance()->update($this->def['table'], $row, '`id_image` = ' . (int) $row['id_image'], 1);
            }
        }
        return true;
    }
Beispiel #15
0
 public function delete()
 {
     if (!Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'tax_state` WHERE `id_tax` = ' . intval($this->id))) {
         return false;
     }
     return parent::delete();
 }
Beispiel #16
0
 public function delete()
 {
     if ((int) $this->id === 0) {
         return false;
     }
     return SimpleBlogPost::deleteCover($this) && SimpleBlogPost::deleteFeatured($this) && parent::delete();
 }
Beispiel #17
0
 public function delete()
 {
     if (!parent::delete() or $this->deleteAssociations() === false) {
         return false;
     }
     return true;
 }
Beispiel #18
0
 public function delete()
 {
     if (Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'access WHERE `id_tab` = ' . intval($this->id)) and parent::delete()) {
         return $this->cleanPositions($this->id_parent);
     }
     return false;
 }
 public function delete()
 {
     if (parent::delete()) {
         return $this->cleanPositions($this->id_opartslideshow_slideshow);
     }
     return false;
 }
Beispiel #20
0
 public function delete($delete_file = false)
 {
     $result = parent::delete();
     if ($result && $delete_file) {
         return $this->deleteFile();
     }
     return $result;
 }
 public function delete()
 {
     if (!Validate::isUnsignedId($this->id)) {
         return false;
     }
     Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'customer_message` WHERE `id_customer_thread` = ' . (int) $this->id);
     return parent::delete();
 }
Beispiel #22
0
    public function delete()
    {
        $res = Db::getInstance()->execute('
			DELETE FROM `' . _DB_PREFIX_ . 'advance_footer_shop`
			WHERE `id_block` = ' . (int) $this->id);
        $res &= parent::delete();
        return $res;
    }
 public function delete()
 {
     if (parent::delete()) {
         Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'customer_group` WHERE `id_group` = ' . intval($this->id));
         Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'category_group` WHERE `id_group` = ' . intval($this->id));
         return true;
     }
     return false;
 }
Beispiel #24
0
 public function delete()
 {
     Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'wishlist_email` WHERE `id_wishlist` = ' . (int) $this->id);
     Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'wishlist_product` WHERE `id_wishlist` = ' . (int) $this->id);
     if (isset($this->context->cookie->id_wishlist)) {
         unset($this->context->cookie->id_wishlist);
     }
     return parent::delete();
 }
 public function delete()
 {
     //delete first all features into this group
     $sql = "DELETE FROM " . _DB_PREFIX_ . "feature_lang WHERE id_feature IN (SELECT id_feature  FROM " . _DB_PREFIX_ . "feature WHERE id_group = " . $this->id . ")";
     $r = Db::getInstance()->Execute($sql);
     $sql = "DELETE FROM " . _DB_PREFIX_ . "feature WHERE id_group=" . $this->id;
     $r = Db::getInstance()->Execute($sql);
     return parent::delete();
 }
 public function delete()
 {
     if (parent::delete()) {
         // Refresh cache of feature detachable
         Configuration::updateGlobalValue('PS_ALIAS_FEATURE_ACTIVE', Alias::isCurrentlyUsed($this->def['table'], true));
         return true;
     }
     return false;
 }
Beispiel #27
0
    public function delete()
    {
        $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'egms_city_url
		WHERE id_city =' . (int) $this->id_egms_city;
        if (!Db::getInstance()->executeS($sql)) {
            return parent::delete();
        }
        return false;
    }
Beispiel #28
0
 public function delete()
 {
     $this->cleanImages();
     $this->cleanProducts();
     $this->cleanCategories();
     $this->cleanComments();
     $this->cleanRelated();
     return parent::delete();
 }
Beispiel #29
0
    public function delete()
    {
        $res = true;
        $res &= Db::getInstance()->execute('
			DELETE FROM `' . _DB_PREFIX_ . 'home_adv_shop`
			WHERE `id_htmlobject` = ' . (int) $this->id);
        $res &= parent::delete();
        return $res;
    }
Beispiel #30
0
 public function delete()
 {
     $this->deleteZoneProducts();
     $this->deleteCategories();
     if (parent::delete()) {
         return $this->deleteImage() && Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', Scene::isCurrentlyUsed($this->def['table'], true));
     }
     return false;
 }