User Tools

Site Tools


tutorials:zencartmods:invoice_sorter.html

This is an old revision of the document!


Table of Contents

If you have a large inventory of items, sorting items on the invoice can make things easier to find.

DB Mod

goes without saying at this point, but do a db backup before you do anything to the db.

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'
)

Make a Helper File

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.

shipping_sort.php.zip

PHP Mod

Find line 115-121 of admin/includes/classes/order.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");

and replace it with

      $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");
/home/ladyada/public_html/wiki/data/attic/tutorials/zencartmods/invoice_sorter.html.1310066844.txt.gz · Last modified: 2016/01/28 18:05 (external edit)