Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Keeping track of printed orders


bruyndoncx

Recommended Posts

Posted

I've been looking for a contribution to keep track of printed orders, but couldn't find any.

I did not want to have to create and update different status for non-printed/paid and unpaid orders.

 

Since it is not difficult, I just went ahead and changed the code used in batchprint nopdf which I am already using.

 

Just 4 easy steps:

 

Keeping track of printed orders by adding a field to the orders table

ALTER TABLE `orders` ADD COLUMN `printed` TINYINT NOT NULL DEFAULT '0' AFTER `ip_address`; 

 

Using batchprint orders nopdf contribution, change the main file where the checkbox is generated set it by default to yes for orders that have not been printed yet. In my file around line 417

         	 <td class="dataTableContent" align="right"><?php echo tep_draw_checkbox_field('batch_order_numbers[' . $orders['orders_id'] . ']', ($orders['printed'] == 1?'no':'yes'), '' , 'yes', 'onclick="CheckCheckAll(document.trackunread)'); ?></td>

 

In the same file, find every instance of

select o.orders.id

and insert printed in this so it becomes

select printed, o.orders_id

 

find file print_batch_process.php (part of the same contribution)

around line 94 you find

 include('invoice_module.php');

 if($autoupdatestatus=='Yes') {

 

insert the code to update the database as shown below

 include('invoice_module.php');

 //flag as printed
 tep_db_query("update orders SET printed = 1 WHERE orders_id='" .$oID . "'");

 if($autoupdatestatus=='Yes') {

 

Hope someone finds this usefull ...

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted

ALTER TABLE `orders` ADD COLUMN `printed` TINYINT NOT NULL DEFAULT '0' AFTER `ip_address`;

 

some may not have a field called 'ip_address' so to add it to the end of the list change it to this

 

ALTER TABLE `orders` ADD COLUMN `printed` TINYINT NOT NULL DEFAULT '0';

 

also just spotted another typo, it should be

 

select o.orders_id

 

nice addition Carine :thumbsup:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...