GhosToM Posted November 15, 2019 Posted November 15, 2019 Bonjour, je cherche à ajouter un paramètre à l'URL d'un produit. Comment puis-je générer ce type d'url (www.monsite.com/index.php?id_product=xxx&controller=product&id_lang=1¶m=valeur), en ajoutant le couple "param=valeur" en fin d'url ? D'avance merci. Thomas. Share this post Link to post Share on other sites More sharing options...
GhosToM Posted November 15, 2019 Posted November 15, 2019 Pardon, je me suis mal exprimé 😓 Dans product_list.tpl, on a : <a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}">...</a> Comment modifier $product.link pour prendre en compte le paramètre que je souhaite ajouter ? Et que je puisse ensuite activer l'URL Rewriting ? Merci. Share this post Link to post Share on other sites More sharing options...
GhosToM Posted November 15, 2019 Posted November 15, 2019 Just now, ndiaga said: Tout simplement <a href="{$product.link|escape:'html':'UTF-8'}?param=value" title="{$product.name|escape:'html':'UTF-8'}">...</a> C'est ce que j'ai fait dans un premier temps mais dès que j'active la réécriture d'URL cela ne fonctionne pas... J'obtiens des URLs du style : http://www.monsite.com/mon-produit-15570#/61-couleur-bleu/1147-taille-l?param=value Et je ne peux plus récupérer ma valeur passée en paramètre. Share this post Link to post Share on other sites More sharing options...
GhosToM Posted November 15, 2019 Posted November 15, 2019 2 minutes ago, ndiaga said: Donc essayer ce ci: <a href="{$product.link|escape:'html':'UTF-8'}¶m=value" title="{$product.name|escape:'html':'UTF-8'}">...</a> C'est selon les cas. Que ce soit avec "?" ou "&" cela ne change rien au problème, les paramètres passés après le "#" de l'URL ne sont pas récupérables par un $_GET sur la page produit. C'est pour cela que je voudrais modifier la variable $product.link et non pas ajouter le paramètre dans le fichier tpl. Share this post Link to post Share on other sites More sharing options...
GhosToM Posted November 15, 2019 Posted November 15, 2019 Just now, ndiaga said: Ici on utilise pas $_GET mais plutôt Tools::getValue('param') . Faites : $my_param=Tools::getValue('param'); // depuis le php Oui effectivement j'ai mis $_GET à la va vite mais même en utilisant Tools::getValue('param') cela ne résout pas le problème... Share this post Link to post Share on other sites More sharing options...
GhosToM Posted November 15, 2019 Posted November 15, 2019 (edited) 10 minutes ago, ndiaga said: Donc mettez les avant # Oui, c'est exactement ce que je cherche à faire, c'est pour ça que vous dit que votre solution d'ajouter le code "param=value" à la suite de {$product.link|escape:'html':'UTF-8'} ne fonctionne pas. Edited November 15, 2019 by GhosToM (see edit history) Share this post Link to post 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