2

i try to rewrite 'Mage_Catalog_Block_Product_View_Options_Type_Select' this catalog block but i got a error like

Fatal error: Call to a member function setTemplate() on boolean in app/code/core/Mage/Catalog/Block/Product/View/Options.php on line 197

below is my config.xml file code with file path.

app/code/local/Eventprice/Meta/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Eventprice_Meta>
            <version>0.0.1</version>
        </Eventprice_Meta>
    </modules>
    <global>
        <models>
            <eventprice_meta>
                <class>Eventprice_Meta_Model</class>
            </eventprice_meta>
        </models>
        <resources>
            <eventprice_sql>
                <setup>
                    <module>Eventprice_Meta</module>
                </setup>
            </eventprice_sql>
        </resources>
        <blocks>
            <eventprice_meta>
                <class>Eventprice_Meta_Block</class>
            </eventprice_meta>
            <adminhtml> 
                <rewrite>
                    <catalog_product_edit_tab_options_type_select>Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Select</catalog_product_edit_tab_options_type_select>
                </rewrite>
                <rewrite>
                    <catalog_product_edit_tab_options_option>Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options_option>
                </rewrite>
            </adminhtml>
            <catalog>
                <rewrite>
                    <product_view_options_type_select>Eventprice_Meta_Catalog_Block_Product_View_Options_Type_Select</product_view_options_type_select>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

below is my Select.php file code with path.

app/code/local/Eventprice/Meta/Block/Catalog/Product/View/Options/Type/Select.php

class Eventprice_Meta_Catalog_Block_Product_View_Options_Type_Select
extends Mage_Catalog_Block_Product_View_Options_Type_Select
{
    /**
     * Return html for control element
     *
     * @return string
     */
    public function getValuesHtml()
    {
       //function code as it is
    }

}

1 Answer 1

1

Your rewrite class location name is wrong.

as per as your code class is located at app/code/local/Eventprice/Meta/Block/Catalog/Product/View/Options/Type/Select but you define it as Eventprice_Meta_Catalog_Block_Product_View_Options_Type_Select

It should be

Eventprice_Meta_Block_Catalog_Product_View_Options_Type_Select.

Class is should be same with file path thus autoloader can understand it path when that file will load

1
  • Hey Amin if i want to change in custom options price then which file or template i need to rewrite? Commented May 29, 2015 at 6:32

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.