Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Jun 2009
    Location
    Sparta, TN
    Posts
    158
    Plugin Contributions
    0

    Default Featured Products - choosing/deleting of 10th item on first page error / bug?

    1.5.7c, clone-a-template (responsive) , display logs, SiteMapXML.

    While doing some clean up of featured products, I found I cannot choose "delete" or "information" on the tenth (10th) item on the first page. Selecting edit works fine, but choosing to delete or information results in a skip to page 2 (and no ID# product chosen on page 2). The tenth item on my second and third pages work fine.

    I checked my logs for errors and found none.
    My store - closed 12/05/2023
    1.5.7d (upgraded from 1.5.7b), clone a template (cloned Responsive Classic Template), Sitemap XML v4.0, Square WebPay, PayPal Express Checkout, PHP Version: 7.4.29 (Zend: 3.4.0)

  2. #2
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,739
    Plugin Contributions
    0

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    I can confirm this behavior. In a test 1.5.7c, I made sure that I had more than 10 feature products. I tried to select the row for the one at the bottom of the list (#10) and was sent to page 2 of the featured products. the same happens if you try to click on the delete icon or the info icon. if you click on the edit icon you will get the edit page for that product to adjust the dates.

    I also adjusted the maximum number of featured products to show on that page to 9 and test and get the same behavior it doesn't matter how many are in the list, whichever one is last on page 1 you can not select it, it instead treats it as if you click the next text link in the row below
    Mike
    GeekHost - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  3. #3
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,739
    Plugin Contributions
    0

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    Update, the same behavior happens on the specials page
    Mike
    GeekHost - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  4. #4
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    This problem does not occur on ZC158, but that is not much help as the files are very different to compare and I don't find a PR that addressed this issue specifically.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    11

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    who loves ya?

    one needs to comment out line 361:

    https://github.com/zencart/zencart/b...tured.php#L361

    PHP Code:
    //from
                                
    $_GET['page'] = round((($check_count MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) + (fmod_round($check_countMAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) !== .5 0)));

    //to
    //                             $_GET['page'] = round((($check_count / MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) + (fmod_round($check_count, MAX_DISPLAY_SEARCH_RESULTS_FEATURED_ADMIN) !== 0 ? .5 : 0))); 
    same thing in specials.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,739
    Plugin Contributions
    0

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    in the specials.php file it is line 435 that needs to be comment out
    Mike
    GeekHost - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  7. #7
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    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:
    Code:
                                $check_count = 1;
    To:
    Code:
                                $check_count = 0;
    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...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,669
    Plugin Contributions
    11

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    @mc12345678

    finding where the error is, in my experience, is most times harder than recommending a solution.

    i am not sure what code base we live in where modifying a GET var for a page number is ever a good idea.

    while i have no doubt your solution works (i have not tested), other than sanitizing the GET vars, modifying a GET var is, to me, bad coding and makes for a maintenance nightmare.

    just my 2 cents.

    people can feel free to do whatever they want to their code....
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #9
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    Quote Originally Posted by carlwhat View Post
    @mc12345678

    finding where the error is, in my experience, is most times harder than recommending a solution.

    i am not sure what code base we live in where modifying a GET var for a page number is ever a good idea.

    while i have no doubt your solution works (i have not tested), other than sanitizing the GET vars, modifying a GET var is, to me, bad coding and makes for a maintenance nightmare.

    just my 2 cents.

    people can feel free to do whatever they want to their code....
    Well, the split_page_results class at its core modifies whatever "page" indicator is used, whether its just a php variable or a $_GET variable when/if the provided page exceeds the calculated number of pages and it appears as if every use of the class except in the admin's coupon restrict code uses a $_GET which means that it could/would be modified if the value provided exceeds the calculated value.

    As to "modifying" a $_GET variable, I mean, in one respect (and yes a bit overboard/cheeky) every time a link is generated the $_GET variable is being modified... In one aspect (still cheeky) as if saying shouldn't use any parameters whatsoever on a link.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Featured Products - choosing/deleting of 10th item on first page error / bug?

    Quote Originally Posted by carlwhat View Post
    @mc12345678

    finding where the error is, in my experience, is most times harder than recommending a solution.

    i am not sure what code base we live in where modifying a GET var for a page number is ever a good idea.

    while i have no doubt your solution works (i have not tested), other than sanitizing the GET vars, modifying a GET var is, to me, bad coding and makes for a maintenance nightmare.

    just my 2 cents.

    people can feel free to do whatever they want to their code....
    On a more serious note though, this modification of the page "number" as applied in the two programs is a bit of a sanitation... Again, why just on page=1 and in a way no page is given, ehh. But the approach is to set the page to the correct value for the provided fID. It's just that the "edge" case was missed...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v155 Featured Products bug on this page
    By KGL Racing in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 13 Nov 2018, 04:06 PM
  2. attributes force choosing bug? customer can easily bypass choosing and buy for free
    By fast8 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Sep 2016, 05:09 PM
  3. Deleting products in Specials and Featured Products
    By arrow in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 26 Nov 2007, 05:30 PM
  4. [Not a Bug] EZ-Page Links IE bug when first clicking
    By NamSingh in forum Bug Reports
    Replies: 11
    Last Post: 25 Dec 2006, 03:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR