User Tools

Site Tools


tutorials:zencartmods:invoice_sorter.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:zencartmods:invoice_sorter.html [2011/07/07 20:28]
ladyada [Custom Sort Invoice Items]
tutorials:zencartmods:invoice_sorter.html [2016/01/28 18:05]
Line 1: Line 1:
-====== Custom Sort Invoice Items ====== 
  
-This one is a little odd, but is very handy when you have over 200 items you ship! We have all of our kits and items stored on shelves and when the shipper goes to pick the items, its handy if he doesn'​t have to go back and forth across the room to find all of them. So what we do is we sort the items so that they appear in spacial order. This means all the items that are next to each other on the invoice are next to each other in real life! 
- 
-{{:​tutorials:​zencartmods:​sorter.jpg|}} 
- 
- 
-{{:​tutorials:​zencartmods:​sorter2.jpg|}} 
- 
- 
- 
-==== DB Mod ==== 
- 
-goes without saying at this point, but do a db backup before you do anything to the db. 
- 
-<code sql> 
-CREATE TABLE `shipping_sort` ( 
-`shipping_sort_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , 
-`products_id` INT NOT NULL , 
-`sort_order` INT NOT NULL DEFAULT '​0'​ 
-) 
-</​code>​ 
- 
-==== Make a Helper File ==== 
- 
-[[http://​ladyada.net/​wiki/​tutorials/​zencartmods/​tariffhelper.html|Make an admin page]] that will help you populate this table with sort orders! 
- 
- 
-Theres a lot of ways you could do this - here's our file that uses some quick and dirty javascript to make things click and draggable. 
- 
-{{:​tutorials:​zencartmods:​shipping_sort.php.zip|}} 
- 
-==== PHP Mod ==== 
- 
-Find line 115-121 of **admin/​includes/​classes/​order.php** 
- 
-<code php> 
-      $orders_products = $db->​Execute("​select orders_products_id,​ products_id,​ products_name,​ products_model, ​                                                                                                                                                                 
-                                              products_price,​ products_tax,​ products_quantity, ​                                                                                                                                                                               ​ 
-                                              final_price,​ onetime_charges, ​                                                                                                                                                                                                   
-                                              product_is_free ​                                                                                                                                                                                                                 
-                                       from " . TABLE_ORDERS_PRODUCTS . " ​                                                                                                                                                                                                     
-                                       where orders_id = '"​ . (int)$order_id . "' ​                                                                                                                                                                                             
-                                       order by orders_products_id"​);​ 
-</​code>​ 
- 
-and replace it with  
- 
-<code php> 
-      $orders_products = $db->​Execute("​select op.orders_products_id,​ op.products_id,​ products_name,​ products_model, ​                                                                                                                                                           
-                                              products_price,​ products_tax,​ products_quantity, ​                                                                                                                                                                               ​ 
-                                              final_price,​ onetime_charges, ​                                                                                                                                                                                                   
-                                              product_is_free,​ ss.sort_order ​                                                                                                                                                                                                 ​ 
-                                       from " . TABLE_ORDERS_PRODUCTS . " op left join shipping_sort ss on ss.products_id = op.products_id ​                                                                                                                                   ​ 
-                                       where orders_id = '"​ . (int)$order_id . "' ​                                                                                                                                                                                             
-                                       order by sort_order"​);​ 
-</​code>​ 
/home/ladyada/public_html/wiki/data/pages/tutorials/zencartmods/invoice_sorter.html.txt · Last modified: 2016/01/28 18:05 (external edit)