title: Display collection of Shopping cart rules and products categories associated to each rule
body: <p>I want to check if there is a sales promotion on the product then stick the promotion label on that product on category list page. But I don't know how to loop through all the shopping cart rules and retrieve the products/categories associated to each rule.</p>
  
  <p><strong>EDITED</strong></p>
  
  <p>Thanks seanbreeden, but I can't pull the skus from <code>$conditions</code>. <code>var_dump($conditions);</code> shows this:</p>
  
  <pre><code>{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}a:7:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:7:{s:4:"type";s:42:"salesrule/rule_condition_product_subselect";s:9:"attribute";s:3:"qty";s:8:"operator";s:2:"&gt;=";s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:32:"salesrule/rule_condition_product";s:9:"attribute";s:12:"category_ids";s:8:"operator";s:2:"==";s:5:"value";s:2:"23";s:18:"is_value_processed";b:0;}}}}}a:7:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:2:{i:0;a:5:{s:4:"type";s:32:"salesrule/rule_condition_address";s:9:"attribute";s:13:"base_subtotal";s:8:"operator";s:2:"&gt;=";s:5:"value";s:2:"45";s:18:"is_value_processed";b:0;}i:1;a:7:{s:4:"type";s:42:"salesrule/rule_condition_product_subselect";s:9:"attribute";s:3:"qty";s:8:"operator";s:2:"&gt;=";s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:32:"salesrule/rule_condition_product";s:9:"attribute";s:3:"sku";s:8:"operator";s:2:"==";s:5:"value";s:46:"test-config, BLFA0968C-BK001, BLFA0968C-CR033X";s:18:"is_value_processed";b:0;}}}}}a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}a:7:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:7:{s:4:"type";s:42:"salesrule/rule_condition_product_subselect";s:9:"attribute";s:3:"qty";s:8:"operator";s:2:"&gt;=";s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:32:"salesrule/rule_condition_product";s:9:"attribute";s:3:"sku";s:8:"operator";s:2:"==";s:5:"value";s:16:"BLFA0968C-CR033X";s:18:"is_value_processed";b:0;}}}}}
  </code></pre>
  
  <p>but when I loop through $conditions i.e. </p>
  
  <pre><code>$rules = Mage::getResourceModel('salesrule/rule_collection')-&gt;load();
  
  foreach ($rules as $rule) {
      $conditions = $rule-&gt;getConditionsSerialized();
      foreach ($conditions as $condition) {
          var_dump($condition);
      }
  }
  </code></pre>
  
  <p>it doesn't show anything so don't really know how to pull skus here.</p>
  
  <p><strong>EDIT2</strong>
  As Alaxandre suggested, I'm not using unserialized approach. I'm doing it like this now:</p>
  
  <pre><code>$rules = Mage::getResourceModel('salesrule/rule_collection')-&gt;load();
  
  foreach ($rules as $rule) {
      if ($rule-&gt;getIsActive()) {
          //print_r($rule-&gt;getData());
          $rule = Mage::getModel('salesrule/rule')-&gt;load($rule-&gt;getId()); 
  
          $conditions = $rule-&gt;getConditions();
          $conditions = $rule-&gt;getConditions()-&gt;asArray();
  
          foreach( $conditions['conditions'] as $_conditions ):
              foreach( $_conditions['conditions'] as $_condition ):
                  $string = explode(',', $_condition['value']);
                  for ($i=0; $i&lt;count($string); $i++) {
                      $skus[] = trim($string[$i]);
                  }
              endforeach;
          endforeach;
      }
  }
  return $skus;
  </code></pre>
  
  <p>And then checking in list page if sku matches within $skus array then show the label. But again there are limitation with this approach as well. I'm think of another approach (I'm not sure if thats is possible). 
  Thinking of creating a new table (to save the sales rules products).Everytime save the sales rule, catch the save rule event and update the table with Rule name and all the associated products. Then on the list page check that table, if products exist in the table, show the appropriate label. Now I think the event is adminhtml_controller_salesrule_prepare_save (not 100% sure) but I don't know how to get the sku from the rule condition in the observer to save in the new table.</p>