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


PHP Mage_SalesRule_Model_Rule::getDiscountQty方法代码示例

本文整理汇总了PHP中Mage_SalesRule_Model_Rule::getDiscountQty方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_SalesRule_Model_Rule::getDiscountQty方法的具体用法?PHP Mage_SalesRule_Model_Rule::getDiscountQty怎么用?PHP Mage_SalesRule_Model_Rule::getDiscountQty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_SalesRule_Model_Rule的用法示例。


在下文中一共展示了Mage_SalesRule_Model_Rule::getDiscountQty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getItemQty

 /**
  * Return discount item qty
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param Mage_SalesRule_Model_Rule $rule
  * @return int
  */
 protected function _getItemQty($item, $rule)
 {
     //@nelkaake: Magento 1.3 and lower doesnt have the item->getTotalQty attribute.
     if (Mage::helper('rewards/version')->isBaseMageVersionAtLeast('1.4')) {
         $qty = $item->getTotalQty();
     } else {
         $qty = $item->getQty();
         if ($item->getParentItem()) {
             $qty *= $item->getParentItem()->getQty();
         }
     }
     return $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:20,代码来源:Abstract.php

示例2: _getItemQty

 /**
  * Return discount item qty
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param Mage_SalesRule_Model_Rule $rule
  * @return int
  */
 protected function _getItemQty($item, $rule)
 {
     $qty = $item->getTotalQty();
     return $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:12,代码来源:Validator.php

示例3: getItemRuleQty

 public function getItemRuleQty(Mage_Sales_Model_Quote_Item_Abstract $item, Mage_SalesRule_Model_Rule $rule)
 {
     return $rule->getDiscountQty() ? min($item->getTotalQty(), $rule->getDiscountQty()) : $item->getTotalQty();
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:4,代码来源:Data.php

示例4: fireLegacyEvent

 /**
  * Fire a legacy event to process this rule for this item
  *
  * @param Mage_SalesRule_Model_Rule            $rule
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param Mage_Sales_Model_Quote_Address       $address
  *
  * @return bool
  */
 protected function fireLegacyEvent(Mage_SalesRule_Model_Rule $rule, Mage_Sales_Model_Quote_Item_Abstract $item, Mage_Sales_Model_Quote_Address $address)
 {
     // Prepare values for the event
     $quote = $address->getQuote();
     $qty = $rule->getDiscountQty() ? min($item->getTotalQty(), $rule->getDiscountQty()) : $item->getTotalQty();
     // Prepare result object
     $result = new Varien_Object(['discount_amount' => 0.0, 'base_discount_amount' => 0.0, 'applied' => false]);
     // Fire legacy event
     Mage::dispatchEvent('salesrule_validator_process', ['quote' => $quote, 'address' => $address, 'rule' => $rule, 'item' => $item, 'qty' => $qty, 'result' => $result]);
     // Save discount amounts
     $item->setDiscountAmount($item->getDiscountAmount() + $result->getData('discount_amount'));
     $item->setBaseDiscountAmount($item->getBaseDiscountAmount() + $result->getData('base_discount_amount'));
     // brain-dead check to see if a rule was applied
     return $result->getData('applied') || $result->getData('discount_amount') != 0.0;
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:24,代码来源:Calculator.php


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