Back from product view jumps allways on pagination page 1

Phoca Cart - complex e-commerce extension
oesch.web@gmail.com
Phoca Member
Phoca Member
Posts: 25
Joined: 06 Jan 2020, 11:35

Back from product view jumps allways on pagination page 1

Post 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.

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post 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
If you find Phoca extensions useful, please support the project
Post Reply