ecommerce more info button on product list

Permalink
Hi
I'm wanting to add a More Info button on the product list items that will link to the product page.
I have added
<div class="moreinfo"><a href="">More Info</a></div> to the plain template which adds it OK but i'm not sure what php coded i need to add to the <a href=""> to make ut link to the relevant product detail page. Obviously if you click on the image or title it takes you to the page but can't seem to find the code that generates that link.

Thanks in advance.

 
mesuva replied on at Permalink Reply
mesuva
The default template for the page_list block (just the view.php file, not the one in the plain folder) uses template elements to display product attributes. It's in one of these elements where the link to the product page is generated, so I think you might have more success using the default template file for the product list block and then overriding the template elements. You can override the template file for the block anyway, so I'm suggesting you use that one as you starting point and not the plain one.

The two elements that are relevant are:
/packages/core_commerce/elements/product/display.php
/packages/core_commerce/elements/product/display/properties.php

It may depend on where you are adding your link to which one you need to override, but perhaps look at properties.php first. You would copy them to:
/elements/product/display.php and
/elements/product/display/properties.php respectively.

At the top of both of these, you'll see some code that generates the link that goes around the product image, $link_before and $link_after. Simply use those to create your link in the appropriate place within the element file.
oakleafg replied on at Permalink Reply
Thanks for that, I have actually got it working using the plain template by just adding
<div class="moreinfo"><?php echo $link_before.Details.$link_after?></div> can only use a single word for the button text though as the space between two words causes errors!!!
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Try
$link_before.'More Details'.$link_after
oakleafg replied on at Permalink Reply
Brilliant it worked, Thanks.