public function afterDelete() { if ($this->order) { $this->order->updateTotalPrice(); $this->order->updateDeliveryPrice(); } return parent::afterDelete(); }
/** * Delete file, etc... */ public function afterDelete() { // Delete file if (file_exists($this->filePath)) { unlink($this->filePath); } return parent::afterDelete(); }
/** * Delete related data. */ public function afterDelete() { // Delete related products $this->clearRelatedProducts(); StoreRelatedProduct::model()->deleteAll('related_id=:id', array('id' => $this->id)); // Delete categorization StoreProductCategoryRef::model()->deleteAllByAttributes(array('product' => $this->id)); // Delete images $images = $this->images; if (!empty($images)) { foreach ($images as $image) { $image->delete(); } } // Delete variants $variants = StoreProductVariant::model()->findAllByAttributes(array('product_id' => $this->id)); foreach ($variants as $v) { $v->delete(); } // Clear configurable attributes Yii::app()->db->createCommand()->delete('StoreProductConfigurableAttributes', 'product_id=:id', array(':id' => $this->id)); // Delete configurations Yii::app()->db->createCommand()->delete('StoreProductConfigurations', 'product_id=:id', array(':id' => $this->id)); Yii::app()->db->createCommand()->delete('StoreProductConfigurations', 'configurable_id=:id', array(':id' => $this->id)); // Delete from wish lists Yii::import('application.modules.store.models.wishlist.StoreWishlistProducts'); $wishlistProduct = StoreWishlistProducts::model()->findByAttributes(array('product_id' => $this->id)); if ($wishlistProduct) { $wishlistProduct->delete(); } return parent::afterDelete(); }
/** * After delete event */ public function afterDelete() { $profile = $this->profile; if ($profile) { $profile->delete(); } parent::afterDelete(); }
/** * Delete related data. */ public function afterDelete() { // Delete images $images = $this->images; if(!empty($images)) { foreach ($images as $image) $image->delete(); } return parent::afterDelete(); }
/** * After delete module */ public function afterDelete() { self::loadModuleClass($this->name)->afterRemove(); self::deleteCaches(); self::buildEventsFile(); return parent::afterDelete(); }
public function afterDelete() { //Remove all products with this category set as main. $products = StoreProductCategoryRef::model()->findAllByAttributes(array('category' => $this->id, 'is_main' => '1')); foreach ($products as $p) { $productModel = StoreProduct::model()->findByPk($p->product); if ($productModel) { $productModel->delete(); } } // Remove all category-product relations StoreProductCategoryRef::model()->deleteAllByAttributes(array('category' => $this->id, 'is_main' => '0')); $this->clearRouteCache(); return parent::afterDelete(); }
public function afterDelete() { $this->setIds(array()); parent::afterDelete(); }
/** * @return bool */ public function afterDelete() { foreach ($this->products as $ordered_product) { $ordered_product->delete(); } return parent::afterDelete(); }
/** * Delete related data. */ public function afterDelete() { return parent::afterDelete(); }
public function afterDelete() { // Clear type attribute relations StoreTypeAttribute::model()->deleteAllByAttributes(array('type_id' => $this->id)); return parent::afterDelete(); }
public function afterDelete() { // Clear product relations StoreProduct::model()->updateAll(array('manufacturer_id' => new CDbExpression('NULL')), 'manufacturer_id = :id', array(':id' => $this->id)); return parent::afterDelete(); }
public function afterDelete() { // Delete options foreach($this->options as $o) $o->delete(); // Delete relations used in product type. EavTypeAttribute::model()->deleteAllByAttributes(array('attribute_id'=>$this->id)); // Delete attributes assigned to products $conn = $this->getDbConnection(); $command = $conn->createCommand("DELETE FROM eav_variants WHERE attribute_name='{$this->name}'"); $command->execute(); return parent::afterDelete(); }
protected function afterDelete() { parent::afterDelete(); vPorderDetail::model()->deleteAll(array('condition' => 'parent_id= :id', 'params' => array(':id' => $this->id))); }
/** * Delete file, etc... */ public function afterDelete() { // Delete file if (file_exists($this->filePath)) { unlink($this->filePath); } // If main image was deleted if ($this->is_main) { // Get first image and set it as main $model = PageImage::model()->find(); if ($model) { $model->is_main = 1; $model->save(false); } } return parent::afterDelete(); }