Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Posts
    49
    Plugin Contributions
    0

    help question Coupon Admin Sort How to?

    Please accept my apologies if the answer is right in my face, but I have been searching this forum and my Admin menus, and simply cannot find how to change the sorting on my Coupon Admin page. I would like my coupons in my Admin to sort by date added so the most recent one is listed on the top. Because i have so many coupons created, and when I want to see the most recent, it's all sorted by price or name or something other than what I need.

    Anyone know this answer to this? Thank you in advance.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Coupon Admin Sort How to?

    You'll have to edit the SQL statements in the /admin/coupon_admin.php file to change the sort order.
    I've not tested this suggestion, but you could try this:

    Around line 1016 you'll see this block of code. Add the extra line, as shown:
    Code:
        if ($status != '*') {
          $cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from " . TABLE_COUPONS ." where coupon_active='" . zen_db_input($status) . "' and coupon_type != 'G'";
        } else {
          $cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from " . TABLE_COUPONS . " where coupon_type != 'G'";
        }
        $cc_query_raw .= " ORDER BY date_created";
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2007
    Posts
    49
    Plugin Contributions
    0

    Default Re: Coupon Admin Sort How to?

    Quote Originally Posted by DrByte View Post
    You'll have to edit the SQL statements in the /admin/coupon_admin.php file to change the sort order.
    I've not tested this suggestion, but you could try this:

    Around line 1016 you'll see this block of code. Add the extra line, as shown:
    Code:
        if ($status != '*') {
          $cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from " . TABLE_COUPONS ." where coupon_active='" . zen_db_input($status) . "' and coupon_type != 'G'";
        } else {
          $cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from " . TABLE_COUPONS . " where coupon_type != 'G'";
        }
        $cc_query_raw .= " ORDER BY date_created";

    Thank you for the response, and I think I'm getting closer but not there yet. Adding this extra line, sorted my coupons by dated created "yes" but now I need them in descending order, so that the newest coupon added is the 1st one listed on page1. Does that make sense? I hope there is an extra line out there that I can add to do this. "Crossy fingers..."

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Coupon Admin Sort How to?

    oops ... I meant to come back and fix that ...

    Code:
    $cc_query_raw .= " ORDER BY date_created DESC";
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Nov 2007
    Posts
    49
    Plugin Contributions
    0

    Default Re: Coupon Admin Sort How to?

    Quote Originally Posted by DrByte View Post
    oops ... I meant to come back and fix that ...

    Code:
    $cc_query_raw .= " ORDER BY date_created DESC";
    Fantastic! That did it. Thank you so much. Really appreciate it.

 

 

Similar Threads

  1. v154 Option Names ... how do I sort by sort number?
    By xcergy in forum General Questions
    Replies: 15
    Last Post: 19 Jan 2016, 01:13 AM
  2. v151 Coupon Admin hidden from Navigation Bar in Admin
    By retched in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 3
    Last Post: 19 Jun 2014, 02:03 PM
  3. How do I control the display order in Coupon Admin
    By nut4squirrel in forum Customization from the Admin
    Replies: 1
    Last Post: 29 Jul 2012, 11:47 PM
  4. v138a how to edit sort order value in the category browsing page of admin?
    By hmdnawaz in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 6 Apr 2012, 01:48 PM
  5. how do i sort products in admin by ID ?
    By uncentaur in forum General Questions
    Replies: 1
    Last Post: 29 Jul 2008, 07:12 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