Hi all,
I use Joomla 3.4 and VM 3.0.9 , I want get all products, i did used :
$model = VmModel::getModel('product');
$products = $model->getProductListing();
But it just get 24 product, please help me.
Thank you so much !
VERSIONS?
As written many times, to display all in the FE you can just use use index.php?option=com_virtuemart&view=category&virtuemart_category_id=0 and make a template override if you want to change the layout of that page.
Hi jenkinhill,
I used VM 3.0.9, i'm coding for plugin, not template, so i want get the all products to display.
Thank you !
Some one help me? :(
See http://forum.virtuemart.net/index.php?topic=104795.0
Hi all,
I think VM team and many people have the ability to help me. But they not have goodness.
Thanks
if u bothered to find and look at the function you would see->
public function getProductListing ($group = FALSE, $nbrReturnProducts = FALSE, $withCalc = TRUE, $onlyPublished = TRUE, $single = FALSE, $filterCategory = TRUE, $category_id = 0) {
later
if($nbrReturnProducts){
$limitStart = 0;
$limit = $nbrReturnProducts;
$this->_withCount = false;
} else if($this->_noLimit){
$this->_withCount = false;
$limitStart = 0;
$limit = 0;
} else {
$limits = $this->setPaginationLimits();
$limitStart = $limits[0];
$limit = $limits[1];
}
Hi I confirm the problem. I'm also calling the function this way:
$products = $productModel->getProductListing($group = FALSE, $nbrReturnProducts = FALSE, $withCalc = TRUE, $onlyPublished = TRUE, $single = FALSE, $filterCategory = FALSE, $category_id = 0);
I get exactly 24 products. If I set $nbrReturnProducts to 1000, I get 59 products.
Could we please have more information on how to get ALL products with this function?
Thanks a lot
if you have no number set it returns what you have set in the admin pagination limits
$limits = $this->setPaginationLimits();
I have no idea why 1000 gives you 59 .. you need to follow thru the function to see why
You can inherit from the product Class.
If you have to many problem to use exactly original, then Do your custom Model to get products and override What you need .
baoquocmt159, I think you are a developper, is this so complex to do ?
Quote from: Studio 42 on April 02, 2016, 00:58:58 AM
You can inherit from the product Class.
If you have to many problem to use exactly original, then Do your custom Model to get products and override What you need .
baoquocmt159, I think you are a developper, is this so complex to do ?
Hi,
I have solved it :)
Thanks
Hello, could we please know how this has been solved?
by the way, the example i've posted above uses the inherited category model. Whatever I do with the function, I get about 40% to 60% of the products. Here is my code again, there is nothing else:
$this->productModel = VmModel::getModel('Product');
$products = $this->productModel->getProductListing($group = FALSE, $nbrReturnProducts = 5000, $withCalc = TRUE, $onlyPublished = TRUE, $single = FALSE, $filterCategory = 0, $category_id = NULL);
This gives me 24 products on 86 in the first shop, 701 products on 1738 in the second shop.
Is it maybe because of a pagination system? How are we supposed to set the limits in an inherited custom model?
Check some articles about it.
Eg. http://www.elated.com/articles/object-oriented-php-working-with-inheritance/