News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How I get product image thumb by produt ID?

Started by moonaway, November 22, 2014, 13:01:36 PM

Previous topic - Next topic

moonaway

Hi!
I make 'Review Module' for VM3 (VM2.6+), but have some trouble with get image of CHILD product who do not have the image (because the image is at the parent product).

Now I use the code:

$product = $productModel->getProductSingle($item->virtuemart_product_id);
$productModel->addImages($product,1);

....then....

echo $product->images[0]->file_url_thumb;

But it's don't work for child products...  If I use 'getProduct' instead of 'getProductSingle' then everything will works, but I want to find a solution which will be better for performance...

Perhaps it is necessary to correct the function "getProductSingle" ??

PS: I'm ready to share the module with all those who help solve the problem
VM3.0.0 testing: http://store.c-site.ru/

Milbo

You should just not use getProductSingle, use getProduct.
getProductSingle loads exactly one Product, no Parents and similar.  that means if you load a child with getProductSingle, you get an almost empty Product.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/