本文介绍了magento重写目录块Product/View/Options/Type/Select.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重写块文件:/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php,下面是我的步骤,但不起作用:

i want to rewrite the block file : /app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php, below is my steps, but it is not working :

ScreentShot: http://imm.io/J36p

ScreentShot: http://imm.io/J36p

代码: http://www.heypasteit.com/clip/0JJ8

谁知道问题出在哪里?

推荐答案

在链接的代码中(后代),路径global/blocks/catalog/rewrite/Product_View_Options_Select应该global/blocks/catalog/rewrite/product_view_options_select,因为在布局XML文件中使用小写字母指定了块类(例如, https://github.com/benmarks/magento-mirror/blob/1.7.0.2/app/design/frontend/base/default/layout/catalog.xml#L228 ).

In the linked code (below for posterity), the path global/blocks/catalog/rewrite/Product_View_Options_Selectshould be global/blocks/catalog/rewrite/product_view_options_select, because the block class is specified using lowercase in layout XML files (eg. https://github.com/benmarks/magento-mirror/blob/1.7.0.2/app/design/frontend/base/default/layout/catalog.xml#L228).

/app/code/local/Lbb/Catalog/etc/config.xml

/app/code/local/Lbb/Catalog/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>  
<config>  
    <modules>  
        <Lbb_Catalog>  
            <version>0.1.0</version>  
        </Lbb_Catalog>  
    </modules>  
    <global>  
        <blocks>  
            <catalog>  
                <rewrite>  
                        <product_view_options_type_select>Lbb_Catalog_Block_Product_View_Options_Type_Select</product_view_options_type_select>  
                </rewrite>  
            </catalog>  
        </blocks>  
    </global>  
</config>  

这篇关于magento重写目录块Product/View/Options/Type/Select.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:49