Hello,
I want. to display the child products images in a certain way. I have this code, but it doesn't get the images attached to the product:
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductChildIds( $product->virtuemart_product_id);
foreach ($products as $key => $value) {
$childprod = $productModel->getProduct($value);
}
But there isn't anything regarind images in this object. Does anyone know ho I get the image of this certain product?
Fixed it.
Needed to add
$productModel->addImages($childprod,1);
hey hubbs can you post your full fixed code?
Quote from: beltoforion on April 02, 2020, 20:02:58 PM
hey hubbs can you post your full fixed code?
Yeah sure:
<?php
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductChildIds( $product->virtuemart_product_id);
foreach ($products as $key => $value) {
$childprod = $productModel->getProduct($value);
$productModel->addImages($childprod,1);
}
?>
Let me know if this works for you!