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


PHP Mage_Sales_Model_Order_Item::getParentItemId方法代码示例

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


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

示例1: _calculateRefundedQty

 /**
  * Calculate refund qty
  * 
  * @param Varien_Object $dataObject
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @return array [not_ship, shipped, total, had_refunded]
  */
 protected function _calculateRefundedQty($dataObject, $orderItem)
 {
     $creditMemo = $dataObject->getCreditmemoObject();
     $order = $dataObject->getOrder();
     $parentItemId = $orderItem->getParentItemId();
     $refundItem = $creditMemo->getItemByOrderId($orderItem->getId());
     $parentItem = $parentItemId ? $creditMemo->getItemByOrderId($parentItemId) : false;
     if (is_bool($refundItem)) {
         $refundQty = $parentItem ? $parentItem->getQty() : 0;
     } else {
         $refundQty = $parentItem ? $parentItem->getQty() * $refundItem->getQty() : $refundItem->getQty();
     }
     $oldCreditmemos = $order->getCreditmemosCollection();
     /* total refuned qty before created this creditmemo */
     $hadRefundedQty = 0;
     if (count($oldCreditmemos)) {
         foreach ($oldCreditmemos as $oldCreditmemo) {
             if ($oldCreditmemo->getId() == $creditMemo->getId()) {
                 continue;
             }
             $item = $oldCreditmemo->getItemByOrderId($orderItem->getId());
             if ($item) {
                 $parentItem = $orderItem->getParentItemId() ? $oldCreditmemo->getItemByOrderId($orderItem->getParentItemId()) : false;
                 $hadRefundedQty += $parentItem ? $parentItem->getQty() * $item->getQty() : $item->getQty();
             }
         }
     }
     /* calculate shipped qty */
     $shippedQty = $orderItem->getQtyShipped();
     if ($orderItem->getParentItemId()) {
         $parentOrderItem = $order->getItemById($orderItem->getParentItemId());
         if ($parentOrderItem && $parentOrderItem->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
             $shippedQty = $parentOrderItem->getQtyShipped();
         }
     }
     /* calculate canceled qty */
     $canceledQty = $orderItem->getQtyCanceled();
     if ($orderItem->getParentItemId()) {
         $parentOrderItem = $order->getItemById($orderItem->getParentItemId());
         if ($parentOrderItem && $parentOrderItem->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
             $canceledQty = $parentOrderItem->getQtyCanceled();
         }
     }
     /* total qty which we need to ship before created this credit memo */
     $needToShipQty = $orderItem->getQtyOrdered() - $shippedQty - $hadRefundedQty - $canceledQty;
     $needToShipQty = $needToShipQty >= 0 ? $needToShipQty : 0;
     /* separate refund qty to qty of not_ship items & qty of shipped items */
     $refundQtys = array('not_ship' => min($refundQty, $needToShipQty), 'shipped' => $refundQty - min($refundQty, $needToShipQty), 'total' => $refundQty, 'had_refunded' => $hadRefundedQty);
     return $refundQtys;
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:57,代码来源:Refund.php

示例2: sync

 /**
  * Sync the given order item to Klevu. Returns true on successful sync and
  * the error message otherwise.
  *
  * @param Mage_Sales_Model_Order_Item $item
  *
  * @return bool|string
  */
 protected function sync($item)
 {
     if (!$this->getApiKey($item->getStoreId())) {
         return "Klevu Search is not configured for this store.";
     }
     $parent = null;
     if ($item->getParentItemId()) {
         $parent = Mage::getModel("sales/order_item")->load($item->getParentItemId());
     }
     $response = Mage::getModel("klevu_search/api_action_producttracking")->execute(array("klevu_apiKey" => $this->getApiKey($item->getStoreId()), "klevu_type" => "checkout", "klevu_productId" => Mage::helper("klevu_search")->getKlevuProductId($item->getProductId(), $parent ? $parent->getProductId() : 0), "klevu_unit" => $item->getQtyOrdered() ? $item->getQtyOrdered() : ($parent ? $parent->getQtyOrdered() : null), "klevu_salePrice" => $item->getPriceInclTax() ? $item->getPriceInclTax() : ($parent ? $parent->getPriceInclTax() : null), "klevu_currency" => $this->getStoreCurrency($item->getStoreId()), "klevu_shopperIP" => $this->getOrderIP($item->getOrderId())));
     if ($response->isSuccessful()) {
         return true;
     } else {
         return $response->getMessage();
     }
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:24,代码来源:Sync.php

示例3: getQtyOrderedFromOrderItem

 /**
  * Get ordered qty from order item
  * 
  * @param \Mage_Sales_Model_Order_Item $orderItem
  * @return int|float
  */
 public function getQtyOrderedFromOrderItem($orderItem)
 {
     $qtyOrdered = 0;
     if ($orderItem->getParentItemId()) {
         $parentOrderItem = Mage::getModel('sales/order_item')->load($orderItem->getParentItemId());
         if ($parentOrderItem && $parentOrderItem->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
             $qtyOrdered = $parentOrderItem->getQtyOrdered();
         }
     }
     $qtyOrdered = $qtyOrdered ? $qtyOrdered : $orderItem->getQtyOrdered();
     return $qtyOrdered;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:18,代码来源:Data.php

示例4: _getOrderItemParentProduct

 /**
  * @param Mage_Sales_Model_Order_Item $item
  * @param mixed $storeId
  * @return Mage_Catalog_Model_Product
  */
 protected function _getOrderItemParentProduct(Mage_Sales_Model_Order_Item $item, $storeId = null)
 {
     if ($item->getParentItemId()) {
         // cannot use getParentItem() because we stripped parents from the order
         $parentItem = $this->_getOrderItemParent($item);
         // initialise with store so that images are correct
         return Mage::getModel('catalog/product')->setStoreId($storeId)->load($parentItem->getProductId());
     }
     return null;
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:15,代码来源:Export.php

示例5: getFrontendProductPrice

 /**
  * @param Mage_Sales_Model_Order_Item $orderItem
  *
  * @return string
  */
 public function getFrontendProductPrice(Mage_Sales_Model_Order_Item $orderItem)
 {
     $itemPrice = $orderItem->getPrice();
     if ($orderItem->getParentItemId()) {
         $parentItem = Mage::getModel('sales/order_item')->load($orderItem->getParentItemId());
         if ($parentItem->getProductType() != 'bundle') {
             $itemPrice = $parentItem->getPrice();
         }
     }
     return $orderItem->getOrder()->getOrderCurrency()->format($itemPrice);
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:16,代码来源:CustomerOrders.php


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