public function afterDelete() { if ($this->order) { $this->order->updateTotalPrice(); $this->order->updateDeliveryPrice(); } return parent::afterDelete(); }
public function afterDelete() { $result = parent::afterDelete(); if ($result) { Yii::app()->nfy->unsubscribe($this->id, null, true); } return $result; }
public function afterDelete() { if ($this->scenario != 'cascadaPartida') { foreach ($this->presupuestoPartida as $c) { $c->delete(); } } return parent::afterDelete(); }
public function afterDelete() { Yii::import('application.modules.cabinet.models.ShopItems'); parent::afterDelete(); // При удалении удаляю предметы из набора $items = ShopItems::model()->findAll('pack_id = :pack_id', array(':pack_id' => $this->id)); foreach ($items as $item) { $item->delete(); } }
/** * Delete related data. */ public function afterDelete() { // Delete related products $this->clearRelatedProducts(); ShopRelatedProduct::model()->deleteAll('related_id=:id', array('id' => $this->id)); // Delete categorization ShopProductCategoryRef::model()->deleteAllByAttributes(array('product' => $this->id)); // Delete images $images = $this->images; if (!empty($images)) { foreach ($images as $image) { $image->delete(); } } // Delete variants $variants = ShopProductVariant::model()->findAllByAttributes(array('product_id' => $this->id)); foreach ($variants as $v) { $v->delete(); } // Clear configurable attributes Yii::app()->db->createCommand()->delete('{{shop_product_configurable_attributes}}', 'product_id=:id', array(':id' => $this->id)); // Delete configurations Yii::app()->db->createCommand()->delete('{{shop_product_configurations}}', 'product_id=:id', array(':id' => $this->id)); Yii::app()->db->createCommand()->delete('{{shop_product_configurations}}', 'configurable_id=:id', array(':id' => $this->id)); // Delete from wish lists if install module "wishlist" if (Yii::app()->hasModule('wishlist')) { Yii::import('mod.wishlist.models.*'); $wishlistProduct = WishlistProducts::model()->findByAttributes(array('product_id' => $this->id)); if ($wishlistProduct) { $wishlistProduct->delete(); } } return parent::afterDelete(); }
public function afterDelete() { //Remove all products with this category set as main. $products = ShopProductCategoryRef::model()->findAllByAttributes(array('category' => $this->id, 'is_main' => '1')); foreach ($products as $p) { $productModel = ShopProduct::model()->findByPk($p->product); if ($productModel) { $productModel->delete(); } } // Remove all category-product relations ShopProductCategoryRef::model()->deleteAllByAttributes(array('category' => $this->id, 'is_main' => '0')); $this->clearRouteCache(); return parent::afterDelete(); }
public function afterDelete() { // Clear product relations ShopProduct::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. ShopTypeAttribute::model()->deleteAllByAttributes(array('attribute_id' => $this->id)); // Delete attributes assigned to products $conn = $this->getDbConnection(); $command = $conn->createCommand("DELETE FROM `{{shop_product_attribute_eav}}` WHERE `attribute`='{$this->name}'"); $command->execute(); return parent::afterDelete(); }
public function afterDelete() { ServerConfig::model()->deleteByPk($this->id); UserServer::model()->deleteAllByAttributes(array('server_id' => $this->id)); FtpUserServer::model()->deleteAllByAttributes(array('server_id' => $this->id)); Command::model()->deleteAllByAttributes(array('server_id' => $this->id)); Schedule::model()->deleteAllByAttributes(array('server_id' => $this->id)); $plrs = Player::model()->findAllByAttributes(array('server_id' => $this->id)); foreach ($plrs as $plr) { $plr->delete(); } return parent::afterDelete(); }
public function afterDelete() { $this->setIds(array()); parent::afterDelete(); }
public function afterDelete() { $path = Yii::getPathOfAlias(self::UPLOAD_PATH); if (file_exists($path . DS . $this->icon_file)) { unlink($path . DS . $this->icon_file); } parent::afterDelete(); }
/** * After a PollVote is deleted. */ public function afterDelete() { $this->choice->votes -= 1; $this->choice->save(); parent::afterDelete(); }
protected function afterDelete() { if(parent::afterDelete()) { return true; } else { return false; } }
public function afterDelete() { parent::afterDelete(); foreach ($this->images as $image) { $image->delete(); } }
/** * 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 = ShopProductImage::model()->find(); if ($model) { $model->is_main = 1; $model->save(false, false, false); } } return parent::afterDelete(); }
public function afterDelete() { // Clear type attribute relations ShopTypeAttribute::model()->deleteAllByAttributes(array('type_id' => $this->id)); return parent::afterDelete(); }
public function afterDelete() { parent::afterDelete(); Yii::import('application.modules.cabinet.models.ShopItemsPacks'); Yii::import('application.modules.cabinet.models.ShopItems'); $criteria = new CDbCriteria(array('condition' => 'category_id = :category_id', 'params' => array(':category_id' => $this->getPrimaryKey()), 'with' => array('items'))); $model = ShopItemsPacks::model()->findAll($criteria); foreach ($model as $pack) { foreach ($pack->items as $item) { $item->delete(); } $pack->delete(); } }
public function afterDelete() { UserServer::model()->deleteAllByAttributes(array('user_id' => $this->id)); $ftpUser = FtpUser::model()->findByAttributes(array('name' => $this->name)); if ($ftpUser) { FtpUserServer::model()->deleteAllByAttributes(array('user_id' => $ftpUser->id)); $ftpUser->delete(); } return parent::afterDelete(); }
public function afterDelete() { $dir = $this->getBaseDir() . DS . $this->id; if (is_dir($dir)) { Common::deleteDir($dir); } return parent::afterDelete(); }
/** * @return bool */ public function afterDelete() { foreach ($this->products as $ordered_product) { $ordered_product->delete(); } return parent::afterDelete(); }