VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Studio 42 on October 18, 2017, 15:49:24 PM

Title: Pagination broken in category 0(root)
Post by: Studio 42 on October 18, 2017, 15:49:24 PM
HI,
I use a test site with VM 3.2.4 and pagination is really strange in the home page.
Each page the pagination is multiplied *2
eg when you go in this page http://pro.st42.fr
pagination for page
2 : http://pro.st42.fr/results,25-48
3 : http://pro.st42.fr/results,49-96
...
99: http://pro.st42.fr/results,2353-4704
Yes 2353-4704 for last page 99!
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on October 18, 2017, 15:56:00 PM
Quote from: Studio 42 on October 18, 2017, 15:49:24 PM
HI,
I use a test site with VM 3.2.4 and pagination is really strange in the home page.
Each page the pagination is multiplied *2
eg when you go in this page http://pro.st42.fr
pagination for page
2 : http://pro.st42.fr/results,25-48
3 : http://pro.st42.fr/results,49-96
...
99: http://pro.st42.fr/results,2353-4704
Yes 2353-4704 for last page 99!
I checked exactly and pagination have pagination+ pagination eg 24(25-48) then 48 (49-96),72(73-144),96...
Title: Re: Pagination broken in category 0(root)
Post by: ermes on November 02, 2017, 12:53:19 PM
I have same problem. There isn't a fix yet?
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on November 02, 2017, 13:54:47 PM
You need to set same pagination in menu link and in Virtuemart default config for pagination and it should work
Title: Re: Pagination broken in category 0(root)
Post by: ermes on November 02, 2017, 15:39:10 PM
Sorry can you send me a screen?
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on November 02, 2017, 18:46:17 PM
It not work better. I tried all settings
So it's a bug.
Title: Re: Pagination broken in category 0(root)
Post by: ermes on November 03, 2017, 10:01:01 AM
Yes, I also tried but did not work. I asked you the screen shot just to see if I put the correct parameters. Hopefully they will solve it soon!
Title: Re: Pagination broken in category 0(root)
Post by: Milbo on November 04, 2017, 00:07:42 AM
For me it looks like the max page is set in the joomla pagination to 100, so the last page shows then the remaining products.
Title: Re: Pagination broken in category 0(root)
Post by: ermes on November 06, 2017, 10:13:49 AM
And have you fixed it somehow? If yes, can you show me as?
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on November 06, 2017, 10:26:10 AM
pagination is set to 24
See page 3 it should be 48-72 and its 48-96, each new pagination is x2 excluded first page.
page 1 1-24 = 24
page 2 24-48 = 24
page 3 48-96 = 48(24+24)
page 4 73-144 = 72(24+24+24)
....
If you go to page 3 for eg. number of result is set to 72
And trying to go back to 24 do not work.

Title: Re: Pagination broken in category 0(root)
Post by: ermes on November 07, 2017, 11:13:29 AM
News?
Title: Re: Pagination broken in category 0(root)
Post by: Milbo on November 09, 2017, 10:34:07 AM
What do you set as pagination sequence? and do you have the same effect also in the Backend?
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on November 09, 2017, 12:04:39 PM
I have set all paginations to 24,admin, front ... only max items with image is set to 48
Title: Re: Pagination broken in category 0(root)
Post by: Milbo on November 09, 2017, 15:06:11 PM
I think I found it, the error was in the router


// Joomla replace before route limitstart by start but without SEF this is start !
if ( isset($query['limitstart'] ) ) {
$limitstart = (int)$query['limitstart'] ;
unset($query['limitstart']);
}
if ( isset($query['start'] ) ) {
$start = (int)$query['start'] ;
unset($query['start']);
}
if ( isset($query['limit'] ) ) {
$limit = (int)$query['limit'] ;
unset($query['limit']);
}

