/** * Set aggregated conditions SQL and reset sales rule Id if applicable * * @return Enterprise_Reminder_Model_Rule */ protected function _beforeSave() { $this->setConditionSql($this->getConditions()->getConditionsSql(null, new Zend_Db_Expr(':website_id'))); if (!$this->getSalesruleId()) { $this->setSalesruleId(null); } parent::_beforeSave(); return $this; }
/** * Reset action cached select if actions conditions has changed * * @return Enterprise_TargetRule_Model_Rule */ protected function _beforeSave() { parent::_beforeSave(); if ($this->dataHasChangedFor('actions_serialized')) { $this->setData('action_select', null); $this->setData('action_select_bind', null); } return $this; }
/** * Set aggregated conditions SQL. * Collect and save list of events which are applicable to segment. * * @return Enterprise_CustomerSegment_Model_Segment */ protected function _beforeSave() { if (!$this->getData('processing_frequency')) { $this->setData('processing_frequency', '1'); } if (!$this->isObjectNew()) { // Keep 'apply_to' property without changes for existing customer segments $this->setData('apply_to', $this->getOrigData('apply_to')); } $events = array(); if ($this->getIsActive()) { $events = $this->collectMatchedEvents(); } $customer = new Zend_Db_Expr(':customer_id'); $website = new Zend_Db_Expr(':website_id'); $this->setConditionSql($this->getConditions()->getConditionsSql($customer, $website)); $this->setMatchedEvents(array_unique($events)); parent::_beforeSave(); return $this; }
/** * Prepare data before saving * * @return Mage_Rule_Model_Rule */ protected function _beforeSave() { parent::_beforeSave(); if (is_array($this->getPaymentMethodsIds())) { $this->setPaymentMethodsIds(join(',', $this->getPaymentMethodsIds())); } if (is_array($this->getShippingMethodsIds())) { $this->setShippingMethodsIds(join(',', $this->getShippingMethodsIds())); } if (is_array($this->getCustomerGroupIds())) { $this->setCustomerGroupIds(join(',', $this->getCustomerGroupIds())); } if (is_array($this->getWebsiteIds())) { $this->setWebsiteIds(join(',', $this->getWebsiteIds())); } }