2

I've tried to rewrite 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select' and

'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option' Block but i got a error like.

Fatal error: Call to a member function setCanReadPrice() on boolean in /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php on line 193

Here 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>

              <catalog>
                <rewrite>
                  <catalog_product_edit_tab_options_option>
                        Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option
                    </catalog_product_edit_tab_options_option>
                </rewrite>
              </catalog>
        </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>
            </adminhtml>
        </blocks>
    </global>
</config>

And here is my Select.php file code with path:

app/code/local/Eventprice/Meta/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Type/Select.php

<?php
class Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Select extends 
 Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select
{

    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('sphere/catalog/product/edit/options/type/select.phtml');
        $this->setCanEditPrice(true);
        $this->setCanReadPrice(true);
    }
}
?>

This is my Option.php files code with path:

app/code/local/Eventprice/Meta/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Option.php

<?php
class Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option extends 
 Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option
{
    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('sphere/catalog/product/edit/options/option.phtml');
        $this->setCanReadPrice(true);
        $this->setCanEditPrice(true);
    }
    public function getOptionValues()
    {
       // I want change the code into this function so for that I want to overwrite this class
    }
}

I've followed the http://magento.ikantam.com/qa/how-add-custom-attributes-custom-options tutorials to add new field.

This doesn't seem to be working. Any ideas?

1 Answer 1

2

Change this

<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>

to

<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>

You should not have spaces or new line characters inside the xml tags. Magento doesn't trim them.

To the same for

<catalog_product_edit_tab_options_option>
    Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Option
</catalog_product_edit_tab_options_option>
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.