Brayan Serrano
Brayan Serrano

Reputation: 11

Virtuemart - how to create product detail url

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

Answers (2)

jave.web
jave.web

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

codeTemplar
codeTemplar

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

Related Questions