0

By using the third party module, There is a option in admin configuration side to select the number of columns for the catalog page. I want to add an additional column option in the admin configuration side.

In third party module Model/Columncount.php

    <?php class Third_Party_Model_Columncount
    {
        public function toOptionArray()
        {
            return array(
  array('value'=>'3', 'label'=>Mage::helper('ThemeConfig')->__('3 Column Grid')),
  array('value'=>'4', 'label'=>Mage::helper('ThemeConfig')->__('4 Column Grid')),
  array('value'=>'5', 'label'=>Mage::helper('ThemeConfig')->__('5 Column Grid'))
                );
    }
    ?>

I need to add one more option with it,

For that I made an module to rewrite model as below

My_Module.xml

<config>
  <modules>
    <My_Module>
        <active>true</active>
        <codePool>local</codePool>
        <depends><Third_Party/></depends>
    </My_Module>
  </modules>
</config>

in the My/Module/etc/config.xml

<config>
    <modules>
      <My_Module>
       <version>0.1.0</version>
      </My_Module>
    </modules>
    <global>
        <models>
        <module>
        <class>My_Module_Model</class>
        </module>
            <party>
                <rewrite>
                    <columncount>My_Module_Model_Columncount</columncount>
                </rewrite>
            </party>
        </models>
    </global>
</config>

and in My/Module/Model/Columncount.php

<?php class My_Module_Model_Columncount extends Third_Party_Model_Columncount
{
    public function toOptionArray()
    {
        return array(
        array('value'=>'3', 'label'=>Mage::helper('ThemeConfig')->__('3 Column Grid')),
        array('value'=>'4', 'label'=>Mage::helper('ThemeConfig')->__('4 Column Grid')),
        array('value'=>'5', 'label'=>Mage::helper('ThemeConfig')->__('5 Column Grid')),
        array('value'=>'6', 'label'=>Mage::helper('ThemeConfig')->__('6 Column Grid'));
    }

}?>

But it is not getting rewritten, why? Can anyone help here.

1
  • Would you please paste the code of Third/Party/etc/config.xml?
    – michael
    Nov 24, 2014 at 10:28

1 Answer 1

1

The rewrite is fine and should work but you do have error in config.xml file

<module>    

is repeated twice, second note should be closed

</module>  

You can try test it using

get_class(Mage::getModel('party/columncount'))

The problem might also be related to attribute / column renderer. You need to check if the model / block uses magento class prefix party/columncount to handle renderer or if the class name is put as it is Third_Party_Model_Columncount

1
  • Thanks! I have corrected the mistake. Even though it is not working. If I add additional option in Third_Party_Model_Columncount, it adds the new option. So this is the file which is giving the options for configuration.
    – SIBHI S
    Nov 23, 2014 at 15:42

Your Answer

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

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