VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: PostHistorie.nl on November 20, 2019, 14:52:37 PM

Title: Show file_url in Products admin view
Post by: PostHistorie.nl on November 20, 2019, 14:52:37 PM
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
Title: Re: Show file_url in Products admin view
Post by: GJC Web Design on November 20, 2019, 15:11:37 PM
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
Title: Re: Show file_url in Products admin view
Post by: PostHistorie.nl on November 20, 2019, 16:05:41 PM
Nice!
This seems to do the trick:

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

Title: Re: Show file_url in Products admin view
Post by: PostHistorie.nl on June 02, 2023, 18:46:32 PM
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;
                        }
Title: Re: Show file_url in Products admin view
Post by: GJC Web Design on June 03, 2023, 17:27:58 PM
I assume it depends on the number of products displayed .. after I think 30 the images are not attached to the object