Jump to content

Function


Guill4ume
 Share

Recommended Posts

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 ID

But my problème is for this ...

{sous_menu_categorie(5)}



It's don't works

( Sorry for my english...)

Thanks

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More