[Skip to main content](#vessel-content)

#   Remplacer 'unité' par 'par personne"

##

- **[ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")**
- [![ferraridino's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8138-ferraridino "View ferraridino's Profile") Topic Author
- [ Offline](/forum/user/8138-ferraridino)

Less More

- Posts: 23
- Thank you received: 0
-
-

13 years 11 months ago -  13 years 11 months ago [\#77593](#77593) by [ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")  *[Remplacer 'unité' par 'par personne"](/forum/5-support-en-francais-french-support-/75958-remplacer-unite-par-par-personne#77593 "Bonsoir, j'ai tenté une modification du fichier listing&#95;price pour permettre une meilleurs compréhension des intitulés dans la description des produits et changer 'unité' en 'par personne' comme ci dessous.  avec ce code:  Celà fonctionne mais j'ai un message d'erreur dans le panier  Warning: Invalid argument supplied for foreach() in /homepages/10/d369393173/htdoc Comment y remédier j’avoue être débutant en php :( Merci d'avance")* was created by *[ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")*

Bonsoir, j'ai tenté une modification du fichier listing_price pour permettre une meilleurs compréhension des intitulés dans la description des produits
et changer 'unité' en 'par personne' comme ci dessous.

[ ![19-11-2012&#95;22-09-56.jpg](/forum/attachment/7058) ](/forum/attachment/7058 "...2&#95;22-09-56.jpg")

avec ce code: Code:

$productClass = hikashop_get('class.product'); $productCategories = $productClass-&gt;getCategories(hikashop_getCID()); $itemTextpers = 'PER_UNIT'; foreach($productCategories as $productCategory){ if($productCategory == '15'){ $itemTextpers = 'PER_PERSONNE'; } } if(isset($price-&gt;price_min_quantity) &amp;&amp; empty($this-&gt;cart_product_price) &amp;&amp; $this-&gt;params-&gt;get('per_unit',1)){ if($price-&gt;price_min_quantity&gt;1){ echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price-&gt;price_min_quantity); }else{ echo JText::_($itemTextpers); } }

Celà fonctionne mais j'ai un message d'erreur dans le panier

Warning: Invalid argument supplied for foreach() in /homepages/10/d369393173/htdoc
Comment y remédier j’avoue être débutant en php ![:(](/media/kunena/emoticons/22.png ":(")
Merci d'avance

- [ ![19-11-2012&#95;22-09-56.jpg](/forum/attachment/7058) ](/forum/attachment/7058 "...2&#95;22-09-56.jpg") [ ](/forum/attachment/7058?download=1 "...2&#95;22-09-56.jpg")

Last edit: 13 years 11 months ago by [ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU5NTgtcmVtcGxhY2VyLXVuaXRlLXBhci1wYXItcGVyc29ubmU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

13 years 11 months ago [\#77608](#77608) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Remplacer 'unité' par 'par personne"](/forum/5-support-en-francais-french-support-/75958-remplacer-unite-par-par-personne#77608 "Bonsoir, j'ai tenté une modification du fichier listing&#95;price pour permettre une meilleurs compréhension des intitulés dans la description des produits et changer 'unité' en 'par personne' comme ci dessous.  avec ce code:  Celà fonctionne mais j'ai un message d'erreur dans le panier  Warning: Invalid argument supplied for foreach() in /homepages/10/d369393173/htdoc Comment y remédier j’avoue être débutant en php :( Merci d'avance")*

Bonsoir,

Dans le panier vous n'avez pas de CID dans l'URL.
Le mieux est de ne pas se baser sur hikashop_getCID pour récupérer l'ID du produit, mais plutôt sur les informations contenus dans $this.
Comme par exemple : **$this-&gt;row-&gt;product\_id**

Cordialement,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU5NTgtcmVtcGxhY2VyLXVuaXRlLXBhci1wYXItcGVyc29ubmU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")**
- [![ferraridino's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8138-ferraridino "View ferraridino's Profile") Topic Author
- [ Offline](/forum/user/8138-ferraridino)

Less More

- Posts: 23
- Thank you received: 0
-
-

13 years 11 months ago [\#77667](#77667) by [ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")  Replied by *[ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")* on topic *[Remplacer 'unité' par 'par personne"](/forum/5-support-en-francais-french-support-/75958-remplacer-unite-par-par-personne#77667 "Bonsoir, j'ai tenté une modification du fichier listing&#95;price pour permettre une meilleurs compréhension des intitulés dans la description des produits et changer 'unité' en 'par personne' comme ci dessous.  avec ce code:  Celà fonctionne mais j'ai un message d'erreur dans le panier  Warning: Invalid argument supplied for foreach() in /homepages/10/d369393173/htdoc Comment y remédier j’avoue être débutant en php :( Merci d'avance")*

Bonjour, j'ai remplacé

$productCategories = $productClass-&gt;getCategories(hikashop_getCID());

Par

$productCategories = $productClass-&gt;getCategories($this-&gt;row-&gt;product_id);

Et j'ai le même problème sauf qu'il ne prend plus en compte dans la description du produit l'intitulé "par personne' et me remet 'unité'.
Dans le panier j'ai toujours le Warning!

Ce qui est curieux c'est qu'en local le premier code fonctionne sans erreurs

Je comprend pas!!!
Pourriez vous m'aider a sortir de là.
Merci

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU5NTgtcmVtcGxhY2VyLXVuaXRlLXBhci1wYXItcGVyc29ubmU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 11 months ago [\#77669](#77669) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Remplacer 'unité' par 'par personne"](/forum/5-support-en-francais-french-support-/75958-remplacer-unite-par-par-personne#77669 "Bonsoir, j'ai tenté une modification du fichier listing&#95;price pour permettre une meilleurs compréhension des intitulés dans la description des produits et changer 'unité' en 'par personne' comme ci dessous.  avec ce code:  Celà fonctionne mais j'ai un message d'erreur dans le panier  Warning: Invalid argument supplied for foreach() in /homepages/10/d369393173/htdoc Comment y remédier j’avoue être débutant en php :( Merci d'avance")*

Bonjour,

Essayez d'encader le foreach par un if tel que: Code:

if(isset($productCategories) &amp;&amp; is_array($productCategories){ // foreach{ ... // } }

Par défault le "unité" n'est pas affiché dans le passage en caisse il me semble.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU5NTgtcmVtcGxhY2VyLXVuaXRlLXBhci1wYXItcGVyc29ubmU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")**
- [![ferraridino's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8138-ferraridino "View ferraridino's Profile") Topic Author
- [ Offline](/forum/user/8138-ferraridino)

Less More

- Posts: 23
- Thank you received: 0
-
-

13 years 11 months ago -  13 years 11 months ago [\#77671](#77671) by [ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")  Replied by *[ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile")* on topic *[Remplacer 'unité' par 'par personne"](/forum/5-support-en-francais-french-support-/75958-remplacer-unite-par-par-personne#77671 "Bonsoir, j'ai tenté une modification du fichier listing&#95;price pour permettre une meilleurs compréhension des intitulés dans la description des produits et changer 'unité' en 'par personne' comme ci dessous.  avec ce code:  Celà fonctionne mais j'ai un message d'erreur dans le panier  Warning: Invalid argument supplied for foreach() in /homepages/10/d369393173/htdoc Comment y remédier j’avoue être débutant en php :( Merci d'avance")*

Merci merci Xavier et Jérôme c'est tout bon. manque juste une')' if(isset($productCategories) &amp;&amp; is_array($productCategories)){ ![:P](/media/kunena/emoticons/14.png ":P")
cordialement

Last edit: 13 years 11 months ago by [ferraridino](/forum/user/8138-ferraridino "View ferraridino's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzU5NTgtcmVtcGxhY2VyLXVuaXRlLXBhci1wYXItcGVyc29ubmU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.082 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
