View Single Post
  #7  
Old 03-24-2014, 04:54 PM
 
Thomasb134 Thomasb134 is offline
 

X-Adept
  
Join Date: Apr 2007
Location: USA
Posts: 784
 

Default Re: Custom Order Status inc Email To Customer and Stock Correction X-Cart 4.5.x

I applied the Custom Status mod (including the inventory fix in post 6) and found inventory updates still did not work correctly. I made some changes and it now works fine in my V4.4.5 store. I'll share what I found in case others run into inventory accuracy issues like me.

I performed all the updates noted in this disussion. However, I had to modify some of the new code used in the /include/func/func.order.php as follows:

Find Original Code:
Code:
$send_notification = false; if ( $status == 'P'

Change to:
Code:
$send_notification = false; // Custom Order Status Code, Return Cancelled products to stock if ( $status == "R" && $order['status'] != 'R' && $order['status'] != 'F' && $order['status'] != 'D' ) { func_update_quantity($order_data['products'],true); } elseif ( $status == 'P'


I also had to add some extra code to accommodate some status changes that were missing in the original mod.
Find Original Code:
Code:
} elseif ( $status == 'D' && $order['status'] != 'D' && $order['status'] != 'F' ) {


Change to:
Code:
} elseif ( $status == 'D' && $order['status'] != 'D' && $order['status'] != 'F' && $order['status'] != 'R' ) {


Find Original Code:
Code:
} elseif ( $status == 'F' && $order['status'] != 'F' && $order['status'] != 'D' ) {

Change to:
Code:
} elseif ( $status == 'F' && $order['status'] != 'F' && $order['status'] != 'D' && $order['status'] != 'R' ) {

Many thanks to those that did all the hard work!
__________________
Thomas / USA
XCart V4.4.5 Gold
XCart Mobile V1.4.12
XCart X-PDF
XCart X-HotProducts
AlteredCart Checkout One (One Page Checkout)
BCSE Back In Stock
CFL Holiday Message
CFL System Message
Smack Digital (WebsiteCM) Remember Anon Carts
xcartmods Testimonials
xcartmods reCAPTCHA for X-Cart Classic
Unix, PHP 7.0 (patched 5.4).
MySQL 5.6
Reply With Quote