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


PHP Mage_Sales_Model_Order_Item::getPrice方法代码示例

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


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

示例1: crateFromOrderItem

 public static function crateFromOrderItem(Mage_Sales_Model_Order_Item $orderItem)
 {
     $productId = $orderItem->getProductId();
     /** @var Mage_Catalog_Model_Product $product */
     $product = Mage::getModel('catalog/product')->load($productId);
     $discounts = $product->getPrice() - $product->getFinalPrice();
     $aArticle = new self();
     $aArticle->id = $productId;
     $aArticle->name = $orderItem->getName();
     $aArticle->url = $product->getProductUrl();
     $aArticle->image_url = $product->getImageUrl();
     $aArticle->quantity = intval($orderItem->getQtyOrdered());
     $aArticle->price = Aplazame_Sdk_Serializer_Decimal::fromFloat($orderItem->getPrice() + $discounts);
     $aArticle->description = substr($product->getDescription(), 0, 255);
     $aArticle->tax_rate = Aplazame_Sdk_Serializer_Decimal::fromFloat(self::getProductTaxRate($product));
     $aArticle->discount = Aplazame_Sdk_Serializer_Decimal::fromFloat($discounts);
     return $aArticle;
 }
开发者ID:aplazame,项目名称:magento,代码行数:18,代码来源:Article.php

示例2: addWeeeTaxesToPriceXmlApi23

 /**
  * Add Weee taxes child to the XML. Api version 23
  *
  * @param Mage_Core_Block_Template $renderer Product renderer
  * @param Mage_Sales_Model_Order_Item $item
  * @param Mage_XmlConnect_Model_Simplexml_Element $parentXml
  * @param array $params Params for Weee taxes: 'include' - Price including tax, 'is_subtotal' - Flag of subtotal
  * @param string $idPrefix
  * @param bool $isIncludeTax
  * @return null
  */
 public function addWeeeTaxesToPriceXmlApi23(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item, Mage_XmlConnect_Model_Simplexml_Element $parentXml, $params = array(), $idPrefix, $isIncludeTax)
 {
     $weeTaxes = $renderer->getWeeeTaxes();
     if (empty($weeTaxes)) {
         return;
     }
     $typesOfDisplay = $renderer->getTypesOfDisplay();
     $row = isset($params['is_subtotal']) && $params['is_subtotal'] ? 'row_' : '';
     if ($isIncludeTax) {
         $weeeXml = $parentXml->addCustomChild('price', null, array('id' => 'weee'));
         /** @var $weeeXml Mage_XmlConnect_Model_Simplexml_Element */
         if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_1]) {
             foreach ($weeTaxes as $tax) {
                 $taxAmount = Mage::helper('xmlconnect')->formatPriceForXml($tax[$row . 'amount']);
                 $weeeXml->addCustomChild('item', $taxAmount, array('label' => $tax['title'], 'formatted_price' => $this->formatPrice($renderer, $tax[$row . 'amount'])));
             }
         } elseif ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_2] || $typesOfDisplay[self::PRICE_DISPLAY_TYPE_4]) {
             foreach ($weeTaxes as $tax) {
                 $taxAmount = Mage::helper('xmlconnect')->formatPriceForXml($tax[$row . 'amount_incl_tax']);
                 $weeeXml->addCustomChild('item', $taxAmount, array('label' => $tax['title'], 'formatted_price' => $this->formatPrice($renderer, $tax[$row . 'amount_incl_tax'])));
             }
         }
     }
     if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_2]) {
         if (!empty($params['include'])) {
             // including tax
             if (isset($params['is_subtotal'])) {
                 $total = $params['include'] + $item->getWeeeTaxAppliedRowAmount();
             } else {
                 $total = $params['include'] + $renderer->getWeeeTaxAppliedAmount();
             }
         } else {
             // excluding tax
             if (isset($params['is_subtotal'])) {
                 $total = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount() + $item->getWeeeTaxRowDisposition();
             } else {
                 $total = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount() + $renderer->getWeeeTaxDisposition();
             }
         }
         $totalNodeId = $idPrefix . 'fpt_total_' . ($isIncludeTax ? self::INCLUDING_TAX_ID : self::EXCLUDING_TAX_ID);
         $parentXml->addCustomChild('price', Mage::helper('xmlconnect')->formatPriceForXml($total), array('id' => $totalNodeId, 'label' => $isIncludeTax ? $renderer->helper('weee')->__('Total incl. tax') : $renderer->helper('weee')->__('Total excl. tax'), 'formatted_price' => $this->formatPrice($renderer, $total)));
     }
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:54,代码来源:Order.php

