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


PHP Mage_Sales_Model_Quote_Item::getHasChildren方法代码示例

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


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

示例1: isItemInventoried

 /**
  * Test if the item needs to have its quantity checked for available
  * inventory.
  * @param  Mage_Sales_Model_Quote_Item $item The item to check
  * @return bool True if inventory is managed, false if not
  */
 public function isItemInventoried(Mage_Sales_Model_Quote_Item $item)
 {
     // never consider a child product as inventoried, allow the parent deal
     // with inventory and let the child not need to worry about it as the parent
     // will be the item to keep track of qty being ordered.
     // Both checks needed as child items will not have a parent item id prior
     // to being saved and a parent item prior to being added to the parent (e.g.
     // immediately after being loaded from the DB).
     if ($item->getParentItemId() || $item->getParentItem()) {
         return false;
     }
     // when dealing with parent items, if any child of the product is managed
     // stock, consider the entire item as managed stock - allows for the parent
     // config product in the quote to deal with inventory while allowing child
     // products to not care individually
     if ($item->getHasChildren()) {
         foreach ($item->getChildren() as $childItem) {
             $childStock = $childItem->getProduct()->getStockItem();
             if ($this->isManagedStock($childStock)) {
                 // This Parent is inventoried. Child's ROM setting is 'No backorders', and Manage Stock check hasn't been manually overridden
                 return true;
             }
         }
         // if none of the children were managed stock, the parent is not inventoried
         return false;
     }
     return $this->isManagedStock($item->getProduct()->getStockItem());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:34,代码来源:Item.php

示例2: _getStdWeightQtyTotals

 /**
  * Gets the item information for standard items or child items of configurable products
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param bool $cartFreeShipping
  * @return Webshopapps_Wsacommon_Model_Totals
  */
 protected function _getStdWeightQtyTotals($item, $cartFreeShipping)
 {
     $finalTotals = new Webshopapps_Wsacommon_Model_Totals();
     $addressWeight = 0;
     $addressQty = 0;
     $freeMethodWeight = 0;
     if ($item->getHasChildren() && ($item->isShipSeparately() || $item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)) {
         foreach ($item->getChildren() as $child) {
             if ($child->getProduct()->isVirtual()) {
                 continue;
             }
             $addressQty += $item->getQty() * $child->getQty();
             $itemWeight = $child->getWeight();
             $itemQty = $child->getTotalQty();
             $rowWeight = $itemWeight * $itemQty;
             if ($cartFreeShipping || $child->getFreeShipping() === true) {
                 $rowWeight = 0;
             } elseif (is_numeric($child->getFreeShipping())) {
                 $freeQty = $child->getFreeShipping();
                 if ($itemQty > $freeQty) {
                     $rowWeight = $itemWeight * ($itemQty - $freeQty);
                 } else {
                     $rowWeight = 0;
                 }
             }
             $freeMethodWeight += $rowWeight;
             $addressWeight += $rowWeight;
         }
     } else {
         $addressQty += $item->getQty();
         $itemWeight = $item->getWeight();
         $rowWeight = $itemWeight * $item->getQty();
         $addressWeight += $rowWeight;
         if ($cartFreeShipping || $item->getFreeShipping() === true) {
             $rowWeight = 0;
         } elseif (is_numeric($item->getFreeShipping())) {
             $freeQty = $item->getFreeShipping();
             if ($item->getQty() > $freeQty) {
                 $rowWeight = $itemWeight * ($item->getQty() - $freeQty);
             } else {
                 $rowWeight = 0;
             }
         }
         $freeMethodWeight += $rowWeight;
     }
     $finalTotals->setWeight($addressWeight);
     $finalTotals->setFreeMethodWeight($freeMethodWeight);
     // TODO This wasnt in original, needs checking
     $finalTotals->setQty($addressQty);
     return $finalTotals;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:58,代码来源:Totals.php

示例3: deleteItem

 /**
  * Delete quote item. If it does not have identifier then it will be only removed from collection
  *
  * @param   Mage_Sales_Model_Quote_Item $item
  * @return  Mage_Sales_Model_Quote
  */
 public function deleteItem(Mage_Sales_Model_Quote_Item $item)
 {
     if ($item->getId()) {
         $this->removeItem($item->getId());
     } else {
         $quoteItems = $this->getItemsCollection();
         $items = array($item);
         if ($item->getHasChildren()) {
             foreach ($item->getChildren() as $child) {
                 $items[] = $child;
             }
         }
         foreach ($quoteItems as $key => $quoteItem) {
             foreach ($items as $item) {
                 if ($quoteItem->compare($item)) {
                     $quoteItems->removeItemByKey($key);
                 }
             }
         }
     }
     return $this;
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:28,代码来源:Quote.php

示例4: processItemGroup

 /**
  * Adds all the items to an array including any child items.
  * No need to check if item is valid. This is called after totals which already does the validation
  *
  * @param Array                       $itemGroup - The array which is passed back by reference
  * @param Mage_Sales_Model_Quote_Item $item      - The item to process
  */
 private static function processItemGroup(&$itemGroup, $item)
 {
     if ($item->getHasChildren() && $item->isShipSeparately()) {
         foreach ($item->getChildren() as $child) {
             $itemGroup[] = $child;
         }
     } else {
         $itemGroup[] = $item;
     }
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:17,代码来源:Shipping.php


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