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


PHP Mage_Sales_Model_Quote_Item::getCustomPrice方法代码示例

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


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

示例1: getItemProductPrice

 /**
  * Fetches the item price that should be used for calculating max catalog points spending
  * for the given item.  Uses the following check hierarchy:
  * CustomPrice
  * > if not set use item price
  * > if not set use product final price
  * > if not set use 
  * 
  * @param Mage_Sales_Model_Quote_Item $item
  */
 public function getItemProductPrice($item)
 {
     // Prepare data from item and initalize counters
     $store_currency = (double) $this->getCurrencyRate($item->getQuote());
     if ($item->hasCustomPrice()) {
         $product_price = (double) $item->getCustomPrice() * $store_currency;
     } elseif (Mage::helper('tax')->priceIncludesTax() && ($item->getRowTotalBeforeRedemptions() && $item->getRowTotal())) {
         $rt = (double) $item->getRowTotal();
         $item->setRowTotal($item->getRowTotalBeforeRedemptions());
         $product_price = (double) Mage::helper('checkout')->getPriceInclTax($item);
         $item->setRowTotal($rt);
     } else {
         // item doesn't have a price, use the item product final price
         $item_price = (double) $item->getPrice();
         $item_price = !empty($item_price) ? $item->getPrice() : $item->getProduct()->getFinalPrice();
         $product_price = (double) $item_price * $store_currency;
     }
     return $product_price;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:29,代码来源:Price.php

示例2: getOriginalEditablePrice

 /**
  * Returns the item's original editable price
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @return float
  */
 public function getOriginalEditablePrice($item)
 {
     if ($item->hasOriginalCustomPrice()) {
         $result = $item->getOriginalCustomPrice() * 1;
     } elseif ($item->hasCustomPrice()) {
         $result = $item->getCustomPrice() * 1;
     } else {
         if (Mage::helper('tax')->priceIncludesTax($this->getStore())) {
             $result = $item->getPriceInclTax() * 1;
         } else {
             $result = $item->getOriginalPrice() * 1;
         }
     }
     return $result;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:21,代码来源:Grid.php

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