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

#   Cacher le stock pour une catégorie donnée

##

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

Less More

- Posts: 262
- Thank you received: 9
-
-
-

15 years 1 week ago [\#27489](#27489) by [laurent](/forum/user/268-laurent "View laurent's Profile")  *[Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#27489 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")* was created by *[laurent](/forum/user/268-laurent "View laurent's Profile")*

Bonjour,

Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?

Merci,

Laurent

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

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

Less More

- Posts: 86290
- Thank you received: 14268
-
-

15 years 1 week ago [\#27499](#27499) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#27499 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Il n'y a pas d'option pour cela. Maintenant, tout est possible en modifiant le code...
Il faudrait essayer de changer la ligne:
echo '&lt;span class="hikashop_product_stock_count"&gt;'.JText::sprintf('X_ITEMS_IN_STOCK',$this-&gt;row-&gt;product_quantity).'&lt;/span&gt;&lt;br/&gt;';

en:
if($this-&gt;row-&gt;category_id==XXX) echo '&lt;span class="hikashop_product_stock_count"&gt;'.JText::sprintf('X_ITEMS_IN_STOCK',$this-&gt;row-&gt;product_quantity).'&lt;/span&gt;&lt;br/&gt;';
dans le fichier quantity de la vue product via le menu Affichage-&gt;Vues.

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

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

Less More

- Posts: 262
- Thank you received: 9
-
-
-

15 years 1 week ago [\#27501](#27501) by [laurent](/forum/user/268-laurent "View laurent's Profile")  Replied by *[laurent](/forum/user/268-laurent "View laurent's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#27501 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Dans mon cas c'est la négation de la condition puisqu'il n'y a qu'une catégorie (produits en solde) pour laquelle on n'affiche pas le stock :

if($this-&gt;row-&gt;category_id!=20) echo '&lt;span class="hikashop_product_stock_count"&gt;'.JText::sprintf('X_ITEMS_IN_STOCK',$this-&gt;row-&gt;product_quantity).'&lt;/span&gt;&lt;br/&gt;';

Cela semble fonctionner très bien. Encore bravo pour la vitesse de la réponse et la précision.

Merci

PS : il faudrait regrouper toutes ces "astuces" dans un manuel ou un wiki non ? La recherche dans le forum n'est pas si facile (pourtant je le fais avant en français et en anglais).

Bonne journée,

Laurent

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

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

Less More

- Posts: 86290
- Thank you received: 14268
-
-

15 years 1 week ago [\#27502](#27502) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#27502 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Le problème c'est que chaque personne a besoin d'une modification différente... Il n'est pas possible de rassembler tout cela dans la documentation. Ce serait trop. Par exemple, pour votre modification, c'est la première fois que quelqu'un demande cela, donc de toute façon vous n'auriez pas trouvé, ni dans la documentation, ni sur le forum.

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 2 months ago -  12 years 2 months ago [\#167199](#167199) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167199 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonsoir,

Désoler de déterrer un topic si vieux, mais je voudrais effectuer exactement la même chose à un détail prêt c'est que je voudrais l'appliquer à une catégorie et ses héritiers est ce possible?

En travaillant avec le code si dessus : Code:

if($this-&gt;row-&gt;category_id!=XX)

Cordialement

Last edit: 12 years 2 months ago by [Mickael](/forum/user/33657-mickael "View Mickael's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vMjc0ODktY2FjaGVyLWxlLXN0b2NrLXBvdXItdW5lLWNhdGVnb3JpZS1kb25uZWU/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: 4078
-
- [](http://obsi.dev)
-

12 years 2 months ago [\#167241](#167241) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167241 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

Vous pouvez utiliser le in_array pour tester plusieurs catégories en même temps. Code:

if(in_array($this-&gt;row-&gt;category_id, array(XX,YY,ZZ))

Par contre pour faire une catégorie et ses enfants, il faut faire une requête en base de données (direct ou via l'utilisation de la classe catégorie) pour récupérer tous les enfants d'une catégorie donnée (via les left/right du b-tree).
Le plus simple est à mon avis de mettre la liste dans le array, surtout si vos catégories ne vont pas changer spécialement avec le temps.

Cordialement,

---

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

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 2 months ago [\#167345](#167345) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167345 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonsoir,

Merci pour votre réactivité, effectivement la solution la plus simple serait de préciser chaque catégorie.
Est ce vraiment plus complexe d'appliquer à une catégorie et ces enfants (Je serais mené de temps en temps à rajouter des catégories).

Vous me conseillez de faire toute suite le array et de faire la manipulation d'ajouts des nouvelles catégories au fur et à mesure?

Deuxième petite question:

Ou dois-je appliquer le code pour effacer le "NO_STOCK" sur la liste des produits, et non sur la page du produit?

Merci d'avance.
Cordialement.

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

12 years 2 months ago [\#167399](#167399) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167399 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,
1.

> Vous me conseillez de faire toute suite le array et de faire la manipulation d'ajouts des nouvelles catégories au fur et à mesure?

Cette solution serai la plus rapide, et ajouter l'ID d'une nouvelle catégorie enfant ne vous prendra pas beaucoup de temps.

2.
Il faudra appliquer ce code via cette ligne du fichier "quantity" de la vue "product" de votre template de front-end via "Hikashop-&gt;Affichage-&gt;Vues" : Code:

echo JText::_('NO_STOCK').'&lt;br/&gt;';

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 2 months ago [\#167424](#167424) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167424 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Merci pour votre réponses.

J'ai appliquer le in_array dans les catégorie que je voulais masquer le "NO_STOCK"

Le problème c'est que le "NO_STOCK" est bien masqué sur la description du produit mais pas sur la page de la liste des produits.

Je vous joins les photos ci-dessous.

- [ ![image&#95;liste&#95;produit.jpg](/forum/attachment/18977) ](/forum/attachment/18977 "...te&#95;produit.jpg") [ ](/forum/attachment/18977?download=1 "...te&#95;produit.jpg")
- [ ![image&#95;description&#95;produit.jpg](/forum/attachment/18978) ](/forum/attachment/18978 "...on&#95;produit.jpg") [ ](/forum/attachment/18978?download=1 "...on&#95;produit.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vMjc0ODktY2FjaGVyLWxlLXN0b2NrLXBvdXItdW5lLWNhdGVnb3JpZS1kb25uZWU/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: 4078
-
- [](http://obsi.dev)
-

12 years 2 months ago [\#167433](#167433) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167433 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

"NO_STOCK" peut également être affiché par la vue "add_to_cart_listing".
Vous devez donc mettre le même code dans cette vue pour cacher ce texte (qui n'affiche pas le stock mais indique lorsqu'il n'y en a plus).

Cordialement,

---

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

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 2 months ago -  12 years 2 months ago [\#167504](#167504) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167504 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

Je ne pense pas que le NO_STOCK pour la liste des produits soit gérer par "add_to_cart_listing" en testant et supprimant le "NO_STOCK" en " " l’écho s'affiche toujours sur la liste des produits à l'inverse quand j'effectue cette manipulation sur la commande de la vue "quantity" l’écho ne s'affiche pas sur la liste des produits ainsi que sur la description du produit.

Le soucis est dès que j'insère ma commande Code:

if(in_array($this-&gt;row-&gt;category_id, array(44,87,88,91,92,93,94,142,143,144,145)))

Le "NO_STOCK" disparaît bien dans la description du produit mais pas sur ma liste de produit...

Cordialement

Last edit: 12 years 2 months ago by [Mickael](/forum/user/33657-mickael "View Mickael's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vMjc0ODktY2FjaGVyLWxlLXN0b2NrLXBvdXItdW5lLWNhdGVnb3JpZS1kb25uZWU/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: 4078
-
- [](http://obsi.dev)
-

12 years 2 months ago [\#167547](#167547) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#167547 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

En fait oui, c'est tout à fait logique.
" $this-&gt;row-&gt;category_id " n'est accessible que lorsque vous êtes dans la page produit.
C'est bien la vue "quantity" qui est appelée dans votre listing mais à ce moment là, on ne peut pas accéder à la variable "category_id".

Par contre vous avez la variable " $this-&gt;row-&gt;categories " qui se trouve être un tableau.
Je vous recommande d'utiliser " var_dump() " afin de connaitre le contenu (ou la présence) d'une variable ; vous aidant ainsi à faire votre modification de vue.

Cordialement,

---

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

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 1 month ago -  12 years 1 month ago [\#169538](#169538) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#169538 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonsoir,

Merci pour votre réponses,
En appliquant le code ci-dessous le var_dump me retourne : NULL
Code:

&lt;div class="hikashop_product_no_stock"&gt; &lt;?php echo JText::_('NO_STOCK').'&lt;br/&gt;'; var_dump($this-&gt;row-&gt;categories) ; $waitlist = $this-&gt;config-&gt;get('product_waitlist',0); if(hikashop_level(1) &amp;&amp; ($waitlist==2 &#124;&#124; ($waitlist==1 &amp;&amp; (!empty($this-&gt;element-&gt;main-&gt;product_waitlist) &#124;&#124; !empty($this-&gt;element-&gt;product_waitlist))))){ ?&gt;

J'ai l'impression que il y aucune db identique appeler sur la page produit et sur la liste des produits....
Est-il compliqué d'appeler "category_id" sur la liste des produits ?

Je ne vois pas comment je pourrais m'en sortir ...

Merci pour votre aide.
Cordialement

Last edit: 12 years 1 month ago by [Mickael](/forum/user/33657-mickael "View Mickael's Profile").

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

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

Less More

- Posts: 86290
- Thank you received: 14268
-
-

12 years 1 month ago [\#169544](#169544) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#169544 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

Peut être est-ce parce que vous êtes sur une ancienne version d'HikaShop, ou qu'avec certaines combinaison d'option cette variable n'est pas initialisée.
Mais si vous voulez connaitre la catégorie courante sur un listing de produit c'est $this-&gt;element que vous voulez utiliser. Elle contient différents attributs dont category_id qui est l'id de la catégorie courante.
Mais bon, vous n'avez pas vraiment besoin de nous pour trouver cela. Sur n'importe quelle vue, si vous faites un var_dump de $this vous obtiendrez la liste de toutes les variables disponibles.

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 1 month ago [\#169826](#169826) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#169826 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

Oui bien sûr, mais quand je fait un Code:

var_dump($this-&gt;element)

Je retrouve sur mon listing et sur ma page produit Code:

["category_id"]=&gt; string(2) "44" ["category_parent_id"]=&gt; string(2) "35"

Donc quand j'applique Code:

if(in_array($this-&gt;row-&gt;category_id, array(44)))

il devrait marcher sur les deux pages non?

Cordialement

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vMjc0ODktY2FjaGVyLWxlLXN0b2NrLXBvdXItdW5lLWNhdGVnb3JpZS1kb25uZWU/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)
-

12 years 1 month ago [\#169872](#169872) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#169872 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

En fait element est utilisé dans les listing et row dans les page produit.
Donc utilisez ceci pour les listings: Code:

if(in_array($this-&gt;element-&gt;category_id, array(44)))

The following user(s) said Thank You: [Mickael](/forum/user/33657-mickael "View Mickael's Profile")

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

- **[Mickael](/forum/user/33657-mickael "View Mickael's Profile")**
- [![Mickael's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/quiet.jpg)](/forum/user/33657-mickael "View Mickael's Profile")
- [ Offline](/forum/user/33657-mickael)

Less More

- Posts: 7
- Thank you received: 0
-
-

12 years 1 month ago [\#169993](#169993) by [Mickael](/forum/user/33657-mickael "View Mickael's Profile")  Replied by *[Mickael](/forum/user/33657-mickael "View Mickael's Profile")* on topic *[Re: Cacher le stock pour une catégorie donnée](/forum/5-support-en-francais-french-support-/27489-cacher-le-stock-pour-une-categorie-donnee#169993 "Bonjour,  Le forum donne des solutions pour ne pas afficher l'information relative au stock. Mais est-il possible de conditionner cela à une catégorie donnée ?  Merci,  Laurent")*

Bonjour,

Voilà, parfait problème résolu, il suffisait d'appeler element pour le listing et row pour le produit.

Merci pour votre aide et votre réactivité.
![:cheer:](/media/kunena/emoticons/10.png ":cheer:") :woohoo:

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vMjc0ODktY2FjaGVyLWxlLXN0b2NrLXBvdXItdW5lLWNhdGVnb3JpZS1kb25uZWU/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.493 seconds

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

[](#top)
