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

#   savoir s'il y a des produits dans related

##

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

Less More

- Posts: 2705
- Thank you received: 74
-
-

12 years 4 months ago [\#163799](#163799) by [erickb](/forum/user/4069-erickb "View erickb's Profile")  *[savoir s'il y a des produits dans related](/forum/5-support-en-francais-french-support-/869657-savoir-sil-y-a-des-produits-dans-related#163799 "-- HikaShop version -- : 232  je fais passer RELATED&#95;PRODUCTS dans show&#95;default.php au lieu de show.php de cette maniere  mais si c'est vide je ne veux rien afficher du tout comment puis je savoir le nombre de produits related ?  merci")* was created by *[erickb](/forum/user/4069-erickb "View erickb's Profile")*

-- HikaShop version -- : 232

je fais passer RELATED_PRODUCTS dans show_default.php au lieu de show.php de cette maniere
Code:

if (!empty ($this-&gt;modules) &amp;&amp; is_array($this-&gt;modules)) { jimport('application.module.helper'); foreach ($this-&gt;modules as $module) { if($module-&gt;title == 'RELATED_PRODUCTS'){ echo '&lt;div class="hk-other-color hk-other-color-related"&gt;&lt;span class="hk-add-to-cart hk-other-color-title"&gt;' . JText::_('RELATED_PRODUCTS') . '&lt;/span&gt;&lt;div class="hk-other-color-imgs"&gt;'; echo JModuleHelper::renderModule($module); echo '&lt;/div&gt;'; echo '&lt;/div&gt;'; } } }

mais si c'est vide je ne veux rien afficher du tout
comment puis je savoir le nombre de produits related ?

merci

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vODY5NjU3LXNhdm9pci1zaWwteS1hLWRlcy1wcm9kdWl0cy1kYW5zLXJlbGF0ZWQ/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: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

12 years 4 months ago [\#163800](#163800) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[savoir s'il y a des produits dans related](/forum/5-support-en-francais-french-support-/869657-savoir-sil-y-a-des-produits-dans-related#163800 "-- HikaShop version -- : 232  je fais passer RELATED&#95;PRODUCTS dans show&#95;default.php au lieu de show.php de cette maniere  mais si c'est vide je ne veux rien afficher du tout comment puis je savoir le nombre de produits related ?  merci")*

Bonjour,

Solution 1 - Faire une requête SQL afin de compter le nombre de produits liés. (table "product_related")

Solution 2 - Récupérer le contenu du renderModule avant d'afficher le reste.
Avec le contenu retourné, vous pouvez savoir s'il y a du contenu ou non. Et donc ne rien afficher si le module ne retourne "rien".

Cordialement,

---

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

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

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

Less More

- Posts: 2705
- Thank you received: 74
-
-

12 years 4 months ago [\#163894](#163894) by [erickb](/forum/user/4069-erickb "View erickb's Profile")  Replied by *[erickb](/forum/user/4069-erickb "View erickb's Profile")* on topic *[savoir s'il y a des produits dans related](/forum/5-support-en-francais-french-support-/869657-savoir-sil-y-a-des-produits-dans-related#163894 "-- HikaShop version -- : 232  je fais passer RELATED&#95;PRODUCTS dans show&#95;default.php au lieu de show.php de cette maniere  mais si c'est vide je ne veux rien afficher du tout comment puis je savoir le nombre de produits related ?  merci")*

merci

oui je voulais eviter la requete sql

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

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