X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing and adding new features (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Change Sort Order for Gift Certificates (https://forum.x-cart.com/showthread.php?t=65049)

notgrass 10-05-2012 05:34 AM

Change Sort Order for Gift Certificates
 
Our business does not sell gift certificates. We give them away as bonuses to our customers. Since these certificates do not have an order ID attached, the default sort order in the Gift Certificates module made no sense, and I had to hunt through the list to change Pending certificates to Active.

I modified the SQL query of the giftcerts table to sort the list of certificates as I preferred. In this file:

[X-Cart Directory]/admin/giftcerts.php

find the line--

$query = "SELECT *, add_date+'" . $config["Appearance"]["timezone_offset"] . "' as add_date FROM $sql_tbl[giftcerts] WHERE 1 $expired_condition";

After $expired_condition and before the closing "; you can add an ORDER BY modifier. I used "ORDER BY status DESC, debit" to group all of the Pending certificates at the top of the list and sort the Active certificates by amount remaining so I can clear out the empty ones. Like this:

$query = "SELECT *, add_date+'" . $config["Appearance"]["timezone_offset"] . "' as add_date FROM $sql_tbl[giftcerts] WHERE 1 $expired_condition ORDER BY status DESC, debit";


All times are GMT -8. The time now is 08:45 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.