VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Nicola1008 on May 19, 2017, 11:28:25 AM

Title: [SOLVED] How to detect Virtuemart Product Page
Post by: Nicola1008 on May 19, 2017, 11:28:25 AM
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
Title: Re: How to detect Virtuemart Product Page
Post by: 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.
Title: Re: How to detect Virtuemart Product Page
Post by: Nicola1008 on May 19, 2017, 13:43:10 PM
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
Title: Re: How to detect Virtuemart Product Page
Post by: 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
}
?>
Title: Re: How to detect Virtuemart Product Page
Post by: Nicola1008 on May 19, 2017, 14:53:43 PM
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!!!!!!!!!!!!!!  ;) ;) ;) ;)
Title: Re: How to detect Virtuemart Product Page
Post by: rsangros on July 01, 2020, 23:41:53 PM
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.
Title: Re: [SOLVED] How to detect Virtuemart Product Page
Post by: pinochico on July 02, 2020, 00:02:45 AM
QuoteI need to inject code within this productdetails page from outside

Which code?