本文整理汇总了PHP中Mage_Sales_Model_Quote_Item_Abstract::setConvertedPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item_Abstract::setConvertedPrice方法的具体用法?PHP Mage_Sales_Model_Quote_Item_Abstract::setConvertedPrice怎么用?PHP Mage_Sales_Model_Quote_Item_Abstract::setConvertedPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item_Abstract
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item_Abstract::setConvertedPrice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _recalculateParent
/**
* Recalculate row information for item based on children calculation
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
*/
protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$price = 0;
$basePrice = 0;
$rowTotal = 0;
$baseRowTotal = 0;
$priceInclTax = 0;
$basePriceInclTax = 0;
$rowTotalInclTax = 0;
$baseRowTotalInclTax = 0;
foreach ($item->getChildren() as $child) {
$price += $child->getPrice() * $child->getQty();
$basePrice += $child->getBasePrice() * $child->getQty();
$rowTotal += $child->getRowTotal();
$baseRowTotal += $child->getBaseRowTotal();
$priceInclTax += $child->getPriceInclTax() * $child->getQty();
$basePriceInclTax += $child->getBasePriceInclTax() * $child->getQty();
$rowTotalInclTax += $child->getRowTotalInclTax();
$baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
}
/**
*
* Customisation To make the custom price work with configurable items
*
**/
if ($item->getCustomPrice()) {
$customPrice = $item->getCustomPrice();
$price = $customPrice;
$basePrice = $customPrice;
$rowTotal = $customPrice * $item->getQty();
$baseRowTotal = $customPrice * $item->getQty();
$priceInclTax = $customPrice;
$basePriceInclTax = $customPrice;
$rowTotalInclTax = $customPrice * $item->getQty();
$baseRowTotalInclTax = $customPrice * $item->getQty();
}
$item->setConvertedPrice($price);
$item->setPrice($basePrice);
$item->setRowTotal($rowTotal);
$item->setBaseRowTotal($baseRowTotal);
$item->setPriceInclTax($priceInclTax);
$item->setBasePriceInclTax($basePriceInclTax);
$item->setRowTotalInclTax($rowTotalInclTax);
$item->setBaseRowTotalInclTax($baseRowTotalInclTax);
return $this;
}
示例2: _recalculateParent
/**
* Recalculate row information for item based on children calculation
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
*
* @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
*/
protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$rowTotal = 0;
$baseRowTotal = 0;
$rowTotalInclTax = 0;
$baseRowTotalInclTax = 0;
$rowTax = 0;
$baseRowTax = 0;
$store = $item->getStore();
$qty = $item->getQty();
foreach ($item->getChildren() as $child) {
$rowTotal += $child->getRowTotal();
$baseRowTotal += $child->getBaseRowTotal();
$rowTotalInclTax += $child->getRowTotalInclTax();
$baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
$rowTax += $child->getRowTax();
$baseRowTax += $child->getBaseRowTax();
}
$item->setConvertedPrice($store->roundPrice($rowTotal) / $qty);
$item->setPrice($store->roundPrice($baseRowTotal) / $qty);
$item->setRowTotal($rowTotal);
$item->setBaseRowTotal($baseRowTotal);
$item->setPriceInclTax($store->roundPrice($rowTotalInclTax) / $qty);
$item->setBasePriceInclTax($store->roundPrice($baseRowTotalInclTax) / $qty);
$item->setRowTotalInclTax($rowTotalInclTax);
$item->setBaseRowTotalInclTax($baseRowTotalInclTax);
$item->setRowTax($rowTax);
$item->setBaseRowTax($baseRowTax);
return $this;
}
示例3: _recalculateParent
/**
* Recalculate row information for item based on children calculation
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
*/
protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$price = 0;
$basePrice = 0;
$rowTotal = 0;
$baseRowTotal = 0;
$priceInclTax = 0;
$basePriceInclTax = 0;
$rowTotalInclTax = 0;
$baseRowTotalInclTax = 0;
foreach ($item->getChildren() as $child) {
$price += $child->getOriginalPrice() * $child->getQty();
$basePrice += $child->getBaseOriginalPrice() * $child->getQty();
$rowTotal += $child->getRowTotal();
$baseRowTotal += $child->getBaseRowTotal();
$priceInclTax += $child->getPriceInclTax();
$basePriceInclTax += $child->getBasePriceInclTax();
$rowTotalInclTax += $child->getRowTotalInclTax();
$baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
}
$item->setConvertedPrice($price);
$item->setPrice($basePrice);
$item->setRowTotal($rowTotal);
$item->setBaseRowTotal($baseRowTotal);
$item->setPriceInclTax($priceInclTax);
$item->setBasePriceInclTax($basePriceInclTax);
$item->setRowTotalInclTax($rowTotalInclTax);
$item->setBaseRowTotalInclTax($baseRowTotalInclTax);
return $this;
}