Jump to content

Get all images from products and display them in tpl


LazyCircles

Recommended Posts

Hello everyone,

 

Im kinda stuck finding a way to get all the images of a product.

 

I know I need to create static function with a SQL query... all good.... I followed this topic (I think the query is ok, I can't test it) 

 

"https://www.prestashop.com/forums/topic/266568-how-to-get-all-product-images-to-show-on-product-listtpl/"

 

My problem is how to assign this "SQL query" to a variable and then loop trough it in the .tpl file.

 

Do you know how to do this?

 

Already have a loop for products and categories just missing the one for product images.

 

Thanks in advance!

(sorry for my english)

 

Best Regards,

Bruno

Link to comment
Share on other sites

It's hard to tell without looking at your code.

 

 

Assign your variable to smarty:

$this->context->smarty->assign(array(
    'your_variable' => $your_variable,
));

Sample loop in tpl files:

{foreach from=$invoices_collection item=invoice}
{$invoice->id}
{/foreach}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...