Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Virtuemart get product_id

Posted on 2009-07-12
3
Medium Priority
?
2,432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Adam Chan earned 1500 total points
ID: 24837136
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
ID: 24837174
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
ID: 24837336
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

670 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