Reputation: 11
I am developing a custom search module/component. I get the list of products of Virtuemart but I don't know how to build the URL of each product, because my product belongs to many categories.
Upvotes: 0
Views: 1857
Reputation: 15032
In Joomla 3.X this works for me
JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$X);
Where $X
is your product ID. This will give you the "final" (possibly pretty) URL.
Note that this returns the URL...
Common mistake is requesting the wrong view (product, productdetail (no "s" at the end), ...), the view you want really is exactly "productdetails".
Upvotes: 1
Reputation: 145
i'm working with Joomla 2.5 and Virtuemart 2 (not sure if the same as yours) and the url is working without category:
normal url: <your domain>index.php/virtuemart/category_1/<product_alias>-detail
url withowt category: <your domain>index.php/virtuemart/<product_alias>-detail
for me both are working
Upvotes: 0