Link to home
Start Free TrialLog in
Avatar of webstudiointeractive
webstudiointeractive

asked on

Virtuemart get product_id

Hi there,

I need to access the product_id of each product that is listed in the following Virtuemart store page:

http://lovemyself.com.au/index.php?option=com_wrapper&view=wrapper&Itemid=61

Each item is created by the the file at:

\components\com_virtuemart\themes\default\templates\browse\browse2.php

But I cannot find anywhere in the entire site source code that lets me access the product_id variable for each product.

I can see that in browse2.php there are various variables used, such as $product_name, $product_s_desc, $product_flypage etc, but $product_id does not work.   The $product_flypage is the variable that builds the link for the product detail page - so I know the ID is within that $product_flypage variable, but I need it isolated.

I can access the ID from the URL after I view the product detail page by using a GET command. For example - http://lovemyself.com.au/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=48&category_id=6&option=com_virtuemart&&Itemid=63  (the product_id is 6).  But that method obvioulsy doesn't work back on the browse page.

Any help would be greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of Adam Chan
Adam Chan
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of webstudiointeractive
webstudiointeractive

ASKER

Hi addamez.  Thanks for that.  Yes I'm aware of the iframe, and that the product_id is in the hyperlink.  How would I extract the product ID from a hyperlink using PHP?  That would work...

Obviously I can't use the GET command, as this is a hyperlink within the body of the site.  Is there a PHP method to trim the link so that I'm left with the ID?  For example, it returns everything after "product_id=" and everything before the next ampersand "&" ?

Worked it out by using the following code. I'm sure there's a simpler way to do it with PHP but this worked so I'll run with that!
<? $var1 = explode("&", $product_flypage); $var2 = explode("=", $var1[2]); echo $var2[1]; ?>

Open in new window