本文整理汇总了PHP中Mage_Core_Block_Template::helper方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Template::helper方法的具体用法?PHP Mage_Core_Block_Template::helper怎么用?PHP Mage_Core_Block_Template::helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Template
的用法示例。
在下文中一共展示了Mage_Core_Block_Template::helper方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPriceAndSubtotalToXml
/**
* 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 $priceXml
* @param Mage_XmlConnect_Model_Simplexml_Element $subtotalXml
* @param bool $isIncludeTax
* @return null
*/
public function addPriceAndSubtotalToXml(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item, Mage_XmlConnect_Model_Simplexml_Element $priceXml, Mage_XmlConnect_Model_Simplexml_Element $subtotalXml, $isIncludeTax = false)
{
$weeeParams = array();
$typesOfDisplay = $renderer->getTypesOfDisplay();
if ($isIncludeTax) {
$nodeName = 'including_tax';
$nodeLabel = $renderer->__('Incl. Tax');
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
$price = $inclPrice + $renderer->getWeeeTaxAppliedAmount();
$subtotal = $inclSubtotal + $item->getWeeeTaxAppliedRowAmount();
} else {
$price = $inclPrice - $renderer->getWeeeTaxDisposition();
$subtotal = $inclSubtotal - $item->getWeeeTaxRowDisposition();
}
$weeeParams['include'] = $inclPrice;
} else {
$nodeName = 'excluding_tax';
$nodeLabel = $renderer->__('Excl. Tax');
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount() + $renderer->getWeeeTaxDisposition();
$subtotal = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount() + $item->getWeeeTaxRowDisposition();
} else {
$price = $item->getPrice();
$subtotal = $item->getRowTotal();
}
}
$configNode = array('value' => $this->formatPrice($renderer, $price));
if ($renderer->helper('tax')->displaySalesBothPrices()) {
$configNode['label'] = $nodeLabel;
}
$this->addWeeeTaxesToPriceXml($renderer, $item, $priceXml->addCustomChild($nodeName, null, $configNode), $weeeParams);
$configNode['value'] = $this->formatPrice($renderer, $subtotal);
$weeeParams['include'] = $isIncludeTax ? $inclSubtotal : null;
$weeeParams['is_subtotal'] = true;
$this->addWeeeTaxesToPriceXml($renderer, $item, $subtotalXml->addCustomChild($nodeName, null, $configNode), $weeeParams);
}
示例2: addPriceAndSubtotalToXmlApi23
/**
* 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 $priceXml
* @param Mage_XmlConnect_Model_Simplexml_Element $subtotalXml
* @param bool $isIncludeTax
* @return null
*/
public function addPriceAndSubtotalToXmlApi23(Mage_Core_Block_Template $renderer, Mage_Sales_Model_Order_Item $item, Mage_XmlConnect_Model_Simplexml_Element $priceXml, Mage_XmlConnect_Model_Simplexml_Element $subtotalXml, $isIncludeTax = false)
{
$weeeParams = array();
$typesOfDisplay = $renderer->getTypesOfDisplay();
if ($isIncludeTax) {
$nodeId = self::INCLUDING_TAX_ID;
$nodeLabel = $this->__('Incl. Tax');
$inclPrice = $renderer->helper('checkout')->getPriceInclTax($item);
$inclSubtotal = $renderer->helper('checkout')->getSubtotalInclTax($item);
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
$price = $inclPrice + $renderer->getWeeeTaxAppliedAmount();
$subtotal = $inclSubtotal + $item->getWeeeTaxAppliedRowAmount();
} else {
$price = $inclPrice - $renderer->getWeeeTaxDisposition();
$subtotal = $inclSubtotal - $item->getWeeeTaxRowDisposition();
}
$weeeParams['include'] = $inclPrice;
} else {
$nodeId = self::EXCLUDING_TAX_ID;
$nodeLabel = $this->__('Excl. Tax');
if ($typesOfDisplay[self::PRICE_DISPLAY_TYPE_14]) {
$price = $item->getPrice() + $renderer->getWeeeTaxAppliedAmount() + $renderer->getWeeeTaxDisposition();
$subtotal = $item->getRowTotal() + $item->getWeeeTaxAppliedRowAmount() + $item->getWeeeTaxRowDisposition();
} else {
$price = $item->getPrice();
$subtotal = $item->getRowTotal();
}
}
$configNode = array('id' => $nodeId);
$priceValue = $this->formatPrice($renderer, $price);
if ($renderer->helper('tax')->displaySalesBothPrices()) {
$configNode['label'] = $nodeLabel;
}
$priceConfig = $configNode;
$idPrefix = 'price_';
$priceConfig['id'] = $idPrefix . $priceConfig['id'];
$priceConfig['formatted_price'] = $priceValue;
$price = Mage::helper('xmlconnect')->formatPriceForXml($price);
$priceXml->addCustomChild('price', $price, $priceConfig);
$this->addWeeeTaxesToPriceXmlApi23($renderer, $item, $priceXml, $weeeParams, $idPrefix, $isIncludeTax);
$priceValue = $this->formatPrice($renderer, $subtotal);
$weeeParams['include'] = $isIncludeTax ? $inclSubtotal : null;
$weeeParams['is_subtotal'] = true;
$subtotalConfig = $configNode;
$idPrefix = 'subtotal_';
$subtotalConfig['id'] = $idPrefix . $subtotalConfig['id'];
$subtotalConfig['formatted_price'] = $priceValue;
$subtotal = Mage::helper('xmlconnect')->formatPriceForXml($subtotal);
$subtotalXml->addCustomChild('price', $subtotal, $subtotalConfig);
$this->addWeeeTaxesToPriceXmlApi23($renderer, $item, $subtotalXml, $weeeParams, $idPrefix, $isIncludeTax);
}