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

#   afficher les images des produits

##

- **[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: 2706
- Thank you received: 74
-
-

14 years 9 months ago -  14 years 9 months ago [\#38725](#38725) by [erickb](/forum/user/4069-erickb "View erickb's Profile")  *[afficher les images des produits](/forum/5-support-en-francais-french-support-/38725-afficher-les-images-des-produits#38725 "Bonjour  dans ./templates/montemplate/html/com&#95;hikashop/product/show&#95;block&#95;img.php  j'ai  mais je ne veux pas cette image&#91;0&#93; je veux l'image $this-&gt;element-&gt;images&#91;1&#93; comment je fais pour afficher la seconde image de la liste à la place $image-&gt;file&#95;path qui m'affiche la premiere ?  la seule maniere que j'ai trouve c'est  j'ai 3 images a faire passer a des endroits different et je dois faire 3 foreach ! comment j’accède a mes images directement ?  $this-&gt;element-&gt;images&#91;1&#93; plante le code  merci")* was created by *[erickb](/forum/user/4069-erickb "View erickb's Profile")*

Bonjour

dans ./templates/montemplate/html/com_hikashop/product/show_block_img.php

j'ai Code:

&lt;div id="hikashop_main_image_div"&gt; &lt;?php $image = reset($this-&gt;element-&gt;images); echo '&lt;img src="' . $this-&gt;image-&gt;uploadFolder_url . $image-&gt;file_path . '" alt="' . $image-&gt;file_name . '" id="hikashop_main_image" /&gt;'; ?&gt; &lt;/div&gt;

mais je ne veux pas cette image[0] je veux l'image **$this-&gt;element-&gt;images\[1\]**
comment je fais pour afficher la seconde image de la liste à la place $image-&gt;file_path qui m'affiche la premiere ?

la seule maniere que j'ai trouve c'est
Code:

foreach($this-&gt;element-&gt;images as $num =&gt; $image){ if ($num==1){ echo '&lt;img src="' . $this-&gt;image-&gt;uploadFolder_url . $image-&gt;file_path . '" alt="' . $image-&gt;file_name . '" id="hikashop_main_image" /&gt;'; } }

j'ai 3 images a faire passer a des endroits different et je dois faire 3 foreach !
comment j’accède a mes images directement ?

$this-&gt;element-&gt;images[1] plante le code

merci

Last edit: 14 years 9 months ago by [erickb](/forum/user/4069-erickb "View erickb's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vMzg3MjUtYWZmaWNoZXItbGVzLWltYWdlcy1kZXMtcHJvZHVpdHM/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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

14 years 9 months ago [\#38904](#38904) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: afficher les images des produits](/forum/5-support-en-francais-french-support-/38725-afficher-les-images-des-produits#38904 "Bonjour  dans ./templates/montemplate/html/com&#95;hikashop/product/show&#95;block&#95;img.php  j'ai  mais je ne veux pas cette image&#91;0&#93; je veux l'image $this-&gt;element-&gt;images&#91;1&#93; comment je fais pour afficher la seconde image de la liste à la place $image-&gt;file&#95;path qui m'affiche la premiere ?  la seule maniere que j'ai trouve c'est  j'ai 3 images a faire passer a des endroits different et je dois faire 3 foreach ! comment j’accède a mes images directement ?  $this-&gt;element-&gt;images&#91;1&#93; plante le code  merci")*

au lieu de :
$image = reset($this-&gt;element-&gt;images);

vous pouvez faire:
$image = $this-&gt;element-&gt;images[0];

et donc vous aurez cela:
$image = $this-&gt;element-&gt;images[0];
echo '&lt;img src="' . $this-&gt;image-&gt;uploadFolder_url . $image-&gt;file_path . '" alt="' . $image-&gt;file_name . '" id="hikashop_main_image" /&gt;';

Sinon trois foreach peuvent faire l'affaire aussi, cela ne change pas grand chose...

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

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