Jump to content

[SOLVED] Get product images in history.tpl


Recommended Posts

Hi,

 

I'm trying to get all the images of all the orders from a custumer in the history page of "my acount".

In order to get the image link I need the $product variable, I think, but can't access from history.tpl to it.

Anyone knows how to do it?

 

Thanks in advance and sorry if this is not the correct place to this question (first post here)

Link to comment
Share on other sites

Ok, in HistoryController.php I insert in the loop this:

$order['product'] = $myOrder->getProducts();

So if I insert in history.tpl this:

{foreach from=$orders item=order name=myLoop}    
            {$myproduct=$order.product}
            {$myproduct|var_dump}
 {/foreach}

I get the whole information of the product...

 

Now, the problem is that I can't access to the variables of the $myprodut array, and I don't know why. I mean, if I try to print the "id" of the product, for example and I write inside this loop {$myproduct.id|var_dump} what I get is NULL...

 

Any ideas? It has to be so easy, but...

Link to comment
Share on other sites

Well, I keep answering to myself...

 

Just in case someone need it, finally I manage to make it.

 

As I said, I get the product in the history controller, and then in history.tpl:

{foreach from=$orders item=order name=myLoop}
        {$myproduct=$order.product}           
        {foreach from=$myproduct item=pro name=myLoop2}            
                    {$myimg=$pro.image}
                    <img src="{$link->getImageLink(orderimage, $myimg->id_image, 'home_default')}"/>                
          {/foreach}      
{/foreach}

Like that I get all the images from all the orders... Later it's just arrange it with HTML and CSS.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
×
×
  • Create New...