0

I'm trying to extend properly the core class Mage_Tax_Helper_Data with a module named "smartvat". All seem ok, my config.xml file:

<?xml version="1.0"?>
<config>
  <modules>
    <Bsinformatica_Smartvat>
      <version>0.1.1</version>
    </Bsinformatica_Smartvat>
  </modules>
  <global>
    <helpers>
      <smartvat>
        <class>Bsinformatica_Smartvat_Helper</class>
      </smartvat>
    </helpers>
      <helpers>
        <tax>
          <rewrite>
            <data>Bsinformatica_Smartvat_Tax_Helper_Data</data>
          </rewrite>
        </tax>
      </helpers>
    <models>
      <tax>
        <rewrite>
          <config>Bsinformatica_Smartvat_Tax_Model_Config</config>
        </rewrite>
      </tax>
    </models>
      </global>
</config>

and my class...

class Bsinformatica_Smartvat_Tax_Model_Config extends Mage_Tax_Model_Config {

    public function getPriceDisplayType($store = null)
    {
        // code goes here
    }

}

All it seems ok and the class id properly rewrited. But doing this the admin menu Sales>Taxes disappear. If I comment out:

<helpers>
    <tax>
        <rewrite>
            <data>Bsinformatica_Smartvat_Tax_Helper_Data</data>
        </rewrite>
    </tax>
</helpers>

this section the menu displays correctly. Can someone help me?

2
0

Your directory structure and config are not matching.

Please update your files and directory structure as follows.

enter image description here

1) app\etc\modules\Bsinformatica_Smartvat.xml

<?xml version="1.0" encoding="UTF-8" ?>
        <config>
    <modules>
        <Bsinformatica_Smartvat>
            <active>1</active>
            <codePool>local</codePool>
        </Bsinformatica_Smartvat>
    </modules>
</config>

2) app\code\local\Bsinformatica\Smartvat\etc\config.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <modules>
        <Bsinformatica_Smartvat>
            <version>0.1.1</version>
        </Bsinformatica_Smartvat>
    </modules>
    <global>
        <helpers>
            <smartvat>
                <class>Bsinformatica_Smartvat_Helper</class>
            </smartvat>

            <tax>
                <rewrite>
                    <data>Bsinformatica_Smartvat_Helper_Tax_Data</data>
                </rewrite>
            </tax>
        </helpers>
        <models>
            <smartvat>
                <class>Bsinformatica_Smartvat_Model</class>
            </smartvat>
            <tax>
                <rewrite>
                    <config>Bsinformatica_Smartvat_Model_Tax_Config</config>
                </rewrite>
            </tax>
        </models>
    </global>
</config>

3) app\code\local\Bsinformatica\Smartvat\Helper\Tax\Data.php

<?php

class Bsinformatica_Smartvat_Helper_Tax_Data extends Mage_Tax_Helper_Data
{

}

4) app\code\local\Bsinformatica\Smartvat\Model\Tax\Config.php

<?php

class Bsinformatica_Smartvat_Model_Tax_Config extends Mage_Tax_Model_Config
{

}

This will rewrite both helper and model.

Hope this helps you.

2
  • Ashish you're a genius. Thank you very much this solved my problem! – Bsinformatica Aug 11 '16 at 10:00
  • If you are satisfied with answer then you can accept and upvote it so that it will help others. – Ashish Madankar M2 Professiona Aug 11 '16 at 10:20

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.