News:

Support the VirtueMart project and become a member

Main Menu

How pagination limits products

Started by Novi4ok, May 18, 2016, 16:00:13 PM

Previous topic - Next topic

Novi4ok

Hello, can you help me, please.

How pagination in category works:

- System gets all products from DB and ather this sets show per page limit?

or:

- System gets products using limit in sql query?


i'm using own product sorting, so i need to replace $this->products array, i have no problems to do it in category template, when pagination is disabled. But when i'm using pagination, i can't get all products array, it shows array with limit. (for example when i set 10 products per page, products array contains 10 products).

Is it possible to get full category products array, replace it and only ather this allow system to show products from this array with pagination.

as i understood, this function are in files:

administrator/components/com_virtuemart/models/product.php
administrator/components/com_virtuemart/helpers/vmmodel.php

but i still can't find answers to my questions.

Thanks.

P.s. joomla 2.5 + VM  2.0.16c






jenkinhill

Quote from: Novi4ok on May 18, 2016, 16:00:13 PM

P.s. joomla 2.5 + VM  2.0.16c


See http://forum.virtuemart.net/index.php?topic=118683.0

That VM version is over 3 years old, what you want to do may be possible but hardly anybody is going to have such an old version to test with.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Novi4ok

Hello, jenkinhill. Thank you for reply, i will try to update to 2.6.22

So, if it is possible, answer to my questions, please

thank you

GJC Web Design

the var is $nbrReturnProducts and this is set in the vmmodel.php around line 800

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];
}
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Novi4ok

#4
Quote from: GJC Web Design on May 19, 2016, 12:09:07 PM
the var is $nbrReturnProducts and this is set in the vmmodel.php around line 800

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];
}


Thank you.
Yes i saw this function, but it just sets pagination limits, so if i "remove limits" pagination will be removed from category page. I can't understand how this will help me to get all category prudcuts array without removing pagination (in details in first post of thread)

Or i'm not correct?


Studio 42

Hi,
Do a child class  and force $this->_noLimit in your child class
eg
class customModelProduct extends VirtueMartModelProduct {
....
// overide exeSortSearchListQuery class
public function exeSortSearchListQuery($object, $select, $joinedTables, $whereString = '', $groupBy = '', $orderBy = '', $filter_order_Dir = '', $nbrReturnProducts = false ){
$this->_noLimit = true;
return parent::exeSortSearchListQuery($object, $select, $joinedTables, $whereString , $groupBy ', $orderBy , $filter_order_Dir, $nbrReturnProducts);
}


This is a sample, perhaps you need to adjust it.
Grrets,
Patrick