displayContent($id_lang); // $catalog->debug(); class Catalog { private $_xml; private $_debug; public $id_lang; public $currentTime; public function __construct(){ $this->_xml =""; } public function setContent($id_lang) { global $cookie; $dom = new DomDocument(); if ($id_lang == 2) { $site_version = 'fr'; } else if ($id_lang == 3) { $site_version = 'es'; } if (Tools::getValue('future') && Tools::getValue('future') == 1) $sales = Sale::getSales(TRUE, NULL, NULL, TRUE, FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`date_start` DESC', NULL, $filter_type, $site_version); else $sales = Sale::getSales(TRUE, NULL, NULL, 'current', FALSE, Configuration::get('PRIVATESALES_SHOW_PUBLIC'), '`date_start` DESC', NULL, $filter_type, $site_version); foreach ($sales as $sale) { $sql = 'SELECT value FROM '._DB_PREFIX_.'privatesale_extrafield_sale WHERE id_field = 2 AND id_lang = '.(int) $id_lang.' AND id_sale = ' . $sale->id; if ($value = Db::getInstance()->getValue($sql)){ $sale->reduction = $value; }else{ $sale->reduction = "Non défini"; } } $this->setXml($sales, false, $id_lang); } public function displayContent($id_lang) { $this->setContent($id_lang); header('Content-Type: text/xml'); echo $this->_xml; } public function setXml($items, $rss=false, $id_lang){ $this->_xml = ''; // Catalog $this->_xml .= ''; //Shop details $this->_xml .= ''; $this->_xml .= 'http://www.bebeboutik.com/img/logo.png'; $this->_xml .= 'bebeboutik.com'; if (Tools::getValue('partenaire') && Tools::getValue('partenaire') == "family_deal") { $this->_xml .= ''; } else { $this->_xml .= 'www.bebeboutik.com'; } $this->_xml .= ''; foreach ($items as $item) { $this->_xml.=''; // $this->_xml .= ''.$item->id.''; $this->_xml .= 'title[(int) $id_lang].']]>'; $this->_xml .= 'description[(int) $id_lang].']]>'; $this->_xml .= ''.$item->date_start.''; $this->_xml .= ''.$item->date_end.''; $this->_xml .= ''.$item->reduction.''; $this->_xml .= 'http://www.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg'; $this->_xml.=''; } $this->_xml .= ''; } }