if ($start !== null &&  $limitstart!== null ) {
vmdebug('Pagination limits $start !== null &&  $limitstart!== null',$start,$limitstart);
//$segments[] = $helper->lang('results') .',1-'.$start ;
} else if ( $start>0 ) {
//For the urls leading to the paginated pages
// using general limit if $limit is not set
if ($limit === null) $limit= vmrouterHelper::$limit ;
$segments[] = $helper->lang('results') .','. ($start+1).'-'.($start+$limit);
} else if ($limit !== null && $limit != vmrouterHelper::$limit ) {
//for the urls of the list where the user sets the pagination size/limit
$segments[] = $helper->lang('results') .',1-'.$limit ;
}
Title: Re: Pagination broken in category 0(root)
Post by: ermes on November 16, 2017, 17:57:32 PM
So, how i can fix it?
Title: Re: Pagination broken in category 0(root)
Post by: Milbo on November 16, 2017, 20:53:53 PM
There is a release, very, very soon.
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on November 28, 2017, 02:15:10 AM
I can confirm that max code fix the bug.
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on November 28, 2017, 16:39:14 PM
Sorry, this give another BUG, you cannot return to first page.
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on December 04, 2017, 14:30:10 PM
The only way to prevent the new bug is to add in the XML /components/com_virtuemart/views/category/tmpl/default.xml
<field name="start" type="hidden" default="0" />
<field name="limitstart" type="hidden" default="0" />

inside the
<fieldset name="request" >

</fieldset>

else you cannot return to first page, because the start and limit start is empty and is set from session in the model.

But another problem stay. Any user can set the number of displayed product if this is not higher then $this->_maxItems
i changed protected $_maxItems = 24; because i only use this.
But this should be a config value, i had deny of service warnings on my demo shop, because this(i have a protection on the server to not crash server).
This can simply crash shops, so should be added urgently in Virtuemart, to have always a stable shop, in the config.

You can try for eg. http://pro.st42.fr/en/results,2353-4704, it only display 24 products
Note that because this values is used in all models, so can give some problems(category tree, childs ...) i don't really checked all the code.
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on February 25, 2018, 13:57:01 PM
Max, your fix not prevent old page bugs.
I have now a customer complaining because he have 500 Errors on google, trying to display 1-208 results.
you should force to max limit, if any limit is set over max limit.
Another problem is that i have more and more component/virtuemart/ result displayed in Google search, i had not this problem in old VM releases and this seems to come from ordering links in root.
Title: Re: Pagination broken in category 0(root)
Post by: Milbo on February 26, 2018, 11:48:04 AM
Hello Patrick, thank you for reporting.

First: I have no problem to return to page 1. Maybe I already took your fixes, or there is another problem.

Second. There is already a maxitem thing as you know from the other thread ("menu item productdetails has max 700 products"). This value can also be changed due the hidden config. $this->_maxItems = VmConfig::get ('absMaxProducts', 700);
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on February 26, 2018, 12:05:29 PM
Quote from: Milbo on February 26, 2018, 11:48:04 AM
Hello Patrick, thank you for reporting.

First: I have no problem to return to page 1. Maybe I already took your fixes, or there is another problem.

Second. There is already a maxitem thing as you know from the other thread ("menu item productdetails has max 700 products"). This value can also be changed due the hidden config. $this->_maxItems = VmConfig::get ('absMaxProducts', 700);
I think it's for all case, not only categories ? Eg. For children products
Title: Re: Pagination broken in category 0(root)
Post by: julash on April 05, 2018, 14:46:25 PM
Is updated version of this fixed published yet? We are having this problem on our website, but only on manufacturer product listing page. Manufacturer products listing showing 120 products per page when go back from a single product page. Per page products limits set is 52, I tried reducing to 24 or 12 but no luck. Going back show 120 products per page always until hard refresh.

But, it seem on this links http://pro.st42.fr/fr/fournisseur/zte and http://demo.virtuemart.net/manufacturer/default pagination is same and working fine after I go back from a product page. I updated virtuemart to 3.2.13 but problem is still there.

demo.virtuemart.net using 3.2.14, so wondering if we need to wait? Please help.

Thanks
Title: Re: Pagination broken in category 0(root)
Post by: Studio 42 on April 05, 2018, 22:15:25 PM
I internal fixed t(core hack), i dont know if it's fixed for now.
Pagination can be set by user in any category, not only in root. It should check for the pagination sequel or max pagination set in back-end to prevent it.
I dont write the code and dont set the priority, only core dev can choose to fix this for all cases.