Ajax调用Magento中的addPriceBlockType
我使用FireGento的一些插件覆盖price.html,以在我的magento价格(特定于德语)下显示其他信息,如税收和交货时间 在某些layout.xml中,插件定义了新price.html的输出位置 例如:Ajax调用Magento中的addPriceBlockType,ajax,magento,Ajax,Magento,我使用FireGento的一些插件覆盖price.html,以在我的magento价格(特定于德语)下显示其他信息,如税收和交货时间 在某些layout.xml中,插件定义了新price.html的输出位置 例如: <!-- Adding custom product price block --> <catalog_category_default> <reference name="product_list"> <action
<!--
Adding custom product price block
-->
<catalog_category_default>
<reference name="product_list">
<action method="addPriceBlockType">
<type>simple</type>
<block>magesetup/catalog_product_price</block>
<template>catalog/product/price.phtml</template>
</action>
</reference>
</catalog_category_default>
易于理解的
图像设置/目录\产品\价格
目录/产品/价格.phtml
一切都很好,但是当我使用Ajax调用时,我的价格是显示的,没有额外的信息
可以为ajax调用更新my layout.xml,也可以在获取产品集合时设置addPriceBlockType?当我的价格块不是FireGento\u MageSetup\u block\u Catalog\u product\u price的实例时,我使用一个观测者从FireGento添加特殊的phtml代码
public function addPriceGerman(Varien_Event_Observer $observer) {
//lese jeden Block aus
$block = $observer->getBlock();
//ist der Block ein Price Block aber kein FireGento_MageSetup Preisblock?
if ($block instanceof Mage_Catalog_Block_Product_Price AND !$block instanceof FireGento_MageSetup_Block_Catalog_Product_Price) {
$transport = $observer->getTransport();
//hole den eigentlichen HTML Code vom Preisblock
$output = $transport->getHtml();
//hole das Produkt
$product = $observer->getEvent()->getBlock()->getProduct();
//Instanz vom MageSetup Block erzeugen
$productPrice = new FireGento_MageSetup_Block_Catalog_Product_Price();
//setze das Produkt
$productPrice->setProduct($product);
//Rendern der deutschen Preisinfo
$germanTemplate = $block->getLayout()->createBlock('core/template')
->setTemplate('magesetup/price_info.phtml')
->setProduct($product)
->setFormattedTaxRate($productPrice->getFormattedTaxRate())
->setIsIncludingTax($productPrice->isIncludingTax())
->setIsIncludingShippingCosts($productPrice->isIncludingShippingCosts())
->setPriceDisplayType(Mage::helper('tax')->getPriceDisplayType())
->setIsShowShippingLink($productPrice->isShowShippingLink())
->setIsShowWeightInfo($productPrice->getIsShowWeightInfo())
->setFormattedWeight($productPrice->getFormattedWeight())
->toHtml();
//deutsche preisinfo an ursprünglichen html code anhägen
$transport->setHtml($output . $germanTemplate);
}
return $this;
}