I'm on Mage 1.8 with custom data.

  • I have created a catalog rule that give 10% discount when sku = 'n2610' ( relative product id is 16 )
  • saved the rule
  • apply all the rule

Now I m testing the rule with the following code:

require_once './app/Mage.php';

$rule = Mage::getModel('catalogRule/rule')->load(5);


getMatchingProductIds() gives me back an array() with all prod. here the part for the interested product.


16 => 
array (size=3)
  0 => int 0
  1 => int 0
  2 => int 0

I expect that the array contains some 1.

If I debug the following method, I can see that the $validatedValue is always empty so the rule never match.


Anyone can point me to the error ? is it a bug on 1.8 ( I'm quite sure I haven't touched any core file.)


According to this answer: https://stackoverflow.com/questions/19857309/magento-1-8-0-0-promotion-catalog-price-rules-does-not-work-when-condition-i

It's a bug/feature in 1.8, Catalog Rules work with conditions for attributes with scope other than Global.


As far as I am aware the function getMatchingProductIds will return a multi-dimensional array with the following structure:

    'product_id_1' => array(
        'website_id_1' => 0,
        'website_id_2' => 0,
    'product_id_2' => array(
        'website_id_1' => 0,
        'website_id_2' => 1,

This means it will give you an array of all product ids and all website ids, then the value attached to the website will be the result of the validation of the rule's conditions for that product/website combination using (int)$this->getConditions()->validate($product)

For more information about the structure you can look at https://magento.stackexchange.com/a/13224/158

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.