News:

Support the VirtueMart project and become a member

Main Menu

[SOLVED] How to detect Virtuemart Product Page

Started by Nicola1008, May 19, 2017, 11:28:25 AM

Previous topic - Next topic

Nicola1008

Hi,

is there a way to detect in a PHP page if I'm in a product virtuemart page? Can anyone help me?

Joomla version: 3.7.1
Virtuemart version: 3.0.6.2

jenkinhill

Quote from: Nicola1008 on May 19, 2017, 11:28:25 AM
Joomla version: 3.7.1
Virtuemart version: 3.0.6.2

http://virtuemart.net/news/latest-news/480-security-release-of-joomla-3-7-be-prepared

VM3.0.6.2 is more than two years old now, and is known to be insecure. As in the news item above, VM versions before 3.2.2 do not work correctly with J3.7.x
Be sure to test the update on a backup copy of your site as there are templating changes in versions since then, and many more configuration options.  Once you have current templates somebody may be able to advise on your page detect issue.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Nicola1008

Quote from: jenkinhill on May 19, 2017, 13:15:24 PM
Quote from: Nicola1008 on May 19, 2017, 11:28:25 AM
Joomla version: 3.7.1
Virtuemart version: 3.0.6.2

http://virtuemart.net/news/latest-news/480-security-release-of-joomla-3-7-be-prepared

VM3.0.6.2 is more than two years old now, and is known to be insecure. As in the news item above, VM versions before 3.2.2 do not work correctly with J3.7.x
Be sure to test the update on a backup copy of your site as there are templating changes in versions since then, and many more configuration options.  Once you have current templates somebody may be able to advise on your page detect issue.

All works correctly in my site. I only want to check with PHP if the user is in a virtuemart page or not

Jumbo!

<?php
$app   
JFactory::getApplication();
$input $app->input;

if(
$input->getCmd('option') == 'com_virtuemart' && $input->getCmd('view') == 'productdetails')
{
// You are in VirtueMart's Product Details page
// Do whatever you want
}
?>

Nicola1008

Quote from: Jumbo! on May 19, 2017, 14:35:24 PM
<?php
$app   
JFactory::getApplication();
$input $app->input;

if(
$input->getCmd('option') == 'com_virtuemart' && $input->getCmd('view') == 'productdetails')
{
// You are in VirtueMart's Product Details page
// Do whatever you want
}
?>


THANK YOU SO MUCH!!!!!!!!!!!!!!  ;) ;) ;) ;)

rsangros

#5
Quote from: Jumbo! on May 19, 2017, 14:35:24 PM
<?php
$app   
JFactory::getApplication();
$input $app->input;

if(
$input->getCmd('option') == 'com_virtuemart' && $input->getCmd('view') == 'productdetails')
{
// You are in VirtueMart's Product Details page
// Do whatever you want
}
?>


Hi all,

Knowing that we are within a product details page, is there any way to pick certain values from the product? I need to inject code within this productdetails page from outside, the point is to retreive product name and product price in order to make this inject posible. Is this posible?

Once we know we are in this product details page, how can I get product data?

Thanks.

pinochico

QuoteI need to inject code within this productdetails page from outside

Which code?
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products