VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: hazael on May 05, 2023, 14:40:31 PM

Title: Problem with pagination and sorting [vm 4.0.20]
Post by: hazael on May 05, 2023, 14:40:31 PM
The new version of Virtuemart 4.0.20 is written with errors - probably the sorting and pagination is incompatible with the Joomla 4 standard.
Pagination works only in the base version of Joomla 4. External plugins like 4SEF stopped working normally with this.
Pagination links are generated normally, but there is no way to go to the next category page.

temporary solution:
administrator/components/com_virtuemart/models/product.php
after:
$limitStart = vRequest::getInt ('limitstart', 0,'GET');
add:
$limitStart = $app->input->getInt('limitstart');
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: Roderic on May 10, 2023, 11:12:06 AM
I can confirm adding this line, also makes the pagination working again in Joomla 3. So not an Joomla 4 only issue.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: sandomatyas on June 06, 2023, 14:12:16 PM
Same with VM 4.0.22  :-\
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: MAD King on June 17, 2023, 20:27:18 PM
Same here.
VirtueMart 4.0.22 10864 and Joomla! 3.10.11.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: MAD King on June 17, 2023, 20:33:55 PM
Quote from: hazael on May 05, 2023, 14:40:31 PM

temporary solution:
administrator/components/com_virtuemart/models/product.php
after:
$limitStart = vRequest::getInt ('limitstart', 0,'GET');
add:
$limitStart = $app->input->getInt('limitstart');


Thank you.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: Roderic on June 28, 2023, 10:53:42 AM
Quote from: hazael on May 05, 2023, 14:40:31 PM
temporary solution:
administrator/components/com_virtuemart/models/product.php
after:
$limitStart = vRequest::getInt ('limitstart', 0,'GET');
add:
$limitStart = $app->input->getInt('limitstart');

It would be nice, if this fix gets added to the core.

Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: MAD King on August 20, 2023, 15:06:21 PM
This thread needs to be pinned for non working pagination solution. Thanks to hazael it is working again.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: Milbo on August 21, 2023, 20:48:24 PM
Quote from: hazael on May 05, 2023, 14:40:31 PM
temporary solution:
administrator/components/com_virtuemart/models/product.php
after:
$limitStart = vRequest::getInt ('limitstart', 0,'GET');
add:
$limitStart = $app->input->getInt('limitstart');

Hmm, the GET as third parameter, says where to get the info. What happens, if you remove it? If you use

$limitStart = vRequest::getInt ('limitstart', 0);

Does it work then? vRequest::getInt ('limitstart', 0,'POST'); would be for POST.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: MAD King on August 21, 2023, 21:18:02 PM
Quote from: Milbo on August 21, 2023, 20:48:24 PM
Quote from: hazael on May 05, 2023, 14:40:31 PM
temporary solution:
administrator/components/com_virtuemart/models/product.php
after:
$limitStart = vRequest::getInt ('limitstart', 0,'GET');
add:
$limitStart = $app->input->getInt('limitstart');

Hmm, the GET as third parameter, says where to get the info. What happens, if you remove it? If you use

$limitStart = vRequest::getInt ('limitstart', 0);

Does it work then? vRequest::getInt ('limitstart', 0,'POST'); would be for POST.

I do not know. I used hazael's fix and it worked on J4.3.3 and VirtueMart 4.2.0 10905
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: hazael on September 13, 2023, 11:09:45 AM
Today I installed the latest version 4.2.2 10908 - why is this important fix still missing? Why are we ignored? It's just a stupid piece of code
The proposed POST option does not work. This component still does not work as it should.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: Kuubs on September 13, 2023, 11:28:04 AM
Quote from: hazael on September 13, 2023, 11:09:45 AM
Today I installed the latest version 4.2.2 10908 - why is this important fix still missing? Why are we ignored? It's just a stupid piece of code
The proposed POST option does not work. This component still does not work as it should.

I also have this issue! Fixed it by using the solution defined above!
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: sandomatyas on October 11, 2023, 19:41:32 PM
Same with Joomla! 3.10.12  + VirtueMart 4.2.4 10922 :(
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: macigatto on October 16, 2023, 15:37:26 PM
hello, is there a solution?
I have upgrade to last version of virtuemart 4.2.2 in Joomlaz 3 and pagination is not working.

what I have to do?

thanks
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: ksfbjoern on March 08, 2024, 13:12:18 PM
Had the same problem today with Virtuemart 4.2.4

Hazael's solution fixed it so far. It would be nice, if this would be fixed in a future version.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: yaniv1 on March 27, 2024, 14:24:51 PM
When I removed the third parameter 'GET', it resolved the issue.

$limitStart = vRequest::getInt ('limitstart', 0);
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: T.A. Garrison, LLC on November 25, 2024, 23:59:10 PM
Something has definitely changed in VM 4.4.1 11099 along with Joomla 5.2.1

I tried the original code from Hazael as well as the remove 'GET' as mentioned by yaniv1, and neither of the options worked.

Obviously there is still something conflicting - or ?? - somewhere. But it's not working for me.
Title: Re: Problem with pagination and sorting [vm 4.0.20]
Post by: hazael on February 25, 2025, 06:05:38 AM
This code will not work properly - SEF Links will be generated incorrectly.
echo $this->vmPagination->getPagesLinks();

This variable when calling for the first time, it generates incorrect pagination links. However, calling it a second time fixes the issue.

Cause:
VirtueMart dynamically generates pagination data on the first call, meaning the links may not be fully initialized until after the first execution.

Solution:
To ensure correct pagination links, store the result in a variable before using it.

In you template: /com_virtuemart/category/default.php

This solution will work correctly - the SEF links will generate correctly
$this->vmPagination->getPagesLinks(); // Trigger pagination generation
$pagination = $this->vmPagination->getPagesLinks(); // Retrieve correct links
echo $pagination;