Engine23

Magento Abstract Class

If your trying to do a typical "Rewrite" of a Magento Abstract class,  you can stop now and save yourself some headaches.  Magento Abstract classes are not something you can do a rewrite on.

The only way to get it to work is to make a copy of the file in your local folder of app/code/local

Here is how I did an overload of Mage_Rule_Model_Abstract:

Step 1 Create a file app/code/local/Mage/Rule/Model/Abstract.php

Step 2 copy the contents from app/code/core/Mage/Rule/Model/Abstract.php and paste it into our new file we created on Step 1.

Step 3 test to see if its using our file instead of the core file, if you have a debugger, like the one in PHPstorm but a break point and execute the code!

You should now be all set and using our version of the abstract class instead of the core file, now you can edit it to suit your needs, like I did for allowing a negative number in the shopping cart rules.

Share: