public function afterSave() { // Leave only one default language if ($this->default) { self::model()->updateAll(array('default' => 0), 'id != ' . $this->id); } return parent::afterSave(); }
/** * @return boolean */ public function afterSave() { $this->order->updateTotalPrice(); $this->order->updateDeliveryPrice(); if ($this->isNewRecord) { $product = StoreProduct::model()->findByPk($this->product_id); $product->decreaseQuantity(); } return parent::afterSave(); }
public function afterSave() { Yii::app()->cache->delete(Yii::app()->currency->cacheKey); if ($this->default) { StoreCurrency::model()->updateAll(array('default' => 0), 'id != :id', array(':id' => $this->id)); } if ($this->main) { StoreCurrency::model()->updateAll(array('main' => 0), 'id != :id', array(':id' => $this->id)); } parent::afterSave(); }
protected function afterSave() { parent::afterSave(); return true; }
/** * After save event */ public function afterSave() { // Clear payment relations StoreDeliveryPayment::model()->deleteAllByAttributes(array('delivery_id' => $this->id)); foreach ($this->payment_methods as $pid) { $model = new StoreDeliveryPayment(); $model->delivery_id = $this->id; $model->payment_id = $pid; $model->save(false); } return parent::afterSave(); }
public function afterSave() { // Process related products if ($this->_related !== null) { $this->clearRelatedProducts(); foreach ($this->_related as $id) { $related = new StoreRelatedProduct(); $related->product_id = $this->id; $related->related_id = $id; $related->save(); } } // Save configurable attributes if ($this->_configurable_attribute_changed === true) { // Clear Yii::app()->db->createCommand()->delete('StoreProductConfigurableAttributes', 'product_id = :id', array(':id' => $this->id)); foreach ($this->_configurable_attributes as $attr_id) { Yii::app()->db->createCommand()->insert('StoreProductConfigurableAttributes', array('product_id' => $this->id, 'attribute_id' => $attr_id)); } } // Process min and max price for configurable product if ($this->use_configurations) { $this->updatePrices($this); } else { // Check if product is configuration $query = Yii::app()->db->createCommand()->from('StoreProductConfigurations t')->where(array('in', 't.configurable_id', array($this->id)))->queryAll(); foreach ($query as $row) { $model = StoreProduct::model()->findByPk($row['product_id']); if ($model) { $this->updatePrices($model); } } } $this->updated = date('Y-m-d H:i:s'); return parent::afterSave(); }
public function afterSave() { $this->clearRouteCache(); return parent::afterSave(); }
public function afterDelete() { Yii::app()->cache->delete('page_category_' . $this->url); return parent::afterSave(); }
/** * After save event */ public function afterSave() { $this->clearRelations(); // Process manufacturers if (!empty($this->_manufacturers)) { foreach ($this->_manufacturers as $id) { Yii::app()->db->createCommand()->insert('DiscountManufacturer', array('discount_id' => $this->id, 'manufacturer_id' => $id)); } } // Process categories if (!empty($this->_categories)) { foreach ($this->_categories as $id) { Yii::app()->db->createCommand()->insert('DiscountCategory', array('discount_id' => $this->id, 'category_id' => $id)); } } return parent::afterSave(); }