VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: radu4us on January 04, 2013, 20:39:06 PM

Title: Error in the building of product url in Virtuemart Products Module
Post by: radu4us on January 04, 2013, 20:39:06 PM
Hi,

I'm using joomla 2.5.8 and Virtuemart 2.0.16 and I encountered this error in Products Module:

The url of the products displayed in the module differs according to the category being browsed.

To be more specific:

a product that has the url:
  /index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=21&virtuemart_category_id=13

changes the category id in the url like this:

when browsing category  14 the url changes to:
   /index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=21&virtuemart_category_id=14&Itemid=564

when browsing category 6 the url changes to:
  /index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=21&virtuemart_category_id=6&Itemid=536

Can anyone help please?
Title: Re: Error in the building of product url in Virtuemart Products Module
Post by: jjk on January 05, 2013, 10:47:29 AM
Looks like you have assigned your product to more than one category, so the category id of course changes when you look at it in a different category.
Concerning itemid, see here: http://www.ostraining.com/blog/joomla/what-is-the-joomla-itemid/ (http://www.ostraining.com/blog/joomla/what-is-the-joomla-itemid/)
Title: Re: Error in the building of product url in Virtuemart Products Module
Post by: radu4us on January 05, 2013, 11:09:46 AM
No, it's not that. The majority of the products belong to one category.

I believe that the error lies in the virtuemart module and the way it builds the url. I think that what happens is that a new product url is being generated every time the module is being displayed on a page, and the error lies in taking the current category id instead of the original category id of the product.

I would say that it might be easier to use the $this->product->product_url instead of building it every time, but I'm not a programmer.
Title: Re: Error in the building of product url in Virtuemart Products Module
Post by: PRO on January 05, 2013, 16:34:25 PM
the product module build the url dynamicly.

Looking at the code it should be using ONLY 1 category ID. (the lowest category id assigned to)

I tested yesterday after seeing this thread, and I think building the url with

$product->link    might fix it

I can do it, but not until monday or something so you can try it


Title: Re: Error in the building of product url in Virtuemart Products Module
Post by: radu4us on January 05, 2013, 18:00:19 PM
OK, thanks.

I tried it myself but it resulted only in php errors, so I'll wait for your solution.