Hi
I want to write an API to get the products and use product model in admin/component/com_virtuemart/models/product.php. There are some functions to get the products, like(getProductsInCategory, getProducts & getProductsListing)
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductsInCategory($catId);
When I execute the above code return all products. I need to receive limited number of products in per request (ex. limit 20,10 in DB query) same as pagination in product listing page.
which function can I use for this purpose?
$productModel = VmModel::getModel('Product');
$products = $productModel->getProductListing($group, $nbrReturnProducts, $withCalc, $onlyPublished, $single, $filterCategory, $category_id, $filterManufacturer, $manufacturer_id);
getProductListing function just return max number ($nbrReturnProducts) of products
ex.
there are 100 produts in #__virtuemart_products .
I need 20 products from id 60 to 80
$productModel = VmModel::getModel('Product');
$nbrReturnProducts = 20;
$products = $productModel->getProductListing($group, $nbrReturnProducts, $withCalc, $onlyPublished, $single, $filterCategory, $category_id, $filterManufacturer, $manufacturer_id);
but this code returns products from id 1 to 20.
then u will need to overload the function or write your own - pagination is interactive - you need to know what you already displayed/accessed