2

How do i programmatically check if a catalog pricerule is active or not?

I have tried loading collection like this, where 13 is ID of the catalog rule:

$catalog_rule = Mage::getModel('catalogrule/rule')->load(13); 

And then use

if (!empty($catalog_rule)) {
    echo 'foo';
}

This always returns true nomatter if rule is active or not.

How do i check if catalog price rule is not empty and is active?

1
  • Try to make: Mage::getModel('catalogrule/rule')->load(13)->getIsActive();
    – osrecio
    Sep 18, 2014 at 14:57

1 Answer 1

2

Take a look at /app/code/core/Mage/CatalogRule/Model/Rule.php

* @method int getIsActive()

Try

$catalog_rule = Mage::getModel('catalogrule/rule')->load(13);

if ($catalog_rule->getIsActive()) {
    echo 'foo';
}
0

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.