Example #1
0
 public function afterDelete()
 {
     if ($this->order) {
         $this->order->updateTotalPrice();
         $this->order->updateDeliveryPrice();
     }
     return parent::afterDelete();
 }
Example #2
0
 /**
  * Delete file, etc...
  */
 public function afterDelete()
 {
     // Delete file
     if (file_exists($this->filePath)) {
         unlink($this->filePath);
     }
     return parent::afterDelete();
 }
Example #3
0
 /**
  * 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();
 }
Example #4
0
 /**
  * After delete event
  */
 public function afterDelete()
 {
     $profile = $this->profile;
     if ($profile) {
         $profile->delete();
     }
     parent::afterDelete();
 }
Example #5
0
	/**
	 * Delete related data.
	 */
	public function afterDelete()
	{

		// Delete images
		$images = $this->images;
		if(!empty($images))
		{
			foreach ($images as $image)
				$image->delete();
		}
		

		return parent::afterDelete();
	}
Example #6
0
 /**
  * After delete module
  */
 public function afterDelete()
 {
     self::loadModuleClass($this->name)->afterRemove();
     self::deleteCaches();
     self::buildEventsFile();
     return parent::afterDelete();
 }
Example #7
0
 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();
 }
Example #8
0
 public function afterDelete()
 {
     $this->setIds(array());
     parent::afterDelete();
 }
Example #9
0
 /**
  * @return bool
  */
 public function afterDelete()
 {
     foreach ($this->products as $ordered_product) {
         $ordered_product->delete();
     }
     return parent::afterDelete();
 }
Example #10
0
	/**
	 * Delete related data.
	 */
	public function afterDelete()
	{
		return parent::afterDelete();
	}
Example #11
0
 public function afterDelete()
 {
     // Clear type attribute relations
     StoreTypeAttribute::model()->deleteAllByAttributes(array('type_id' => $this->id));
     return parent::afterDelete();
 }
Example #12
0
 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();
 }
Example #13
0
	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)));
 }
Example #15
0
 /**
  * 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();
 }