News:

Support the VirtueMart project and become a member

Main Menu

How to add a variable on the product page?

Started by naeska, May 08, 2016, 10:50:15 AM

Previous topic - Next topic

naeska

Hello.
There is a multivendor shop Virtuemart 3.0.16. It is necessary to display the name of shop of the seller on the product page. However there is no such variable on this page, only virtuemart_vendor_id, and vendor_store_name is necessary. Prompt how to add this variable on the page. I have understood that it must be done in the file:
components/com_virtuemart/views/productdetails/view.html.php
But here where there and as I can't make it to understand.
Thanks.

VirtueMart v3.0.16
Joomla v3.5.1
PHP v5.3.29

GJC Web Design

no - over ride  components/com_virtuemart/views/productdetails/tmp/default.php

if the vendor name isn't in the object then use the vendor_id and a small DB query snippet to get the name from #__virtuemart_vendors
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

naeska

Please, tell me how did a small DB query snippet to get the name from #__virtuemart_vendors?

GJC Web Design

well.. google would be faster than posting here.. but anyway

something like

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('vendor_name'));
$query->from($db->quoteName('#__virtuemart_vendors'));
$query->where($db->quoteName('virtuemart_vendor_id') . ' = '. $db->quote($this->virtuemart_vendor_id'));

$db->setQuery($query);

$vendor_name = $db->loadResult();
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