示例3: addWeeeTaxesToPriceXml

 /**
  * Add Weee taxes child to the XML
  *
  * @param Mage_Core_Block_Template $renderer Product renderer
  * @param Mage_Sales_Model_Order_Item $item
  * @param Mage_XmlConnect_Model_Simplexml_Element $parentXml
  * @param array $params Params for Weee taxes: 'include' - Price including tax, 'is_subtotal' - Flag of subtotal
  * @return null
  */
 public function addWeeeTaxesToPriceXml(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item, Mage_XmlConnect_Model_Simplexml_Element $parentXml, $params = array())
 {
     $weeTaxes = $renderer->getWeeeTaxes();
     if (empty($weeTaxes)) {
         return;
     }
     $typesOfDisplay = $renderer->getTypesOfDisplay();
     $row = isset($params['is_subtotal']) && $params['is_subtotal'] ? 'row_' : '';
     /** @var $weeeXml Mage_XmlConnect_Model_Simplexml_Element */
     if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_1]) {
         $weeeXml = $parentXml->addChild('weee');
         foreach ($weeTaxes as $tax) {
             $weeeXml->addCustomChild('tax', $this->formatPrice($renderer, $tax[$row . 'amount']), array('label' => $tax['title']));
         }
     } elseif ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_2] || $typesOfDisplay[self::PRICE_DISPLAY_TYPE_4]) {
         $weeeXml = $parentXml->addChild('weee');
         foreach ($weeTaxes as $tax) {
             $weeeXml->addCustomChild('tax', $this->formatPrice($renderer, $tax[$row . 'amount_incl_tax']), array('label' => $tax['title']));
         }
     }
     if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_2]) {
         if (!is_null($params['include'])) {
             // including tax
             if (isset($params['is_subtotal'])) {
                 $total = $params['include'] + $item->getWeeeTaxAppliedRowAmount();
             } else {
                 $total = $params['include'] + $renderer->getWeeeTaxAppliedAmount();
             }
         } else {
             // excluding tax
             if ($params['is_subtotal']) {
                 $total = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount() + $item->getWeeeTaxRowDisposition();
             } else {
                 $total = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount() + $renderer->getWeeeTaxDisposition();
             }
         }
         if (!isset($weeeXml)) {
             $weeeXml = $parentXml->addChild('weee');
         }
         $weeeXml->addCustomChild('total', $this->formatPrice($renderer, $total), array('label' => $renderer->helper('weee')->__('Total')));
     }
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:51,代码来源:Order.php

