当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_SalesRule_Model_Rule::_afterSave方法代码示例

本文整理汇总了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();
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:44,代码来源:FrontSalesRuleRule.php

示例2: _afterSave

 /**
  * Process rule related data after rule save
  *
  * @return Mage_CatalogRule_Model_Rule
  */
 protected function _afterSave()
 {
     $this->_getResource()->updateRuleProductData($this);
     parent::_afterSave();
 }
开发者ID:novayadi85,项目名称:galatema,代码行数:10,代码来源:Productrule.php


注:本文中的Mage_SalesRule_Model_Rule::_afterSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。