2013-09-24 20 views
0

如何僅爲手冊catalog_product_view重寫Mage_Catalog_Block_Product_Price?該塊在佈局中沒有特定的名稱。如何爲處理catalog_product_view重寫Mage_Catalog_Block_Product_Price?

<catalog_product_view> 
    <reference name="???"> 
     <block type="test/price" name="test.price /> 
    </reference>   
</catalog_product_view> 
+0

可以指定你想做? –

+0

我需要在Mage_Catalog_Block_Product_Price中重寫_toHtml()以解析產品頁面的html(爲HTML標籤添加豐富的片段屬性) – sergei

回答

0

由於在magento中,產品類​​型定義了用於渲染價格的塊,所以它有點棘手。也許這可以工作:

去你喜歡的佈局XML文件,並添加此

<catalog_product_view> 
    <reference name="catalog_product_price_template"> 
     <action method="addPriceBlockType"><type>simple</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action> 
     <action method="addPriceBlockType"><type>virtual</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action> 
     <action method="addPriceBlockType"><type>grouped</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action> 
     <action method="addPriceBlockType"><type>downloadable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action> 
     <action method="addPriceBlockType"><type>configurable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action> 
     <action method="addPriceBlockType"><type>bundle</type><block>yourmodule/bundle_catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action> 
    </reference> 
</catalog_product_view> 

IAM不是100%肯定,這將工作,但它也許是開始爲你

+0

謝謝,您非常感謝! – sergei

相關問題