Solved

Virtuemart get product_id

Posted on 2009-07-12
3
2,317 Views
Last Modified: 2012-06-21
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!
0
Comment
Question by:webstudiointeractive
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Adam Chan earned 500 total points
Comment Utility
Greetings,

I'm not entirely sure if this is what you're looking for but from a preliminary look at the source code of the page shows that the actual listing of the products in the browse page is within an iframe:

<div class="contentpane">
<iframe       id="blockrandom"
...
src="http://lovemyself.com.au/index.php?option=com_virtuemart&Itemid=62&category_id=6&page=shop.browse&limitstart=0&limit=500"
...


There are the links/images of each product, and you can extract the product_id from the hyperlink.

Cheers
0
 

Author Comment

by:webstudiointeractive
Comment Utility
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 "&" ?

0
 

Author Comment

by:webstudiointeractive
Comment Utility
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

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
First of all, we will need Jumi component or Sourcerer plugin for this to work. We need either of these because the main focus here is custom development outside of the standard modules or articles within Joomla. You can find Jumi here...it's my …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now