How to get product details in the catalogue module?
I have a code in the overriden mod_virtuemart_category:
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductListing(false, false, true, true, true, true, $category->virtuemart_category_id, false, 0);
............
<?php foreach($products as $product) { ?>
<?php
if (!empty($product->images[0])) {
$image = $product->images[0]->displayMediaThumb ('class="featuredProductImage"', FALSE);
} else {
$image = '';
}
echo JHTML::_ ('link', JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id), $image, array('title' => $product->product_name));
?>
<?php } ?>
But the image is not shown. The same situation is with the price:
<?php if ($show_price) {
if (!empty($product->prices['salesPrice'])) {
echo $currency->createPriceDiv ('salesPrice', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
}
if (!empty($product->prices['salesPriceWithDiscount'])) {
echo $currency->createPriceDiv ('salesPriceWithDiscount', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
}
}
?>
The same time code <?php echo $product->product_name ?> outputs product's name. Prices and images are assigned for the product. In the overriden module mod_virtuemart_product this code works just fine.
UPD The print_r($product) shows that there are no fields images[] and prices[] in overridden mod_virtuemart_category. But in the overridden mod_virtuemart_product those fields exist.