Project: Potion Store
Revision: 73
Author: andykim78
Date: 13 May 2008 18:32:57
Changes:Force an order's payment type to be the proper case for submitting to PayPal
Order search wasn't properly searching in licensee names
Order search SQL query condition modified to be compatible with mysql
Files:modified: /trunk/README (
try)
modified: /trunk/app/models/order.rb (
try)
modified: /trunk/app/controllers/admin/orders_controller.rb (
try)
modified: /trunk/app/views/admin/login.rhtml (
try)
modified: /trunk/ChangeLog (
try)
Diff:
| ... | ...@@ -31,6 +31,9 @@ |
| 31 | 31 | config/paypal.yml |
| 32 | 32 | config/google_checkout.yml |
| 33 | 33 | |
| 34 | - Set session store secret |
| 35 | Edit config/environment.rb and modify the config.action_controller.session setting |
| 36 | |
| 34 | 37 | - Setup database |
| 35 | 38 | - Install Postgresql if you haven't |
| 36 | 39 | - Create the store_development database. |
| ... | ...@@ -175,6 +175,18 @@ |
| 175 | 175 | self.ccnum = 'X' * (t.length - 4) + t[t.length-4 .. t.length-1] |
| 176 | 176 | end |
| 177 | 177 | |
| 178 | def payment_type=(type) |
| 179 | val = type |
| 180 | if type |
| 181 | if ['visa', 'amex', 'discover'].member?(type.downcase()) |
| 182 | val = type.capitalize() |
| 183 | elsif type.downcase() == 'mastercard' |
| 184 | val = 'MasterCard' |
| 185 | end |
| 186 | end |
| 187 | write_attribute(:payment_type, val) |
| 188 | end |
| 189 | |
| 178 | 190 | def cc_order? |
| 179 | 191 | return ['visa', 'mastercard', 'amex', 'discover'].member?(self.payment_type.downcase) |
| 180 | 192 | end |
| ... | ...@@ -10,12 +10,12 @@ |
| 10 | 10 | q = params[:query] |
| 11 | 11 | conditions = "status != 'P'" |
| 12 | 12 | if q |
| 13 | | q.strip! |
| 14 | | conditions = conditions + " AND (email ~* '#{q}' OR |
| 15 | | first_name ~* '#{q}.*' OR |
| 16 | | last_name ~* '#{q}.*' OR |
| 17 | | licensee_name ~* '%#{q}.*' OR |
| 18 | | id ~* '#{q}')" |
| 13 | q = q.strip().downcase() |
| 14 | conditions = conditions + " AND (LOWER(email) LIKE '#{q}%' OR |
| 15 | LOWER(first_name) LIKE '#{q}%' OR |
| 16 | LOWER(last_name) LIKE '#{q}%' OR |
| 17 | LOWER(licensee_name) LIKE '%#{q}%' OR |
| 18 | id LIKE '#{q}')" |
| 19 | 19 | end |
| 20 | 20 | @orders = Order.paginate :page => (params[:page] || 1), :per_page => 100, :conditions => conditions, :order => 'order_time DESC' |
| 21 | 21 | |
| ... | ...@@ -1,5 +1,5 @@ |
| 1 | 1 | <script type="text/javascript"> |
| 2 | | onload = function() { document.getElementById("username").focus(); } |
| 2 | onload = function() { document.getElementById("username").focus(); }; |
| 3 | 3 | </script> |
| 4 | 4 | |
| 5 | 5 | <h3>Magic Potion Required</h3> |
| ... | ...@@ -1,3 +1,8 @@ |
| 1 | 2008-05-13 Andy Kim <andy@potionfactory.com> |
| 2 | * Force an order's payment type to be the proper case for submitting to PayPal |
| 3 | * Order search wasn't properly searching in licensee names |
| 4 | * Order search SQL query condition modified to be compatible with mysql |
| 5 | |
| 1 | 6 | 2008-03-18 Andy Kim <andy@potionfactory.com> |
| 2 | 7 | * In the front page, show a @ character next to price to clarify that the input field is for quantity |
| 3 | 8 | * Round up floating point quantities |
To list