1

I want to override ConfigurableSwatches within Magento 1.9.1

I have config file at /app/etc/modules/Vlad_ConfigurableSwatches.xml

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

I have created a folder for files: /app/code/local/Vlad/ConfigurableSwatches/ Folder has two more folders: "Helper" and "etc"

"etc" folder has Config.xml file with:

<?xml version="1.0"?>
    <config>
        <modules>
            <Vlad_ConfigurableSwatches>
                <version>0.0.1</version>
            </Vlad_ConfigurableSwatches>
        </modules>

        <global>
           <helpers>
              <tag>
                  <rewrite>
                      <data>Vlad_ConfigurableSwatches_Helper_Productimg</data>
                 </rewrite>
              </tag>
           </helpers>
        </global>
  </config>

"Helper" folder has a file "Productimg.php" with following data:

class Vlad_ConfigurableSwatches_Helper_Productimg extends Mage_ConfigurableSwatches_Helper_Productimg
{ 
    public function getSwatchUrl($product, $value, $width = self::SWATCH_DEFAULT_WIDTH,
         $height = self::SWATCH_DEFAULT_HEIGHT, &$swatchType, $fallbackFileExt = null
    ) { 
        echo 1; exit; 
    } 
}
0

Your issue at wrong calling of helper prefix at config.xml

it should be configurableswatches from tag.

As per as ,magento configurableswatchesis helper prefix class type which define at

See at config.xml of Mage_ConfigurableSwatches Module:

    <global>
....
    <helpers> 
            <configurableswatches><!--  this  is called  Mage_ConfigurableSwatches module  helper prefix -->
                <class>Mage_ConfigurableSwatches_Helper</class>
            </configurableswatches>
        </helpers>
    </global>

But you have called Mage_Tag module helper prefix.

        <global>
....
  <helpers> 
            <tag><!--  this  is called  Mage_Tag module  helper prefix -->
                <class>Mage_Tag_Helper</class>
            </tag>
        </helpers>
  ....
    </global>

Also there are issue <data> tag should be <productimg>

You need to change

       <helpers>
          <tag>
              <rewrite>
                  <data>Vlad_ConfigurableSwatches_Helper_Productimg</data>
             </rewrite>
          </tag>
       </helpers>

to

<helpers>
<configurableswatches><!-- change here -->
  <rewrite>
      <productimg>Vlad_ConfigurableSwatches_Helper_Productimg</productimg>
 </rewrite>
</configurableswatches><!-- change here -->
</helpers>
| improve this answer | |
  • Ah finally.. it worked now, i was expecting change to happen straight away, but it seem to have taken a minute even those cache is switched on inside magento. – user3402600 Nov 3 '15 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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