<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.0.9
  @date  20/05/10, 11:41
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
Class specials {

  var $leflux;


  function specials(){
    $this->title=SPECIALS_TITLE_FEEDS;
    $this->description=SPECIALS_DESC_FEEDS;
    $this->link=tep_href_link(FILENAME_DEFAULT);

    $this->leflux=array();
  }

  function feed(){

    global $page,$languages_id,$currencies;

    $products_new_query_raw = "select p.products_id, pd.products_name,pd.products_description, p.products_image, p.products_price, p.specials_new_products_price, p.products_tax_class_id, p.products_date_added, p.manufacturers_name from " . TABLE_V_PRODUCTS . " p , " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.specials_new_products_price IS NOT NULL and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name limit 20";

    $products_new_result = tep_db_query($products_new_query_raw);


    while($products_new = tep_db_fetch_array($products_new_result)) {

      $whats_new_price =  $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
      $specials_new_products_price =  $currencies->display_price($products_new['specials_new_products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));

      $list['title']=htmlspecialchars($products_new['products_name']) ;
      $list['link']=tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id'], 'NONSSL') ;
      $list['image']=htmlspecialchars(tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], $page->_conf_value('SMALL_IMAGE_WIDTH'), $page->_conf_value('SMALL_IMAGE_HEIGHT')));
      $list['description']=htmlspecialchars($products_new['products_description']);
      $list['price']=htmlspecialchars('<del>'.$whats_new_price.'</del>'.$specials_new_products_price);
      $list['specialprice']=htmlspecialchars($specials_new_products_price);
      $this->leflux[]=new objectInfo($list);
    }

    return $this->leflux;
  }

}
?>