News:

Looking for documentation? Take a look on our wiki

Main Menu

Accessing image URLs in related products

Started by EvanGR, September 12, 2019, 15:36:26 PM

Previous topic - Next topic

EvanGR

How do I access the image URLs (full image and thumbnail), in the template?

In the commercial template I am tweaking, there's a related.php file in sublayouts folder;
A related product is defined in there. But it gets the data like so:

$related = $viewData['related'];
$customfield = $viewData['customfield'];
$thumb = $viewData['thumb'];


The $thumb variable holds the full img element, I just want the URLs.

(I will also need to extract other product data, so please point me to a resource or documentation if there is any)

Thanks!

Milbo

just enable the virtuemart debug and add
vmdebug('my viewData here',$viewData)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

EvanGR

Quote from: Milbo on September 12, 2019, 15:42:41 PM
just enable the virtuemart debug...

For the sake of clarity, are you referring to the debug checkboxes in Shop->Advanced Settings?

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

PRO


EvanGR

Trying to get the URLs for a product's images and thumbnails.

In an older VM e-shop I could use the $product object and find the data.

This newer template uses 'sublayouts', and it's not clear to me how to reference the product's data.


GJC Web Design

If the full urls are not passed thru the $viewData object then u don't have to use the sublayout in your template

You can just use the code as u did before ( directly using the $product)  - but chk first if the urls are in the $viewData
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

EvanGR

Thanks,

The sublayout is already used because it's a 3rd party template. So I am starting from there.