Page 1 of 1

Back from product view jumps allways on pagination page 1

Posted: 06 Dec 2023, 17:48
by oesch.web@gmail.com
I am very satisfied of phocacart.
There is one point I wish for next releases:
The jump back from product view to category view should remember the last visited pagination number.
Somthing like the following snippets:

When generating your pagination links, ensure that the current page number is included in the URL:
php
Copy code
// Assuming $currentPage holds the current page number
echo '<a href="products.php?page=' . $currentPage . '">Next</a>';
In your PHP code that handles displaying the products, retrieve the page number from the URL parameters:
php
Copy code
// Retrieve the page number from the URL parameter
$page = isset($_GET['page']) ? $_GET['page'] : 1; // Default to page 1 if 'page' parameter is not set

// Use the $page variable in your logic to display products for the specified page
// Your code to fetch and display products based on the $page variable
By including the current page number in the URL as a parameter and then retrieving that parameter when needed, you can maintain the page state when going back from the detailed product view to the paginated product view.

Re: Back from product view jumps allways on pagination page 1

Posted: 07 Dec 2023, 18:31
by Jan
Hi, thank yor your idea. Yes, it is not so easy, as the pagination is not Phoca Cart feature but Joomla feature.

Added to feature request list:
https://github.com/PhocaCz/PhocaCart/issues/188

Jan