News:

Support the VirtueMart project and become a member

Main Menu

Show file_url in Products admin view

Started by PostHistorie.nl, November 20, 2019, 14:52:37 PM

Previous topic - Next topic

PostHistorie.nl

I have several fields I do not use in the Products Admin page (see attachment) like "Product is Children of" and "Manufacturers".

Would it be possible to display the "file_url" (the database field from xxxxx_virtuemart_medias table) there instead?

Joomla 3.9.13 / VirtueMart 3.6.8 10197

GJC Web Design

is up to you .. most values are available in $this->productlist in administrator\components\com_virtuemart\views\product\tmpl\default.php

just override it in the isis template and display what u need
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

PostHistorie.nl

Nice!
This seems to do the trick:

if (!empty($product->images)) {
                        $image = $product->images[0];
                        echo $image->file_url;
                        }


PostHistorie.nl

For some reason this didn't seem to work anymore after an upgrade to Joomla 4.
But the code I provided in 2019 (the post above) is not complete, this took me a while to figure out (again!).

So for future reference and anyone else who needs this, this is the correct code:


        $this->model->addImages($product,1);
                 if (!empty($product->images)) {
                        $image = $product->images[0];
                        echo $image->file_url;
                        }

GJC Web Design

I assume it depends on the number of products displayed .. after I think 30 the images are not attached to the object
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