VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Sturmhorst on December 10, 2020, 19:13:54 PM

Title: Add Trackingparameter to related Products
Post by: Sturmhorst on December 10, 2020, 19:13:54 PM
Hello everyone,
For tracking purposes I would like to add the name of the referencing product to the related products url. How can I access the data of the parent element within related.php?

Thank you in advance.

Joomla 3.9.21, VM 3.6.10
Title: Re: Add Trackingparameter to related Products
Post by: GJC Web Design on December 10, 2020, 22:53:10 PM
$jinput = JFactory::getApplication()->input;
$virtuemart_product_id = $jinput->get('virtuemart_product_id');
$pM = VmModel->getModel('Product');
$ref_product = $pM::getProductSingle ($virtuemart_product_id, true,1,false,'', true, true);
echo $ref_product->product_name;

not tested
Title: Re: Add Trackingparameter to related Products
Post by: Sturmhorst on December 11, 2020, 09:29:07 AM
Great, it worked. Because the 'getProductSingle' method is not static, I had to make the following adjustment:
Instead of '$pM::getProductSingle' i used '$pM->getProductSingle'
Title: Re: Add Trackingparameter to related Products
Post by: GJC Web Design on December 11, 2020, 10:59:30 AM
ah yes --- edited