X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   extended order status with email notifications (https://forum.x-cart.com/showthread.php?t=13337)

chris.barber 10-31-2007 04:08 PM

Re: extended order status with email notifications
 
OK so I found the problem, there is a line of code that tells func_order.tpl which codes are allowed e.g. $allowed_order_status = 'IQPBDFCXSRUK'; although I have now added the new codes to this line, so far so good, the mod is now working, although I need to do a little more testing.

I will be happy to share what essentially needs changing to make it 4.1.8 and 4.1.9 compatible.

chris.barber 11-01-2007 06:44 AM

Re: extended order status with email notifications
 
Hi All, well it was late last night when I made my last post and when I checked everything this morning whilst I had managed to get the status to change the emails weren't being sent, but I have now fixed that too and so far it all seems to be fully functional.

It seemed that the mod was just skipping all the new options, those that already existed but had just been amended continued to function so I Q P C were still as before but with enhanced emails.

Anyway, it now appears to be working well and I am quite pleased with myself.

carlisleglass 11-05-2007 04:55 AM

Re: extended order status with email notifications
 
I really need the system to send out an email when selecting backordered - Im running v4.1.9, I would also be interested in seeing the coding for v4.1.x

2coolbaby 11-05-2007 11:00 AM

Re: extended order status with email notifications
 
I would also like to get instructions for 4.1.8. I have been pretty much having to set non-normal orders to queued.

chris.barber 11-09-2007 02:31 PM

Re: extended order status with email notifications
 
sorry guys been busy, give me a few more days and I will add the changes I made to the code that now works a charm here for you.

taltos1 12-03-2007 10:56 AM

Re: extended order status with email notifications
 
I am also really interested in the code the get this working for 4.1.X an updates?

Thanks a lot

chamberinternet 01-23-2008 01:13 PM

Re: extended order status with email notifications
 
Quote:

Originally Posted by chris.barber
sorry guys been busy, give me a few more days and I will add the changes I made to the code that now works a charm here for you.


Any update on on releasing the full mod for 4.1.x ?

Thanks

Shafiq :sK

chris.barber 01-28-2008 02:09 PM

Re: extended order status with email notifications
 
Sorry again guys, this is the first chance I have had to even get on here, I will try and make time this week, but don't hold your breath, the business has started slowly and is growing but I had to go get a job to pay the bills, so my days are now full so I will try and do something by the end of the week.

chris.barber 01-28-2008 02:28 PM

Re: extended order status with email notifications
 
OK so I followed the instructions in the first post, but when I got to mod3 of func, which is actually in /include/func/func.order.php I amended the code to look like this...

Quote:


// send email notifications to admin
if($config['Email_Note']['eml_oa_notif_failed'] == 'Y'){
$mail_smarty->assign("show_order_details", "Y");
func_send_mail($config["Company"]["orders_department"], "mail/order_admin_failed_subj.tpl", "mail/order_admin_failed.tpl", $config["Company"]["orders_department"], true, true);
$mail_smarty->assign("show_order_details", "");
}
}
elseif ($status == "C" && $order["status"] != "C") {
func_complete_order($orderid);
}
if ($status == "B" && $order["status"] != "B") {
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
if ($config['Email_Note']['eml_oc_notif_backordered'] == 'Y'){
func_send_mail($userinfo['email'],"mail/order_customer_backordered_subj.tpl", "mail/order_customer_backordered.tpl", $config["Company"]["orders_department"], false);
}
if ($status == "S" && $order["status"] != "S") {
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
if ($config['Email_Note']['eml_oc_notif_process_shipping'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_process_shipping_subj.tpl", "mail/order_customer_process_shipping.tpl", $config["Company"]["orders_department"], false);
}
if ($status == "K" && $order["status"] != "K") {
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
if ($config['Email_Note']['eml_oc_notif_back_in_stock'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_back_in_stock_subj.tpl", "mail/order_customer_back_in_stock.tpl", $config["Company"]["orders_department"], false);
}
if ($status == "R" && $order["status"] != "R") {
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
if ($config['Email_Note']['eml_oc_notif_process_return'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_process_return_subj.tpl", "mail/order_customer_process_return.tpl", $config["Company"]["orders_department"], false);
}
if ($status == "U" && $order["status"] != "U") {
$userinfo =$order_data["userinfo"];
$to_customer = ($userinfo['language']?$userinfo['language']:$config['default_customer_language']);
$mail_smarty->assign("products", func_translate_products($order_data["products"], $to_customer));
$mail_smarty->assign("order", $order);
$mail_smarty->assign("customer", $userinfo);
if ($config['Email_Note']['eml_oc_notif_refunded'] == 'Y')
func_send_mail($userinfo['email'],"mail/order_customer_refunded_subj.tpl", "mail/order_customer_refunded.tpl", $config["Company"]["orders_department"], false);



You also need to make sure you add all the codes so that about a screen and a half upwards you get the following:

Quote:


# This function change order status in orders table
#
function func_change_order_status($orderids, $status, $advinfo="") {
global $config, $mail_smarty, $active_modules, $current_area;
global $sql_tbl;
global $session_failed_transaction;

$allowed_order_status = 'IQPBDFCXSRUK';
if (!strstr($allowed_order_status, $status))
return;


It's the allowed order status bit you need to match to your new statuses.

I hope that helps, alternatively if anyone wants a copy of my func.order.php to do a compare on then just ask and I will send it to you.

It's been a while since I updated this mod to make it work and I really should have documented it at the time, but it has worked flawlessly for me since I did it.

davidsaldana 02-28-2008 10:02 AM

Re: extended order status with email notifications
 
I would like to see your func.order.php . the above post is a bit confusing.

thanks

chris.barber 02-28-2008 11:55 AM

Re: extended order status with email notifications
 
PM me an email address and I will send it.

chamberinternet 02-29-2008 03:38 AM

Re: extended order status with email notifications
 
I followed this post...

http://forum.x-cart.com/showthread.php?t=33007

Regards

Shafiq :sK

chris.barber 05-24-2008 03:03 PM

Re: extended order status with email notifications
 
I have a small update to add to this mod as I found the lack of inclusion of the new statuses in the "Orders Info" section on the Main admin page a bit of a pain as it didn't tell the full picture, anyway I decided to investigate updating this.

It goes without saying but BACKUP BACKUP BACKUP then start

From the xcart/admin directory edit the main.php file.

Find

$orders["Q"][] = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[orders] WHERE status='Q' $date_condition");

Then copy it below this line, replace the Qs in the new line with the letters you added for your new statuses, repeat for all new statuses or those you want included anyway.

You also need to edit the total to include these new statuses

Find

$total_paid[] = price_format(func_query_first_cell("SELECT SUM(total) FROM $sql_tbl[orders] WHERE (status='P' OR status='C') $date_condition"));

copy the OR status='C' part and paste it immediately after so you end up with OR status='C' OR status='C' then change the second C to the letter of the new status you added, repeat for all the statuses you want included in the total.

NOTE: This has a date condition so if you have a status of BACKORDERED and the order is from several weeks ago, the number of BACKORDERED orders will be shown in the table but the value will not be included within the Total, removing the date condition will simply give you a total for every order in your system so not recommended.

Then edit the xcart/skin1/admin/main.tpl file

Find the line that starts

<td nowrap="nowrap" align="left">{if $key eq "P"}{$lng.lbl_processed}{elseif $key eq "Q"}

Then move to the end of this line and copy

{elseif $key eq "I"}{$lng.lbl_not_finished}

and paste this text after the current instance so you will have two instances of this text like the example below

{elseif $key eq "I"}{$lng.lbl_not_finished}{elseif $key eq "I"}{$lng.lbl_not_finished}

Now change the new instance of I to be one of your status letters added to the main.php earlier, if you have created labels for these new statuses replace $lng.lbl_not_finished with the label of the new status, or you can hard code it by replacing $lng.lbl_not_finished with your new status wrapped in "", e.g. "REFUNDED"

That's it, I hope this helps someone else, but if not it made me happy...

JWait 05-25-2008 07:58 AM

Re: extended order status with email notifications
 
Quote:

Originally Posted by 2coolbaby
I would also like to get instructions for 4.1.8. I have been pretty much having to set non-normal orders to queued.


See http://forum.x-cart.com/showthread.php?t=33007&page=5 for what I did for a solution. I only needed "backordered and "canceled". The code is there to do both, and it could be expanded to cover other possibilities as well. I did disable the part where it returns the product to stock because it is normally "backordered" orders that are canceled and there is no item to return to stock. :) Anyway, it works for me.

gamafx 07-08-2008 10:01 AM

Re: extended order status with email notifications
 
Quote:

Originally Posted by Duramax 6.6L
I would be interested in seeing a detailed instalation for this mod in 4.1.8.

Same here.

JWait 07-09-2008 05:56 AM

Re: extended order status with email notifications
 
Again, see http://forum.x-cart.com/showthread.php?t=33007&page=5 for the solution. See post #42. It does the same thing. As long as you add a status to include/func.order.php and skin1/main/order_status.tpl, and clone email templates you should be good to go.

anela2003 05-07-2009 05:29 AM

Re: extended order status with email notifications
 
What if your cart has no include/func.php?

cherie 05-07-2009 04:07 PM

Re: extended order status with email notifications
 
Quote:

Originally Posted by anela2003
What if your cart has no include/func.php?


In 4.1 the functions were broken down in include/func.

alanruud 02-07-2011 01:52 AM

Re: extended order status with email notifications
 
Hello - I am trying to find code that will simply allow me to add a status (modifying main/order_status.tpl). Some of the mods i've tried add the status option, but it cannot be saved. I dont need any email notifications, etc., just an additional order status option. can you tell me what of the above I will need? Thank you!

cherie 02-07-2011 09:07 AM

Re: extended order status with email notifications
 
The link above should point you in the right direction.

BioEdgeNutrition 11-27-2011 10:33 PM

Re: extended order status with email notifications
 
Has anyone used this mod on 4.4.4?

xtech 11-28-2011 04:04 AM

Re: extended order status with email notifications
 
Any one for 4.4.x versions??

artist122 02-03-2012 03:35 PM

Re: extended order status with email notifications
 
Any update for 4.4 yet , still can't get it to send the e-mails out, but got all the statuses working on our end.


All times are GMT -8. The time now is 09:31 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.