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