Hi guys...
On the category pages for my site, you can click on either the product image or a Product Details button to visit the product page. The image is linked to www.mysite.com/menu-item-alias/product-alias-detail - whereas the Product Details button goes to www.mysite.com/component/virtuemart/product-alias-detail?Itemid=100
The button is created via this code in /template/html/com_virtuemart/sublayouts/addtocartbar.php
<a class="btn btn-default" href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id); ?>"><?php echo vmText::_ ('VIEW PRODUCT') ?></a>
Can anyone advise on the route I should add to the button so as to achieve the same URL as the product image?
Hope that makes sense.
Thanks!
IN the default VM template sublayouts the URLS are the same, so suggest you compare your override with that.
Ok, awesome.....good suggestion! Many thanks!
Sorry! Back again...
I can't work it out unfortunately. Do you know which file controls the product image on the Category page? Maybe I can locate that within the template and add the same link format to the 'Product Details' button.
components/com_virtuemart/sublayouts/products.php
I finally managed to sort this with the following code from the products.php file.
Thanks for your help!
-------------------------------------------
<div class="vm-details-button">
<?php // Product Details Button
$link = empty($product->link)? $product->canonical:$product->link;
echo JHtml::link($link.$ItemidStr,vmText::_ ( 'COM_VIRTUEMART_PRODUCT_DETAILS' ), array ('title' => $product->product_name, 'class' => 'product-details' ) );
//echo JHtml::link ( JRoute::_ ( 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id , FALSE), vmText::_ ( 'COM_VIRTUEMART_PRODUCT_DETAILS' ), array ('title' => $product->product_name, 'class' => 'product-details' ) );
?>
</div>