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


PHP Mage_Sales_Model_Quote_Item::getOrder方法代码示例

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


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

示例1: getQuoteItemVendor

 /**
  * Return vendor ID for quote item based on requested qty
  *
  * if $qty===true, always return dropship vendor id
  * if $qty===false, always return local vendor id
  * otherwise return local vendor if enough qty in stock
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param integer|boolean $qty
  * @return integer
  * @deprecated since 1.6.0
  */
 public function getQuoteItemVendor($item, $qty = 0)
 {
     $product = $item->getProduct();
     if (!$product || !$product->hasUdropshipVendor()) {
         // if not available, load full product info to get product vendor
         $product = Mage::getModel('catalog/product')->load($item->getProductId());
     }
     $store = $item->getQuote() ? $item->getQuote()->getStore() : $item->getOrder()->getStore();
     $localVendorId = $this->getLocalVendorId($store);
     $vendorId = $product->getUdropshipVendor();
     // product doesn't have vendor specified OR force local vendor
     if (!$vendorId || $qty === false) {
         return $localVendorId;
     }
     // force real vendor
     if ($qty === true) {
         return $vendorId;
     }
     // local stock is available
     if (Mage::getSingleton('udropship/stock_availability')->getUseLocalStockIfAvailable($store, $vendorId) && $product->getStockItem()->checkQty($qty)) {
         return $localVendorId;
     }
     // all other cases
     return $vendorId;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:37,代码来源:Data.php

示例2: getUpdatedRedemptionData

 /**
  * Retenders the item's redemption rules and final row total and returns it.
  * @param Mage_Sales_Model_Quote_Item $item
  * @return array a map of the new item redemption data: 
  * array('redemptions_data'=>{...}, 'row_total'=>float)
  */
 protected function getUpdatedRedemptionData($item, $do_incl_tax = true)
 {
     // Step 1: Create a map of usability for all applied redemptions
     //echo "$item->getRedeemedPointsHash()";
     $redeemed_points = Mage::helper('rewards')->unhashIt($item->getRedeemedPointsHash());
     // Prepare data from item and initalize counters
     if ($item->getQuote()) {
         $store_currency = round($item->getQuote()->getStoreToQuoteRate(), 4);
     }
     if ($item->getOrder()) {
         $store_currency = round($item->getOrder()->getStoreToQuoteRate(), 4);
     }
     if ($item->hasCustomPrice()) {
         $product_price = (double) $item->getCustomPrice() * $store_currency;
     } else {
         //@nelkaake -a 17/02/11: We need to use our own calculation because the one that was set by the
         // rest of the Magento system is rounded.
         if (Mage::helper('tax')->priceIncludesTax() && $item->getPriceInclTax()) {
             $product_price = $item->getPriceInclTax() / (1 + $item->getTaxPercent() / 100);
         } else {
             $product_price = (double) $item->getPrice() * $store_currency;
         }
     }
     if ($item->getParentItem() || sizeof($redeemed_points) == 0) {
         return array('redemptions_data' => array(), 'row_total_incl_tax' => $item->getRowTotalInclTax(), 'row_total' => $item->getRowTotal());
     }
     $total_qty = $item->getQty();
     $total_qty_redeemed = 0.0;
     $row_total = 0.0;
     $new_redeemed_points = array();
     $ret = array();
     // Loop through and apply all our rules.
     foreach ($redeemed_points as $key => &$redemption_instance) {
         $redemption_instance = (array) $redemption_instance;
         $applic_qty = $redemption_instance[self::POINTS_APPLICABLE_QTY];
         $rule_id = $redemption_instance[self::POINTS_RULE_ID];
         $effect = $redemption_instance[self::POINTS_EFFECT];
         $uses = isset($redemption_instance[self::POINTS_USES]) ? (int) $redemption_instance[self::POINTS_USES] : 1;
         $rule = Mage::helper('rewards/rule')->getCatalogRule($rule_id);
         // If a rule was turned off at some point in the back-end it should be removed and not calculated in the cart anymore.
         if (!$rule->getIsActive()) {
             $this->removeCatalogRedemptionsFromItem($item, array($rule_id));
             $effect = "";
         }
         $total_qty_remain = $total_qty - $total_qty_redeemed;
         if ($total_qty_remain > 0) {
             if ($total_qty_remain < $applic_qty) {
                 $applic_qty = $total_qty_remain;
                 $redemption_instance[TBT_Rewards_Model_Redeem::POINTS_APPLICABLE_QTY] = $applic_qty;
             }
             $price_after_redem = $this->getPriceAfterEffect($product_price, $effect, $item);
             $row_total += $applic_qty * (double) $price_after_redem;
             $total_qty_redeemed += $applic_qty;
             $new_redeemed_points[] = $redemption_instance;
         } else {
             $redemption_instance[TBT_Rewards_Model_Catalogrule_Rule::POINTS_APPLICABLE_QTY] = 0;
             $redemption_instance[TBT_Rewards_Model_Catalogrule_Rule::POINTS_USES] = 1;
             // used once by default
             unset($redeemed_points[$key]);
         }
     }
     $ret['redemptions_data'] = $new_redeemed_points;
     // Add in the left over products that perhaps weren't affected by qty adjustment.
     $total_qty_remain = $total_qty - $total_qty_redeemed;
     if ($total_qty_remain < 0) {
         $total_qty_remain = 0;
         $total_qty_redeemed = $total_qty;
         //throw new Exception("Redemption rules may be overlapping.  Please notify the store administrator of this error.");
     }
     $row_total += $total_qty_remain * (double) $product_price;
     $ret['row_total'] = $row_total;
     $ret['row_total_incl_tax'] = $row_total * (1 + $item->getTaxPercent() / 100);
     return $ret;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:80,代码来源:Redeem.php


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