本文整理汇总了PHP中Mage_SalesRule_Model_Rule::_afterSave方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_SalesRule_Model_Rule::_afterSave方法的具体用法?PHP Mage_SalesRule_Model_Rule::_afterSave怎么用?PHP Mage_SalesRule_Model_Rule::_afterSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_SalesRule_Model_Rule
的用法示例。
在下文中一共展示了Mage_SalesRule_Model_Rule::_afterSave方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterSave
protected function _afterSave()
{
$iRuleId = $this->getId();
$oReq = Mage::app()->getFrontController()->getRequest();
$aData = $oReq->getPost();
/* This check has been added for Amastsy extension to work properly while sending coupons through cron */
if (empty($aData)) {
return parent::_afterSave();
}
/* This check has been added for Amastsy extension to work properly while sending coupons through cron */
/* modifying this line to trigger newsletter subscription coupon */
if (!isset($aData['customer_individ_ids'])) {
return parent::_afterSave();
}
/* modifying this line to trigger newsletter subscription coupon */
$oResource = Mage::getSingleton('core/resource');
$sTable = $oResource->getTableName('aitoc_salesrule_assign_cutomer');
$oDb = Mage::getSingleton('core/resource')->getConnection('core_write');
if (!isset($aData['customer_group_ids']) or !$aData['customer_group_ids']) {
if (version_compare(Mage::getVersion(), '1.12.0.0', '>=')) {
$oDb->delete(Mage::getSingleton('core/resource')->getTableName('salesrule_customer_group'), 'rule_id = ' . $iRuleId);
} else {
$oResModel = Mage::getModel('salesrule/mysql4_rule');
$oDb->update($oResModel->getMainTable(), array('customer_group_ids' => ''), 'rule_id = ' . $iRuleId);
}
}
if ($aData['customer_individ_ids']) {
$aCustomerHash = explode('_', $aData['customer_individ_ids']);
# $oDb->update($oResModel->getMainTable(), array('customer_group_ids' => 'individ'), 'rule_id = ' . $iRuleId);
} else {
$aCustomerHash = array();
# $oDb->update($oResModel->getMainTable(), array('customer_group_ids' => implode(',', $aData['customer_group_ids'])), 'rule_id = ' . $iRuleId);
}
$oDb->delete($sTable, 'entity_id = ' . $iRuleId);
if ($aCustomerHash) {
foreach ($aCustomerHash as $sKey => $sValue) {
if ($sValue) {
$aDBInfo = array('entity_id' => $iRuleId, 'customer_id' => $sValue, 'coupon_code' => $aData['coupon_code']);
$oDb->insert($sTable, $aDBInfo);
}
}
}
return parent::_afterSave();
}
示例2: _afterSave
/**
* Process rule related data after rule save
*
* @return Mage_CatalogRule_Model_Rule
*/
protected function _afterSave()
{
$this->_getResource()->updateRuleProductData($this);
parent::_afterSave();
}