Hello
I have J4.3.4, VM 4.2.0 10905, PHP 8.0
I need to get list of products by category. I try to use code but have no sucess:
$productModel = VmModel::getModel('product');
$ids = $productModel->getProductsListing (FALSE,FALSE,TRUE,TRUE,FALSE,TRUE,$category->virtuemart_category_id,FALSE,0,0);
if($ids) {echo 'exist'; } else { echo 'nothing';}
foreach ($ids as $product_id) {
// $product = $productModel->getProduct($product_id,true);
echo $product->product_name;
}
I have error "Illegal offset type" on line $product = $productModel->getProduct($product_id,true);
and debug:
1 () JROOT/administrator/components/com_virtuemart/models/product.php:1168
2 VirtueMartModelProduct::checkIfCached() JROOT/administrator/components/com_virtuemart/models/product.php:1251
cartegory id gets rightly and if($ids) shows "exist" but i can'n get names of products. I rtyed to use other $productModel-> but also have no sucess.
Please, help me to find what I do wrong.