News:

Looking for documentation? Take a look on our wiki

Main Menu

Add Trackingparameter to related Products

Started by Sturmhorst, December 10, 2020, 19:13:54 PM

Previous topic - Next topic

Sturmhorst

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

GJC Web Design

#1
$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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Sturmhorst

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'

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation