覆盖Magento中的产品价格模板
我试图在Magento中隐藏产品和网格页面的所有产品的价格。我创建了一个自定义模块来更新布局,config.xml如下所示:覆盖Magento中的产品价格模板,magento,Magento,我试图在Magento中隐藏产品和网格页面的所有产品的价格。我创建了一个自定义模块来更新布局,config.xml如下所示: <config> <modules> <ABC_XYZ> <version>1.0</version> </ABC_XYZ> </modules> <frontend> <l
<config>
<modules>
<ABC_XYZ>
<version>1.0</version>
</ABC_XYZ>
</modules>
<frontend>
<layout>
<updates>
<killprice>
<file>killprice.xml</file>
</killprice>
</updates>
</layout>
</frontend>
</config>
<layout>
<default>
<block type="catalog/product_price_template" name="catalog_product_price_template" template="killprice/price.phtml" />
</default>
<killprice_index_index>
<block type="catalog/product_price_template" name="catalog_product_price_template" template="killprice/price.phtml" />
</killprice_index_index>
</layout>
1
killprice.xml
我添加了killprice.xml,如下所示:
<config>
<modules>
<ABC_XYZ>
<version>1.0</version>
</ABC_XYZ>
</modules>
<frontend>
<layout>
<updates>
<killprice>
<file>killprice.xml</file>
</killprice>
</updates>
</layout>
</frontend>
</config>
<layout>
<default>
<block type="catalog/product_price_template" name="catalog_product_price_template" template="killprice/price.phtml" />
</default>
<killprice_index_index>
<block type="catalog/product_price_template" name="catalog_product_price_template" template="killprice/price.phtml" />
</killprice_index_index>
</layout>
但是killprice/price.phtml没有被呈现,我得到了正常的价格模板。我对killprice.xml布局文件中的标记有点怀疑,我是否以正确的方式覆盖了价格模板?这应该是您正在寻找的
<layout>
<default>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>killerprice/price.phtml</template></action>
<!-- duplicate for each product type you need to handle i.e. change the value of the <type> node" -->
</reference>
</default>
</layout>
simplecatalog/product_pricekillerprice/price.phtml
查看
Mage\u Catalog\u Block\u Product\u Abstract
以了解其工作原理这应该是您正在寻找的
<layout>
<default>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>killerprice/price.phtml</template></action>
<!-- duplicate for each product type you need to handle i.e. change the value of the <type> node" -->
</reference>
</default>
</layout>
simplecatalog/product_pricekillerprice/price.phtml
请查看Mage\u Catalog\u Block\u Product\u Abstract
以了解其工作原理simplecatalog/Product\u price namespace/Catalog/Product/simple\u price.phtml bundlecatalog/Product\u price namespace/Catalog/Product/bundle\u price.phtml这对mesimplecatalog/product\u pricenamespace/catalog/product/simple\u price.phtml bundlecatalog/product\u pricenamespace/catalog/product/bundle\u price.phtml不起作用