1

I currently load it by ID, like so:

Mage::getModel('catalogrule/rule')->load(1);
5

You can load every (non-EAV!) entity just by adding a second argument to load:

$entity->load($value, $column);

The problem is, if the column is not unique you get one of the matching entities back, and you don't know which.

For your case this should be:

$catalogrule->load('10% to all items', 'name');
  • Hi I put this code ($catalog_rule = Mage::getModel('catalogrule/rule')->load('20 OFF PROMO','name')) getting rule but its not working in magento 1.9 – Jenith Samuel Nov 7 '17 at 14:00
  • Make sure the name matches exactly. Maybe you have two rules with the same name? – Fabian Blechschmidt Nov 7 '17 at 16:40
  • How to load catalog rule by name in magento 2? – Purushotam Sharma Mar 26 '18 at 12:26
  • Hi @JenithSamuel, check if instead of the module 'catalogrule/rule' you have to use 'salesrule/rule' (not a catalog price rule but a cart price rule). – PauGNU Aug 29 '19 at 6:57

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.