Order Status Email with Order Status Description

<< < (5/5)

gtelegadis:
Urs,

Do you have the old 1.1.4 version of ps_order.txt hack?  Or if you know if the 1.1.7 hack works with 1.1.4?  I'm not sure if you found a solution for the problem you are having, but I'm presuming the problem didn't happen on the 1.1.4 hack and since that's the version I'm running that version of the hack would be ideal for me.

FYI, I'm about 95% sure that this solution is going to be a perfect fit for anyone running Webgility's ECC software.  This acts as a bridge betweeen v/m and quickbooks (as well as other accounting software) in that it auto pulls the order details, auto creates invoices by auto pushing details to quickbooks, and if you are using fedex (ground, express, smartpost) it will auto push the details to create a fedex label and then post the tracking label on both quickbooks invoice and back to the virtuemart store.  Because virtuemart for some reason has no field code for tracking numbers, ECC will auto change the status to SHIPPED and puts the tracking number (I'm confirming this) in the order_status_description field when it posts back to virtuemart.  So if this hack takes the info from the commment field in the order history comment field in the back end individual order screen, AND since you can set up v/m to send an auto e-mail to the customer when the product ships, then effectively with this hack you will have an automated process where the customer receives an e-mail with tracking info when the product ships.

gtelegadis:
Nevermind, Urs.  I was able to figure it out:

For those who want to know what is JUST THE CODE to replace (in the event you already have hacks in place to ps_order.php:

STEP 1:  REPLACE THIS CODE AROUND LINE 364

Code:

$q = "SELECT first_name,last_name,user_email,order_status_name FROM #__{vm}_order_user_info,#__{vm}_orders,#__{vm}_order_status ";

WITH THIS CODE:

Code:

$q = "SELECT first_name,last_name,user_email,order_status_name,order_status_description FROM #__{vm}_order_user_info,#__{vm}_orders,#__{vm}_order_status ";

AND RIGHT AFTER THIS PRE-EXISTING CODE A FEW LINES FURTHER DOWN:

Code:

$q .= "AND order_status = order_status_code ";

ADD THIS CODE:

Code:

$q .= "AND order_status_description = order_status_description ";

STEP 2:  REPLACE THIS CODE AROUND LINE 372-394:

Code:

// MAIL BODY
$message = $VM_LANG->_('HI',false) .' '. $db->f("first_name") . ($db->f("middle_name")?' '.$db->f("middle_name") : '' ). ' ' . $db->f("last_name") . ",\n\n";
$message .= $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_1',false)."\n\n";

if( !empty($d['include_comment']) && !empty($d['order_comment']) ) {
$message .= $VM_LANG->_('PHPSHOP_ORDER_HISTORY_COMMENT_EMAIL',false).":\n";
$message .= $d['order_comment'];
$message .= "\n____________________________________________________________\n\n";
}

$message .= $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_2',false)."\n";
$message .= "____________________________________________________________\n\n";
$message .= $db->f("order_status_name");

if( VM_REGISTRATION_TYPE != 'NO_REGISTRATION' ) {
$message .= "\n____________________________________________________________\n\n";
$message .= $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_3',false)."\n";
$message .= $url;
}
$message .= "\n\n____________________________________________________________\n";
$message .= $dbv->f("vendor_name") . " \n";
$message .= URL."\n";
$message .= $dbv->f("contact_email");


WITH THIS CODE FROM URZ' V. 1.1.7 (ALSO WORKS IN 1.1.4):

Code:

// MAIL BODY Geändert von ub Zeile 308 ergänzt mit oder_status_description und Zeilen 330 hinzugefügt
$message = $VM_LANG->_('HI',false) .' '. $db->f("first_name") . ($db->f("middle_name")?' '.$db->f("middle_name") : '' ). ' ' . $db->f("last_name") . ",\n\n";
$message .= $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_1',false) .' '. $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_2',false)."\n\n";
$message .= $db->f("order_status_name")."\n\n";
$message .= $db->f("order_status_description")."\n\n";
if( !empty($d['include_comment']) && !empty($d['order_comment']) ) {
$message .= $VM_LANG->_('PHPSHOP_ORDER_HISTORY_COMMENT_EMAIL',false).":\n";
$message .= $d['order_comment'];
$message .= "\n____________________________________________________________\n\n";
}

$message .= $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_2',false)."\n";
$message .= "____________________________________________________________\n\n";
$message .= $db->f("order_status_name");

if( VM_REGISTRATION_TYPE != 'NO_REGISTRATION' ) {
$message .= "\n____________________________________________________________\n\n";
$message .= $VM_LANG->_('PHPSHOP_ORDER_STATUS_CHANGE_SEND_MSG_3',false)."\n";
$message .= $url;
}
$message .= "\n\n____________________________________________________________\n";
$message .= $dbv->f("vendor_name") . " \n";
$message .= URL."\n";
$message .= $dbv->f("contact_email");


For those who aren't completely following where the field entry is located, you go to the admin backend of v/m, Orders, List Orders, click the actual order link you want to edit, look at the top right of the screen and you will see 2 tabs.  Click the first tab:  Order Status Change and you will see Order Status drop down and a Comment box where you can input text.

Using my tracking example above, after installing the hack, the manual process would be to change the status to Shipped, and enter in the tracking number in the comments box (might want to also give the customer the URL of your shipper's tracking page where they could enter in the tracking number) and make sure the check box next to Notify Customer and Include This Comment is checked.  Then click Update and the customer will now receive an e-mail with the tracking ID in it.

I'm looking into trying to figure out how to hack the e-mail itself, as it's pretty unfriendly on it's face.  Will get back if I figure out a way.

_fD_:
Hi gtelegadis,

that sounds good. You mean, with this hack, the line ends gone away?

I take tomorrow a look into it and give you then feedback here.

Thank you for your effort on it.

Best regards
Urs

morob:
Hi all, I'm trying to implement the above step by step code changes posted by gtelegadis with VM 1.1.8 but I ended up with the system not sending any emails regarding orders. Is there something different perhaps at VM 1.1.8? Thanks.

gtech:
Confirmed working on 1.1.7
Thank you for your great work!

Navigation

[0] Message Index

[*] Previous page