I'd actually recommend that since commenting out that portion of code pretty much makes it useless and the following resolves the reported issue to change admin/featured.php line 354: https://github.com/zencart/zencart/b...tured.php#L354
From:
To:
As this section of code only executes when either on page 1 (as declared by the link) or "effectively" on page 1 (because no page has been provided), when the code that was commented out is executed, now it will provide stay on page 1 when the last item in the list is at issue, this also resolves a similar problem where either the fID is "known" but the page is not (portion of the issue being addressed by this part of the code) then the calculation will also ensure that the correct page is used.
Here was the test I did:
Default/demo store
Set configuration->maximum Values->Featured Products - Number to Display Admin to 4
(Why? because I wanted to be sure that I had at least 3 pages against which to test as attempting a page number greater than the maximum number of pages causes the current page to become the last one available)
I then went to the featured products area which resulted in 3 pages with 4 product on each of the first two and 2 product on the last.
I clicked on the last product of the first page, it effectively showed me page 2 product data, but the browser link still had page 1 related items, in this case:
index.php?cmd=featured&page=1&fID=3
BUT, as noted, the "page=2" type data appears with no right sidebox.
Now, the "missing page" condition, if take note of the last item on that list, it has an fID of 9. So, first click on that line and the browser link changes to:
index.php?cmd=featured&page=2&fID=9
And no issues, right?
Well, now remove the 2 from page= so that reads:
index.php?cmd=featured&page=&fID=9
And again, the wrong (next) page of data appears (bottom says 3 of 3) and again a blank right side.
Further test (identifying another unfortunate modification in this area) is that if the page parameter is completely removed:
index.php?cmd=featured&fID=9
Now the result is page 1 (note 1 of 3 at the bottom) and again a blank right side... This last part is further a change/difference applied to the recent code change in this area and necessitates changing (restoring?) line 350: https://github.com/zencart/zencart/b...tured.php#L350
From:
Code:
if ((isset($_GET['page']) && ($_GET['page'] == '1' || $_GET['page'] == '')) && isset($_GET['fID']) && $_GET['fID'] != '') {
to:
Code:
if ((empty($_GET['page']) || $_GET['page'] == '1') && !empty($_GET['fID'])) {
An idea is that one should be able to direct/redirect to the featured (and specials) pages without having to know on what page a product is listed/identified and the user should be shown the item in the list at the correct page...
Now if the provided fID doesn't exist, what ends up happening is that the last page is shown. Is that best? Ehh.. It's something... Probably would be better to give some sort of admin message indicating the absence of that fID value, but...
At least this way (the two changes above), one arrive at the correct page for an fID when either the page is blank, 1, or missing from the link. It might be even a little better to "always" do a "page check" so that the likes of: index.php?cmd=featured&page=3&fID=8 would show the correct page even though page 3 was attempted...
Bookmarks