3

I'm trying to load a model with: Mage::getModel('OnePica_AvaTax/AvaTax_Estimate') but Magento errors with Warning: include(Mage\OnePica\AvaTax\Model\AvaTax\Estimate.php): failed to open stream: No such file or directory, when this model is in the Community folder, not the Core folder... Mage shouldn't be there at all.

I know I've dealt with this in the past, but I can't remember what the correct way to do this is.

1 Answer 1

8

The factory pattern Mage::getModel takes a specific input. This follows the form of [module]/path_to_class.

In the case of Avatax, the [model] is defined as avatax:

#file: app/code/community/Onepica/Avatax/etc/config.xml
//...
<global>
    <models>
        <avatax>
            <class>OnePica_AvaTax_Model</class>
        </avatax>
//....

So you will load the model with this:

Mage::getModel('avatax/avatax_estimate');

Hope that helps!

1
  • Was about to say it didn't work, but case sensitivity caught me!
    – andyjv
    Sep 13, 2013 at 16:39

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.