tk77axa Posted June 12, 2014 Share Posted June 12, 2014 (edited) ooook... Am urmatorul cod care imi afiseaza doua variante diferite de "Size Chart" in functie de Producator ID Cum il fac sa imi afiseze in functie de Category ID? Modulul complet atasat. public function hookProductFooter($params) { if (isset($params['category']->id_category)) { $id_product = $_GET["id_product"]; $db = Db::getInstance(); $results = $db->ExecuteS(' SELECT `id_manufacturer` FROM `'._DB_PREFIX_.'product` WHERE `id_product` ="'.intval($id_product).'"; '); $manufacturer = $results[0]['id_manufacturer']; if (intval($manufacturer) === 1 ) { global $smarty, $cookie; $smarty->assign(array( 'this_path' => $this->_path, 'id_manufacturer' => $results[0]['id_manufacturer'] , 'this_path_ssl' => Configuration::get('PS_FO_PROTOCOL').$_SERVER['HTTP_HOST'].__PS_BASE_URI__."modules/{$this->name}/")); return $this->display(__FILE__, 'productssizechart-puppia.tpl'); } if (intval($manufacturer) === 2 ) { global $smarty, $cookie; $smarty->assign(array( 'this_path' => $this->_path, 'id_manufacturer' => $results[0]['id_manufacturer'] , 'this_path_ssl' => Configuration::get('PS_FO_PROTOCOL').$_SERVER['HTTP_HOST'].__PS_BASE_URI__."modules/{$this->name}/")); return $this->display(__FILE__, 'productssizechart-deardog.tpl'); } } return; } } ?> productssizechart.zip Edited June 12, 2014 by tk77axa (see edit history) Link to comment Share on other sites More sharing options...
valentin.g Posted June 23, 2014 Share Posted June 23, 2014 if (intval($manufacturer) === 1 ) { global $smarty, $cookie; $smarty->assign(array( 'this_path' => $this->_path, 'id_manufacturer' => $results[0]['id_manufacturer'] , 'this_path_ssl' => Configuration::get('PS_FO_PROTOCOL').$_SERVER['HTTP_HOST'].__PS_BASE_URI__."modules/{$this->name}/")); return $this->display(__FILE__, 'productssizechart-puppia.tpl'); } modifici in if (intval($params['category']->id_category) == 1 ) // pui id-ul corect { return $this->display(__FILE__, 'productssizechart-puppia.tpl'); } elseif (intval($params['category']->id_category) == 2 ) // pui id-ul corect { return $this->display(__FILE__, 'productssizechart-puppia.tpl'); } ..... else // pentru implicit { return $this->display(__FILE__, 'productssizechart-puppia.tpl'); } Link to comment Share on other sites More sharing options...
tk77axa Posted June 24, 2014 Author Share Posted June 24, 2014 (edited) nu imi iese nicicum....orice as face se afiseaza doar pentru o singura categorie.... am diverse tpl-uri care vreau sa le afiseze diferit in functie de categorie ( ex daca e categoria 21 sa afiseze tpl2 / daca e categoria 12 sa afiseze tpl3 ...si tot asa) orice as face afiseaza intr-o categorie un tpl dar in altele nimic! multumesc oricum Edited June 24, 2014 by tk77axa (see edit history) Link to comment Share on other sites More sharing options...
valentin.g Posted June 25, 2014 Share Posted June 25, 2014 if (intval($params['category']->id_category) == 21 ) // pui id-ul corect return $this->display(__FILE__, 'tpl2.tpl'); // pui tpl template aici elseif (intval($params['category']->id_category) == 12 ) // pui id-ul corect return $this->display(__FILE__, 'tpl3.tpl'); / pui tpl template aici else // pentru implicit return $this->display(__FILE__, 'productssizechart-puppia.tpl'); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now