1

I was trying to rewrite product model. It's my config.xml

<global>
    <models>
        <catalog>
            <rewrite>
                <product>
                    My_Namespace_Model_Product
                </product>
            </rewrite>
        </catalog>
    </models>
</global>

And My_Namespace_Model_Product

class My_Namespace_Model_Product extends Mage_Catalog_Model_Product
{

public function test()
{
    var_dump(Mage::getModel('catalog/product'));
}
}

Why function Mage::getModel('catalog/product') return me false after rewrite class?

6
  • Can you please post more specification here? Apr 13 '18 at 9:54
  • try to return some string in your test() method and call Mage::getModel('catalog/product')->test() in another script
    – Keyur Shah
    Apr 13 '18 at 11:36
  • @RohanHapani . What you need? Apr 13 '18 at 12:09
  • @KeyurShah method Mage::getModel('catalog/product') return false, i cant call test(). Apr 13 '18 at 12:37
  • 2
    Please try to write <product>My_Namespace_Model_Product</product> on a single line (w/o linebreaks).
    – sv3n
    Apr 13 '18 at 12:51
3

Please try to write <product>My_Namespace_Model_Product</product> on a single line (w/o linebreaks).

1
  • 1
    I usually put it in one line, I never thought that the fact to put them in two lines causes problem @sv3n
    – Aamir
    Apr 13 '18 at 14:29

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.