Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    93
    Plugin Contributions
    0

    Default Displaying the correct page after inserting a "Music Genre" extra

    At the moment, the Admin->Extras->Music Genre displays up to 20 rows per page.

    Currently, whenever I insert a Music Genre (when there are more than 20 entries), and click "Save", it will then go to show Page 1.

    How can I modify this behaviour so that it displays the page where the new entry has been inserted?

    For example, let's say I already have 50 entries in Music Genre so it will be split into 3 pages. I then insert a new Music Genre that alphabetically slots in at listing number 38 but has the mID of 51.

    Current behaviour after I add the new Music Genre is to display Page 1. How can I change it to display page 2 so that mID 51 can be highlighted at listing number 38 automatically after clicking on "Save"?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Displaying the correct page after inserting a "Music Genre" extra

    You could try this by adding the code in RED:
    Code:
      $music_genre_query_raw = "select * from " . TABLE_MUSIC_GENRE . " order by music_genre_name";
    
    // Split Page
    // reset page when page is unknown
    if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['mID'] != '') {
      $check_page = $db->Execute($music_genre_query_raw);
      $check_count=1;
      if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
        while (!$check_page->EOF) {
          if ($check_page->fields['music_genre_id'] == $_GET['mID']) {
            break;
          }
          $check_count++;
          $check_page->MoveNext();
        }
        $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
      } else {
        $_GET['page'] = 1;
      }
    }
    
      $music_genre_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $music_genre_query_raw, $music_genre_query_numrows);
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Mar 2011
    Posts
    93
    Plugin Contributions
    0

    Default Re: Displaying the correct page after inserting a "Music Genre" extra

    Works like a charm! Thanks, Ajeh!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Displaying the correct page after inserting a "Music Genre" extra

    You are most welcome ... thanks for the update that this worked for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v154 A "space" appears in Customer record when inserting the State/County in "other" box
    By SarahL in forum Managing Customers and Orders
    Replies: 2
    Last Post: 30 Oct 2015, 09:45 AM
  2. v139g Displaying "special" before "products of the month"
    By Zaal in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 15 Dec 2012, 09:54 PM
  3. "New Products" not displaying correct items
    By pglenn in forum General Questions
    Replies: 3
    Last Post: 26 Jan 2008, 06:45 PM
  4. Showing "music genre" in more areas of ZenCart.
    By ccaines in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 30 Jul 2007, 11:13 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