Forums / Customization from the Admin / How do I control the display order in Coupon Admin

How do I control the display order in Coupon Admin

Views: 776

Results 1 to 2 of 2
29 Jul 2012, 7:38 PM
#1
nut4squirrel avatar

nut4squirrel

New Zenner

Join Date:
Nov 2009
Location:
Portland, OR
Posts:
2
Plugin Contributions:
0

How do I control the display order in Coupon Admin

I've tried to sort the coupons table in phpMyAdmin to make finding a coupon code in ZenCart Coupon Admin easier. This sort kind of works but is not completely successful. There seems to be other forces at work the cause the displayed list to show not in pure Coupon Code order.

I looks like dollar discounts are shown first, then percent discounts.

What can I change to always show the list in Coupon Code order?

-Thanks, Alan

29 Jul 2012, 10:47 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I control the display order in Coupon Admin

Look around line 994 and you will see the code where the SELECTs are made ...

In this example, the sort order has been set to sort by the Start date of the coupons:

    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'" . " order by coupon_start_date";
    } 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'" . " order by coupon_start_date";
    }

you can try the field:
coupon_code

instead of the field:
coupon_start_date

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!]
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!