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


PHP Mage_Sales_Model_Quote_Item_Abstract::getChildren方法代码示例

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


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

示例1: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = 0;
     $basePrice = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     $priceInclTax = 0;
     $basePriceInclTax = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     foreach ($item->getChildren() as $child) {
         $price += $child->getPrice() * $child->getQty();
         $basePrice += $child->getBasePrice() * $child->getQty();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $priceInclTax += $child->getPriceInclTax() * $child->getQty();
         $basePriceInclTax += $child->getBasePriceInclTax() * $child->getQty();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
     }
     /**
      *
      * Customisation To make the custom price work with configurable items
      *
      **/
     if ($item->getCustomPrice()) {
         $customPrice = $item->getCustomPrice();
         $price = $customPrice;
         $basePrice = $customPrice;
         $rowTotal = $customPrice * $item->getQty();
         $baseRowTotal = $customPrice * $item->getQty();
         $priceInclTax = $customPrice;
         $basePriceInclTax = $customPrice;
         $rowTotalInclTax = $customPrice * $item->getQty();
         $baseRowTotalInclTax = $customPrice * $item->getQty();
     }
     $item->setConvertedPrice($price);
     $item->setPrice($basePrice);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($priceInclTax);
     $item->setBasePriceInclTax($basePriceInclTax);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:52,代码来源:Subtotal.php

示例2: _recalculateParent

 /**
  * Recalculate parent item amounts base on children data
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $rowTaxAmount = 0;
     $baseRowTaxAmount = 0;
     foreach ($item->getChildren() as $child) {
         $rowTaxAmount += $child->getTaxAmount();
         $baseRowTaxAmount += $child->getBaseTaxAmount();
     }
     $item->setTaxAmount($rowTaxAmount);
     $item->setBaseTaxAmount($baseRowTaxAmount);
     return $this;
 }
开发者ID:redesignMob,项目名称:extensii,代码行数:18,代码来源:Tax.php

示例3: getApplied

 /**
  * Returns applied weee taxes
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return array
  */
 public function getApplied($item)
 {
     if ($item instanceof Mage_Sales_Model_Quote_Item_Abstract) {
         if ($item->getHasChildren() && $item->isChildrenCalculated()) {
             $result = array();
             foreach ($item->getChildren() as $child) {
                 $childData = $this->getApplied($child);
                 if (is_array($childData)) {
                     $result = array_merge($result, $childData);
                 }
             }
             return $result;
         }
     }
     /**
      * if order item data is old enough then weee_tax_applied cab be
      * not valid serialized data
      */
     $data = $item->getWeeeTaxApplied();
     if (empty($data)) {
         return array();
     }
     return unserialize($item->getWeeeTaxApplied());
 }
开发者ID:vishalpatel14,项目名称:indiankalaniketan,代码行数:30,代码来源:Data.php

示例4: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  *
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $rowTotal = 0;
     $baseRowTotal = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     $rowTax = 0;
     $baseRowTax = 0;
     $store = $item->getStore();
     $qty = $item->getQty();
     foreach ($item->getChildren() as $child) {
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
         $rowTax += $child->getRowTax();
         $baseRowTax += $child->getBaseRowTax();
     }
     $item->setConvertedPrice($store->roundPrice($rowTotal) / $qty);
     $item->setPrice($store->roundPrice($baseRowTotal) / $qty);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($store->roundPrice($rowTotalInclTax) / $qty);
     $item->setBasePriceInclTax($store->roundPrice($baseRowTotalInclTax) / $qty);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     $item->setRowTax($rowTax);
     $item->setBaseRowTax($baseRowTax);
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:37,代码来源:Subtotal.php

示例5: _recalculateParent

 /**
  * Recalculate parent item amounts base on children data
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $calculationPrice = 0;
     $baseCalculationPrice = 0;
     $rowTaxAmount = 0;
     $baseRowTaxAmount = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     foreach ($item->getChildren() as $child) {
         $calculationPrice += $child->getCalculationPrice();
         $baseCalculationPrice += $child->getBaseCalculationPrice();
         $rowTaxAmount += $child->getTaxAmount();
         $baseRowTaxAmount += $child->getBaseTaxAmount();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
     }
     $item->setOriginalPrice($calculationPrice);
     $item->setPrice($baseCalculationPrice);
     $item->setTaxAmount($rowTaxAmount);
     $item->setBaseTaxAmount($baseRowTaxAmount);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:30,代码来源:Tax.php

示例6: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = 0;
     $basePrice = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     $priceInclTax = 0;
     $basePriceInclTax = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     foreach ($item->getChildren() as $child) {
         $price += $child->getOriginalPrice();
         $basePrice += $child->getBaseOriginalPrice();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $priceInclTax += $child->getPriceInclTax();
         $basePriceInclTax += $child->getBasePriceInclTax();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
     }
     $item->setOriginalPrice($price);
     $item->setPrice($basePrice);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($priceInclTax);
     $item->setBasePriceInclTax($basePriceInclTax);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:36,代码来源:Subtotal.php

示例7: getQuoteItemId

 /**
  * Get quote item id from a passed in sales/quote_item instance. Ensure
  * that if the passed in quote item has child product that it's the child quote
  * item id that get returned.
  *
  * @param  Mage_Sales_Model_Quote_Item_Abstract
  * @return int
  */
 protected function getQuoteItemId(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $children = $item->getChildren() ?: [];
     foreach ($children as $childItem) {
         return $childItem->getId();
     }
     return $item->getId();
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:16,代码来源:Service.php

示例8: getItemProduct

 /**
  * Get the product the item represents.
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract
  * @return Mage_Catalog_Model_Product
  */
 protected function getItemProduct(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     // When dealing with configurable items, need to get tax data from
     // the child product and not the parent.
     if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
         $sku = $item->getSku();
         $children = $item->getChildren();
         if ($children) {
             foreach ($children as $childItem) {
                 $childProduct = $childItem->getProduct();
                 // If the SKU of the child product matches the SKU of the
                 // item, the simple product being ordered was found and should
                 // be used.
                 if ($childProduct->getSku() === $sku) {
                     return $childProduct;
                 }
             }
         }
     }
     return $item->getProduct() ?: Mage::getModel('catalog/product')->load($item->getProductId());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:27,代码来源:Item.php


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