Hello, i'm trying to edit the mail_html_question.php file and i need to insert product image/thumbnail . I figure that all fields in that file are from virtuemar_product_media table, but i need to retrieve image related to products... but those informations are in virtuemart_medias table of database.
How can i retrieve join tables to obtain file_url or file_url_thumb from table?
thanks a lot in advance and sorry for my english
Joomla 2.5.27 and VM 2.0.22d (at the moment i can't update)
you don't need to write queries - look at other VM files to see how media is returned by functions
Thanks GJC, i've looked inside form.php and the code to call the thumb is this:<?php // Product Image
echo $this->product->images[0]->displayMediaThumb('class="product-image"',false); ?>
but if i add this in mail_html_question.php i have this error: Fatal error: Call to a member function displayMediaThumb() on a non-object in /web/htdocs/www..../mail_html_question.php on line 70 . If i remove all after dispalyMedia Thumb i have no image at all in email.
I've tryed also solution posted here: http://forum.virtuemart.net/index.php?topic=115630.msg389622#msg389622
but whithout results,also changing file_url_thumb with file_url... in email i have a broken link (clicking on broken image i have only website root (http://www.orientalpets.it), but not image.
Hope you or other users may help me in this trouble. Thanks a lot.
you need to check what is available in that file - i.e product model etc
if not call it perhaps so - u need to experiment a bit
$productModel = VmModel::getModel('Product');
$productModel->addImages($this->product);
Sorry GJC, but i don't understand... i have to insert the code you posted in mail_html_question.php? so in that case i have to replace
<a href="<?php echo $product_link ?>"><img src="<?php echo JURI::root() . $this->product->images[0]->file_url; ?>" />
</a>
with:
$productModel = VmModel::getModel('Product');
$productModel->addImages($this->product);
<a href="<?php echo $product_link ?>"><img src="<?php echo JURI::root() . $productModel->addImages($this->product); ?>" />
</a>
?
Please, i'm not an addict to programming, so be patient. thanks
I really don't know - I haven't ever worked on that file - that is for u to do - look at other vm files to see how its done
the fatal error means the $this->product->images isn't there - you need to get it into your file by probably importing the model and running addImages()
But you have to experiment - might be enough just to run addImages()
then it may be $this->product->images[0]->file_url