Example #1
0
 /**
  * Preparing data and adding to rss object
  *
  * @param array $args
  */
 public function addSpecialXmlCallback($args)
 {
     /*
      * RSS state object
      */
     $product = new Varien_Object();
     //Product is allowed for RSS initially
     $product->setAllowedInRss(true);
     $args['product'] = $product;
     Mage::dispatchEvent('rss_catalog_special_xml_callback', $args);
     if (!$product->getAllowedInRss()) {
         //Skip adding product to RSS
         return;
     }
     $row = $args['row'];
     if ($product->getAllowedPriceInRss()) {
         $specialPrice = $row['special_price'];
         $rulePrice = $row['rule_price'];
         if (!$rulePrice || $rulePrice && $specialPrice && $specialPrice <= $rulePrice) {
             $row['start_date'] = $row['special_from_date'];
             $row['use_special'] = true;
         } else {
             $row['start_date'] = $row['rule_start_date'];
             $row['use_special'] = false;
         }
         $row['allowed_price_in_rss'] = true;
     } else {
         $row['start_date'] = null;
         $row['allowed_price_in_rss'] = false;
     }
     $args['results'][] = $row;
 }