2
votes

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

Code: http://www.heypasteit.com/clip/0JJ8

who know what the problem is ?

2

2 Answers

2
votes

In the linked code (below for posterity), the path global/blocks/catalog/rewrite/Product_View_Options_Select should 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

<?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>  
0
votes

I get this code from a working example, so it should work

/app/code/local/RWS/CustomOptions/Options/Type/Select.php

<?php 
  class RWS_CustomOptions_Options_Type_Select extends Mage_Catalog_Block_Product_View_Options_Abstract
  {
      public function getValuesHtml()
      {
        .....

/app/code/local/RWS/CustomOptions/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <RWS_CustomOptions>
            <version>0.1.0</version>
        </RWS_CustomOptions>
    </modules>
    <global>
        <blocks>
            <catalog>
                <rewrite>
                    <product_view_options_type_select>RWS_CustomOptions_Options_Type_Select</product_view_options_type_select>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

/app/etc/modules/RWS_CustomOptions.xml

<?xml version="1.0"?>
<config>
    <modules>
      <RWS_CustomOptions>
        <active>true</active>
        <codePool>local</codePool>
     </RWS_CustomOptions>
    </modules>
<config>

To test, add a (simple) product in magento admin with a custom select option, the go product detail/view page.