Jump to content

How to add product link in order history detail (order-detail.tpl)


Recommended Posts

In order history detail, instead of only product name, I want to link it (product name) into the product page, so that customer can easily review the product they've ordered by clicking on it.

 

I've tried to edit order-history.tpl but still no luck.

 

<!-- Classic products -->
...
{$product.product_name|escape:'htmlall':'UTF-8'}

 

into

 

<!-- Classic products -->
...
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.product_name|escape:'htmlall':'UTF-8'}</a>

 

It will link to product with id=0

 

How can I do this correctly?

 

PS. I use Prestashop 1.3.x

Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...
  • 1 year later...
  • 2 weeks later...

I don't find it on history.tplI have done some modifications on order-detail.tpl

 

change :

<th class="item">{l s='Product'}</th>

by :

<th class="item"><a href="{$link->getProductLink($product.product_id, $product.link_rewrite, $product.category_rewrite)}">{l s='Product'}</a></th>

But after I can't open the order detail :(

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Hi. 
 
Here it is, with image:

<a href="{$link->getProductLink($product)|escape:'html'}"> <img class="history_img" src="{$link->getImageLink($product.link_rewrite, $product.image->id_image, 'small_default')}{('.jpg')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} />

{$product.product_name|escape:'htmlall':'UTF-8'} </a>

Link to comment
Share on other sites

  • 6 months later...

Did you go to Advanced Parameters > Performance and click the "Clear cache" button? You need to do that if you have "Never compile templates" selected.

Hello now nothing happend when i click on details. Can you help me please.

Link to shop www.kolhapurithusi.in

And yes i cleared the cache and have never compile templates selected

Link to comment
Share on other sites

I tested the code above and the product image code had errors in it, so I removed it so there's only a link. Change line 302 (in PrestaShop v1.6.1.8) of themes/default-bootstrap/order-detail.tpl from:

        {$product.product_name|escape:'html':'UTF-8'}

to:

        <a href="{$link->getProductLink($product)|escape:'html'}">{$product.product_name|escape:'htmlall':'UTF-8'}</a>
  • Like 1
Link to comment
Share on other sites

 

I tested the code above and the product image code had errors in it, so I removed it so there's only a link. Change line 302 (in PrestaShop v1.6.1.8) of themes/default-bootstrap/order-detail.tpl from:

        {$product.product_name|escape:'html':'UTF-8'}

to:

        <a href="{$link->getProductLink($product)|escape:'html'}">{$product.product_name|escape:'htmlall':'UTF-8'}</a>

thanks for your reply. Did it cleared cache still the same.. Can you please provide a properly edited order-detail file so that i can upload it please!

Link to comment
Share on other sites

 

I tested the code above and the product image code had errors in it, so I removed it so there's only a link. Change line 302 (in PrestaShop v1.6.1.8) of themes/default-bootstrap/order-detail.tpl from:

        {$product.product_name|escape:'html':'UTF-8'}

to:

        <a href="{$link->getProductLink($product)|escape:'html'}">{$product.product_name|escape:'htmlall':'UTF-8'}</a>

cAN SEE THE ORDER NOW BUT PRODUCT LINKS ARENT CLICKABLE YET

Edited by rushaboswal.rdx (see edit history)
Link to comment
Share on other sites

Here's a zipped version of my order-detail.tpl file, but note that it's based on the one from PrestaShop v1.6.1.8, so it may not be fully compatible if you're using an older version.

Hello used your .tpl file but still products arent clickable yet.. Cleared Cache too.. Sorry if im torubling you a lot

Link to comment
Share on other sites

It's working fine on my PrestaShop v1.6.1.8 test site. Try going to the Advanced Parameters > Performance tab and temporarily choose "Force compile".

 

If that doesn't work, maybe your web browser has cached the AJAX request? Try clearing your web browser cache.

Link to comment
Share on other sites

It's working fine on my PrestaShop v1.6.1.8 test site. Try going to the Advanced Parameters > Performance tab and temporarily choose "Force compile".

 

If that doesn't work, maybe your web browser has cached the AJAX request? Try clearing your web browser cache.

It worked now.. Thanks a lot. can i switch it back to never recompile now? Also is there a way to highlight the LINK to make it much easier.

Thanks :)

Thanks A lot you really are an legend :)

Link to comment
Share on other sites

Yes, you can change it back if you've finished editing TPL files. If you plan to edit them some more, I suggest choosing "Recompile templates if they've been updated".

 

You can change <a to <a style="color: blue" or another colour to make it more obvious it is clickable.

  • Like 1
Link to comment
Share on other sites

Yes, you can change it back if you've finished editing TPL files. If you plan to edit them some more, I suggest choosing "Recompile templates if they've been updated".

 

You can change <a to <a style="color: blue" or another colour to make it more obvious it is clickable.

<a style="color: blue" href="{$link->getProductLink($product)|escape:'html'}">{$product.product_name|escape:'htmlall':'UTF-8'}</a>

 

So this is the right code? Correct me if im wrong.!

Dont have enough words to thank you :)

Also is it possible to add same links in the automatic generated emails?

PS- I'll also make post about this to help other with your name and thanking you if you dont have a problem sir :)

Link to comment
Share on other sites

  • 7 months later...

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...