本文整理汇总了PHP中Mage_Sales_Model_Order_Item::getOriginalPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Item::getOriginalPrice方法的具体用法?PHP Mage_Sales_Model_Order_Item::getOriginalPrice怎么用?PHP Mage_Sales_Model_Order_Item::getOriginalPrice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Item::getOriginalPrice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _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;
}