1

I'm trying to override the Catalog/Product/View/Options/Type/Select.php class so I can change the initial placeholder text from: -- Please Select -- to Choose Size. My custom module is recognized within the admin (and is enabled) and all files seem to have the right code but I'm not seeing the text replaced.

Can anyone see what I'm doing wrong? Any advice would be very helpful!

Here is my app/etc/Override_Catalog.xml file:

<?xml version="1.0"?>
<config>
    <modules>
        <Override_Catalog>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Catalog />
            </depends>
        </Override_Catalog>
    </modules>
</config>

Then the app/code/local/Override/Catalog/etc/config.xml file:

<?xml version="1.0"?>
<config>
    <global>
        <blocks>
            <mymodule>
                <class>Override_Catalog_Block_Product_View_Options_Type</class>
            </mymodule>
            <catalog>
                <rewrite>
                    <select>Override_Catalog_Block_Product_View_Options_Type_Select</select>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

And lastly the class file:

<?php
    class Override_Catalog_Block_Product_View_Options_Type_Select 
        extends Mage_Catalog_Block_Product_View_Options_Type_Select {

        # I only override the placeholder text, everything else remains intact.
    }

2 Answers 2

1

Ok so firstly, I would suggest that if the only reason for this module is "I only override the placeholder text, everything else remains intact." that you Magentos translate files. Assuming by placeholder text you mean "--Please Select--".

Simply open up app/locale/en_US/Mage_Catalog.csv find the line below (where en_US is the locale your using)

"-- Please Select --","-- Please Select --"

and upadte the second comma seperate value to your new placeholder e.g

"-- Please Select --","-- Some placeholder --"

If you still need to use a module the changes Amit suggest and you'd end up with a block node like below:

        <blocks>
            <!-- This mymodule node is not really needed for what your trying to achive but nice to put in for when you do add your own blocks -->
            <mymodule>
                <class>Override_Catalog_Block</class>
            </mymodule>
            <catalog>
                <rewrite>
                  <product_view_options_type_select>Override_Catalog_Block_Product_View_Options_Type_Select</product_view_options_type_select>
                </rewrite>
            </catalog>
        </blocks>
0

Here the solution

<catalog>
    <rewrite>
        <select>Override_Catalog_Block_Product_View_Options_Type_Select</select>
    </rewrite>
</catalog> 

should be

<catalog>
    <rewrite>
<product_view_options_type_select>Override_Catalog_Block_Product_View_Options_Type_Select</product_view_options_type_select>
    </rewrite>
</catalog>

Know more about how to rewrite a class see http://inchoo.net/ecommerce/magento/overriding-magento-blocks-models-helpers-and-controllers/

As you rewrite Mage_Catalog_Block_Product_View_Options_Type_Select .

And this call block xml type is 'catalog/product_view_options_type_select'

'catalog' means Mage_Catalog_Block

and product_view_options_type_select means Product_View_Options_Type_Select

In config.xml file of app/code/core/Mage/Catalog/etc briefly

code

<blocks>
<catalog>
    <class>Mage_Catalog_Block</catalog>

<catalog>
</blocks>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.