Skip to main content

recuperer a coup sur les images dans show.php

More
11 years 1 month ago #213199 by erickb
-- HikaShop version -- : 250
-- Joomla version -- : 343

Bonjour

comment recuperer l'array des images dans le template product/show.php ?

$this->element->images
ou
$this->element->main->images

car avec this->element->main->images j'ai une erreur Invalid argument supplied for foreach()

merci

Please Log in or Create an account to join the conversation.

More
11 years 1 month ago #213201 by Xavier
Bonjour,

Vous pouvez utiliser ce genre de code:
Code:
if(is_array($this->element->main->images)) $images = $this->element->main->images; elseif(is_array($this->element->images)) $images = $this->element->images; else $images = array();

De cette manière si il y a des images, vous les récupèrerez, sinon on crée un tableau vide ce qui évite l'erreur dans le foreach.
The following user(s) said Thank You: erickb

Please Log in or Create an account to join the conversation.

More
11 years 1 month ago #213282 by erickb
merci xavier

Please Log in or Create an account to join the conversation.

Time to create page: 0.161 seconds
Powered by Kunena Forum