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


PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItem方法代码示例

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


在下文中一共展示了Mage_Sales_Model_Quote_Item_Abstract::getParentItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getRequestedItemQuantity

 /**
  * Get the quantity requeted for a single item.
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract
  * @return int
  */
 public function getRequestedItemQuantity(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     // Child item quantity is the static quantity of the child
     // item within a single unit of the parent. E.g. a configurable
     // product's child item's quantity, will always be 1 - one child in
     // the configurable item. Bundle items, however, will be
     // the number of the child items in a single unit of the
     // parent bundle, depending on how the bundle was configured when
     // added to cart - actual quantity of the child is child
     // quantity * parent quantity.
     $parentItem = $item->getParentItem();
     return $item->getQty() * ($parentItem ? $parentItem->getQty() : 1);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:19,代码来源:Quantity.php

示例3: isExcludedItem

 /**
  * returns true if the item is the child of configurable/grouped product
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @return bool
  */
 public function isExcludedItem(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     return $item->getParentItem() instanceof Mage_Sales_Model_Quote_Item;
 }
开发者ID:ryaan-anthony,项目名称:magento-retail-order-management,代码行数:10,代码来源:Selection.php

示例4: itemIsConfigurableChild

 /**
  * Check if the item is the child of a configurable product.
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract
  * @return bool
  */
 protected function itemIsConfigurableChild(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $parentItem = $item->getParentItem();
     return $parentItem && $parentItem->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:11,代码来源:Selection.php

示例5: _recalculateChildDiscount

 /**
  * Recalculate child discount. Separate discount between children
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $child
  * @return  Mage_SalesRule_Model_Quote_Discount
  */
 protected function _recalculateChildDiscount($child)
 {
     $item = $child->getParentItem();
     $prices = array('base' => $item->getBaseOriginalPrice(), 'current' => $item->getPrice());
     $keys = array('discount_amount', 'original_discount_amount');
     foreach ($keys as $key) {
         $child->setData($key, $child->getData($key) * $child->getPrice() / $prices['current']);
         $child->setData('base_' . $key, $child->getData('base_' . $key) * $child->getPrice() / $prices['base']);
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:17,代码来源:Discount.php


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