Guill4ume Posted October 26, 2010 Share Posted October 26, 2010 Hello all,I have create a function : function sous_menu_categorie($id_categorie) { $sql='SELECT `id_category` WHERE `id_parent`='.$id_categorie.' FROM `ps_category`'; // on envoie la requête $req = mysql_query($sql) or die('Erreur SQL ! '.$sql.' '.mysql_error()); // on fait une boucle qui va faire un tour pour chaque enregistrement while($data = mysql_fetch_assoc($req)) { // on affiche les informations de l'enregistrement en cours echo $data['id_category']; } } For this time this function is just Post IDs of the sub-category where have parent with $id_categorie IDBut my problème is for this ... {sous_menu_categorie(5)} It's don't works( Sorry for my english...)Thanks Link to comment Share on other sites More sharing options...
rocky Posted October 26, 2010 Share Posted October 26, 2010 The third line is wrong. It should be: $sql='SELECT `id_category` FROM `ps_category` WHERE `id_parent`='.$id_categorie; Link to comment Share on other sites More sharing options...
Guill4ume Posted October 26, 2010 Author Share Posted October 26, 2010 Thanks,but it's doesn't work again ...For use function is : " {Name_function($argument)} in prestashop ? Link to comment Share on other sites More sharing options...
rocky Posted October 27, 2010 Share Posted October 27, 2010 You must register a function before you can use it in Smarty. For example, PrestaShop registers the dateFormat function on line 112 of init.php (in PrestaShop v1.3.2): $smarty->register_function('dateFormat', array('Tools', 'dateFormat')); The first parameter is the name of the function you want to use in Smarty and the second parameter is the class and function that should be called. 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