示例4: _writeOrderItem

 protected function _writeOrderItem(Mage_Sales_Model_Order_Item $item, XMLWriter $xml, $storeId = null)
 {
     // inherit some attributes from parent order item
     if ($item->getParentItemId() && !$item->getParentItem()) {
         $item->setParentItem(Mage::getModel('sales/order_item')->load($item->getParentItemId()));
     }
     // only inherit if parent has been hidden
     if ($item->getParentItem() && $item->getPrice() == 0.0 && Mage::helper('auctaneapi')->isExcludedProductType($item->getParentItem()->getProductType())) {
         $item->setPrice($item->getParentItem()->getPrice());
     }
     /* @var $gift Mage_GiftMessage_Model_Message */
     $gift = Mage::helper('giftmessage/message')->getGiftMessage(!$item->getGiftMessageId() && $item->getParentItem() ? $item->getParentItem()->getGiftMessageId() : $item->getGiftMessageId());
     $item->setGift($gift->isObjectNew() ? 'false' : 'true');
     if (!$gift->isObjectNew()) {
         $item->setGiftMessage(sprintf("From: %s\nTo: %s\nMessage: %s", $gift->getSender(), $gift->getRecipient(), $gift->getMessage()));
     }
     /* @var $product Mage_Catalog_Model_Product */
     $product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($item->getProductId());
     // inherit some attributes from parent product item
     if ($parentProduct = $this->_getOrderItemParentProduct($item, $storeId)) {
         if (!$product->getImage() || $product->getImage() == 'no_selection') {
             $product->setImage($parentProduct->getImage());
         }
         if (!$product->getSmallImage() || $product->getSmallImage() == 'no_selection') {
             $product->setSmallImage($parentProduct->getSmallImage());
         }
         if (!$product->getThumbnail() || $product->getThumbnail() == 'no_selection') {
             $product->setThumbnail($parentProduct->getThumbnail());
         }
     }
     $xml->startElement('Item');
     $helper = Mage::helper('auctaneapi');
     if (Mage::helper('auctaneapi')->getExportPriceType($item->getOrder()->getStoreId()) == Auctane_Api_Model_System_Source_Config_Prices::BASE_PRICE) {
         $helper->fieldsetToXml('base_sales_order_item', $item, $xml);
     } else {
         $helper->fieldsetToXml('sales_order_item', $item, $xml);
     }
     /* using emulation so that product images come from the correct store */
     $appEmulation = Mage::getSingleton('core/app_emulation');
     $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($product->getStoreId());
     Mage::helper('auctaneapi')->fieldsetToXml('sales_order_item_product', $product, $xml);
     $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     $xml->startElement('Options');
     $this->_writeOrderProductAttribute($product, $xml, $storeId);
     // items may have several custom options chosen by customer
     foreach ((array) $item->getProductOptionByCode('options') as $option) {
         $this->_writeOrderItemOption($option, $xml, $storeId);
     }
     $buyRequest = $item->getProductOptionByCode('info_buyRequest');
     if ($buyRequest && @$buyRequest['super_attribute']) {
         // super_attribute is non-null and non-empty, there must be a Configurable involved
         $parentItem = $this->_getOrderItemParent($item);
         /* export configurable custom options as they are stored in parent */
         foreach ((array) $parentItem->getProductOptionByCode('options') as $option) {
             $this->_writeOrderItemOption($option, $xml, $storeId);
         }
         foreach ((array) $parentItem->getProductOptionByCode('attributes_info') as $option) {
             $this->_writeOrderItemOption($option, $xml, $storeId);
         }
     }
     $xml->endElement();
     // Options
     $xml->endElement();
     // Item
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:65,代码来源:Export.php

示例5: initFromOrderItem

 /**
  * Initialize creation data from existing order Item
  *
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @param int $qty
  * @return Mage_Sales_Model_Quote_Item | string
  */
 public function initFromOrderItem(Mage_Sales_Model_Order_Item $orderItem, $qty = null)
 {
     if (!$orderItem->getId()) {
         return $this;
     }
     $product = Mage::getModel('catalog/product')->setStoreId($this->getSession()->getStoreId())->load($orderItem->getProductId());
     if ($product->getId()) {
         $product->setSkipCheckRequiredOption(true);
         $buyRequest = $orderItem->getBuyRequest();
         if (is_numeric($qty)) {
             $buyRequest->setQty($qty);
         }
         $item = $this->getQuote()->addProduct($product, $buyRequest);
         if (is_string($item)) {
             return $item;
         }
         if ($additionalOptions = $orderItem->getProductOptionByCode('additional_options')) {
             $item->addOption(new Varien_Object(array('product' => $item->getProduct(), 'code' => 'additional_options', 'value' => serialize($additionalOptions))));
         }
         if ($product->getPrice() != $orderItem->getPrice()) {
             $item->setCustomPrice($orderItem->getPrice());
             $item->setOriginalCustomPrice($orderItem->getPrice());
         }
         Mage::dispatchEvent('buyback_convert_order_item_to_quote_item', array('order_item' => $orderItem, 'quote_item' => $item));
         return $item;
     }
     return $this;
 }
开发者ID:pcuervo,项目名称:gadfy,代码行数:35,代码来源:Create.php

示例6: itemToQuoteItem

 /**
  * Retrieve
  *
  * @param Mage_Sales_Model_Order_Item $item
  * @return unknown
  */
 public function itemToQuoteItem(Mage_Sales_Model_Order_Item $item)
 {
     $quoteItem = Mage::getModel('sales/quote_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setSuperProductId($item->getSuperProductId())->setParentProductId($item->getParentProductId())->setSku($item->getSku())->setName($item->getName())->setDescription($item->getDescription())->setWeight($item->getWeight())->setCustomPrice($item->getPrice())->setDiscountPercent($item->getDiscountPercent())->setDiscountAmount($item->getDiscountAmount())->setTaxPercent($item->getTaxPercent())->setTaxAmount($item->getTaxAmount())->setRowWeight($item->getRowWeight())->setRowTotal($item->getRowTotal())->setAppliedRuleIds($item->getAppliedRuleIds())->setBaseDiscountAmount($item->getBaseDiscountAmount())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotal($item->getBaseRowTotal());
     return $quoteItem;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:11,代码来源:Order.php

示例7: prepareMerchandisePricing

 /**
  * fillout the merchandise price group payload for the order item
  * @param  Mage_Sales_Model_Order_Item
  * @param  IPriceGroup
  * @return self
  */
 protected function prepareMerchandisePricing(Mage_Sales_Model_Order_Item $item, IPriceGroup $merch)
 {
     $merch->setAmount($item->getRowTotal())->setUnitPrice($item->getPrice());
     $this->discountHelper->transferDiscounts($item, $merch);
     return $this;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:12,代码来源:Orderitem.php

示例8: initFromOrderItem

 /**
  * Initialize creation data from existing order Item
  *
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @param int $qty
  * @return Mage_Sales_Model_Quote_Item | string
  */
 public function initFromOrderItem(Mage_Sales_Model_Order_Item $orderItem, $qty = null)
 {
     if (!$orderItem->getId()) {
         return $this;
     }
     $product = Mage::getModel('catalog/product')->setStoreId($this->getSession()->getStoreId())->load($orderItem->getProductId());
     if ($product->getId()) {
         $product->setSkipCheckRequiredOption(true);
         $buyRequest = $orderItem->getBuyRequest();
         if (is_numeric($qty)) {
             $buyRequest->setQty($qty);
         }
         $item = $this->getQuote()->addProduct($product, $buyRequest);
         if (is_string($item)) {
             return $item;
         }
         /*********************************************Set custom price selected starts************************************************************/
         if (!$this->getSession()->getReordered() && $orderItem->getOriginalPrice() != $orderItem->getPrice()) {
             if ($orderItem->getProductType() == 'configurable' || $orderItem->getProductType() == 'bundle') {
                 $productId = $orderItem->getProductId();
                 $quoteItemId = $orderItem->getQuoteItemId();
                 $items = $this->getQuote()->getItemsCollection();
                 foreach ($items as $item) {
                     if ($item->getProduct()->getId() == $productId && !$item->getApplyPriceFlag()) {
                         if ($orderItem->getOriginalPrice() != $orderItem->getPrice()) {
                             $item->setCustomPrice($orderItem->getPrice())->setOriginalCustomPrice($orderItem->getPrice());
                         }
                         //$item->setApplyPriceFlag(true);
                     }
                 }
             } else {
                 $item->setCustomPrice($orderItem->getPrice())->setOriginalCustomPrice($orderItem->getPrice());
             }
         }
         /*********************************************Set custom price selected ends************************************************************/
         if ($additionalOptions = $orderItem->getProductOptionByCode('additional_options')) {
             $item->addOption(new Varien_Object(array('product' => $item->getProduct(), 'code' => 'additional_options', 'value' => serialize($additionalOptions))));
         }
         Mage::dispatchEvent('sales_convert_order_item_to_quote_item', array('order_item' => $orderItem, 'quote_item' => $item));
         return $item;
     }
     return $this;
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:50,代码来源:Create.php

示例9: _correctPrices

 /**
  * Set correct item prices ((original price / new qty) * old qty)
  *
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @param int $oldQty
  * @param int $newQty
  * @return Mage_Sales_Model_Order_Item
  */
 protected function _correctPrices($orderItem, $oldQty, $newQty)
 {
     $orderItem->setPrice($orderItem->getPrice() / $newQty * $oldQty);
     $orderItem->setBasePrice($orderItem->getBasePrice() / $newQty * $oldQty);
     $orderItem->setOriginalPrice($orderItem->getOriginalPrice() / $newQty * $oldQty);
     $orderItem->setBaseOriginalPrice($orderItem->getBaseOriginalPrice() / $newQty * $oldQty);
     $orderItem->setPriceInclTax($orderItem->getPriceInclTax() / $newQty * $oldQty);
     $orderItem->setBasePriceInclTax($orderItem->getBasePriceInclTax() / $newQty * $oldQty);
     return $orderItem;
 }
开发者ID:sandermangel,项目名称:adyen-magento-subscription,代码行数:18,代码来源:Observer.php

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