VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Topic started by: _fD_ on May 04, 2008, 17:25:59 pm

Title: Order Status Email with Order Status Description
Post by: _fD_ on May 04, 2008, 17:25:59 pm
Hello all

For easier management of order status i made a hack in the ps_order.php to send the text from order_status_description also in the email:

VirtueMart 1.1.3 ps_order.php (The file is attached as txt):

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

New with order status description:
Quote
      $q = "SELECT first_name,last_name,user_email,order_status_name,order_status_description FROM #__{vm}_order_user_info,#__{vm}_orders,#__{vm}_order_status ";

Lines 317 to 335:
Original:
Quote
      $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");
      $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 .= $mosConfig_live_site."\n";
      $message .= $dbv->f("contact_email");

New with order status description and put the comment under this text:
Quote
      $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_3',false)."\n";
      $message .= $url;
      $message .= "\n\n____________________________________________________________\n";
      $message .= $dbv->f("vendor_name") . " \n";
      $message .= $mosConfig_live_site."\n";
      $message .= $dbv->f("contact_email");

Now you can fill in some status text in the order status description and for individuell comments you fill in a comment.

Hope you like it and take it in to the core  :P.

Best Regards, Urs

[attachment cleanup by admin]
Title: Re: Order Status Email with Order Status Description
Post by: RedLight Traitor on June 03, 2008, 02:00:19 am
Wow thanks! You would think they would have made this link already. Good job.
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on November 24, 2008, 22:54:08 pm
Hello all,

here is the actual file for VM 1.1.2 @version $Id: ps_order.php 1529.

Please add it to the core ;-).

Best regards, Urs



[attachment cleanup by admin]
Title: Re: Order Status Email with Order Status Description
Post by: bulesz on January 03, 2009, 10:54:13 am
Will try, thanks for this bro! ;)
Title: Re: Order Status Email with Order Status Description
Post by: BASiK on September 03, 2009, 03:53:29 am
Dude your epic! EXACTLY what I needed, you rock!
Title: allowing HTML in Order Status Descriptions
Post by: ThestraL on September 06, 2009, 00:49:30 am
That's what i was looking for. Many thanks bro :)

Btw ppl, If you are interested in allowing HTML in Order Status Descriptions, you can find the solution at my topic ;)

---> http://forum.virtuemart.net/index.php?topic=59977.msg197214#msg197214 (http://forum.virtuemart.net/index.php?topic=59977.msg197214#msg197214)
Title: Re: Order Status Email with Order Status Description
Post by: dj_hardbeat on October 11, 2009, 03:53:07 am
Thank you very much! Very helpfull hack!  :)

Should be implemented in the new version!
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on November 24, 2009, 09:39:07 am
Welcome Guys  ;D

With the best wishes for all. Urs
Title: Re: Order Status Email with Order Status Description
Post by: Lylene on November 24, 2009, 17:57:52 pm
Hello fD !

Thanks for this great hack that I just installed on production site !
Very helpfull !

I have a little last question if you don't mind : I'm using SH404SEF and made some changes on the link that leads to the detailed order page on web site :

I changed from :

$url = SECUREURL."index.php?option=com_virtuemart&page=account.order_details&order_id=".urlencode($d["order_id"]).'&Itemid='.$sess->getShopItemid();

to a more "readable" url :

$url = SECUREURL."See_my_order-id".urlencode($d["order_id"].".html");

But, there is a but :)

Some clients clicks on it without beeing connected, and sometimes if this URL is not know by sh404SEF, they get a 404 ...


So my question is : is there a way to "hide" the big ugly URL and link it to a text like :

"Click here for your detailed order"

Like it is with the order confirmation email :
$footer_html = '<a title="'.$VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5').'" href="'.$order_link.'">'
. $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5').'</a>';


--> But I can't make it work that way

Thakns in advance

Lylene
Title: Re: Order Status Email with Order Status Description
Post by: BillRayDrums on December 15, 2009, 00:24:51 am
Hello all

I've implemented the hack to allow the status message change to display the status change description. Now I'd like to bug a little further and ask for assistance in how do I format that email with the company name and header at the top?

I'm somewhat new to PHP but am rapidly absorbing it's power. :D

Any help is greatly appreciated.
Title: Re: Order Status Email with Order Status Description
Post by: billysundar on January 25, 2010, 03:07:40 am
Is there a way to send the Order Confirmation email when the order status change? We have a need to send the item descriptions and the order information as well.

Cheers.
Title: Re: Order Status Email with Order Status Description
Post by: ZS on February 03, 2010, 13:19:48 pm
Looks like an awesome hack. Does it work with Vmart 1.1.4?
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on February 10, 2010, 15:45:49 pm
Hello Guys,

you can download the file for Virtuemart 1.1.4 following:

http://www.frefeldigital.com/index.php?option=com_content&view=article&id=140:virtuemart-hacks&catid=88&Itemid=184 (http://www.frefeldigital.com/index.php?option=com_content&view=article&id=140:virtuemart-hacks&catid=88&Itemid=184)

Best regards
Urs

Title: Re: Order Status Email with Order Status Description
Post by: thomas80 on April 07, 2010, 22:07:19 pm
Hallo Urs,
sorry... veeery stupid question from a newbie...
And where can i find the ps_order.php to replace it?
Thanks for your help,
Thomas

... just found it...
/administrator/components/com_virtuemart/classes
Title: Re: Order Status Email with Order Status Description
Post by: vitovito on May 17, 2010, 16:33:52 pm
Is there anybody cn pass me the hack to apply since I got other hack I can not just use the ps order file you posted.
Virtuemart 1.1.4
Many thanks great hack
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on June 10, 2010, 09:14:07 am
Is there anybody cn pass me the hack to apply since I got other hack I can not just use the ps order file you posted.
Virtuemart 1.1.4
Many thanks great hack

Hello,

Do you still need help on this?

Best regards, Urs
Title: Re: Order Status Email with Order Status Description
Post by: Emet on August 19, 2010, 19:08:41 pm
Hi!

Thanks for the hack. Im actually desperate to find a way for the customer to click 'order received' on the status page somehow so that the merchant knows. Is there a solution to this??

THANKS!
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on August 19, 2010, 20:03:23 pm
Hi Ernet,

with VM you can setup maybee an e-mail link into the payment part for the html code.

For a better solution you have to hack the code.

Best regards,
Urs
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on February 07, 2011, 23:45:02 pm
Hello all

The new file is ready for download.

Have somebody an idea, how to fix the following bug:

I write in the text in the order status description field in VM admin, save it. Then i open it and the line ends goes away.

Please help for it. Many thanks.

Best regards,
Urs

Download the file here:
http://www.frefeldigital.com/joomla-cms/komponenten-module-plugins-fuer-das-joomla-cms/virtuemart-hacks.html (http://www.frefeldigital.com/joomla-cms/komponenten-module-plugins-fuer-das-joomla-cms/virtuemart-hacks.html)
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on February 07, 2011, 23:46:57 pm
Hi!

Thanks for the hack. Im actually desperate to find a way for the customer to click 'order received' on the status page somehow so that the merchant knows. Is there a solution to this??

THANKS!

Hello Emet,

did you found a solution for it?

Would be an nice feature for some people to have it ;-).

Best regards,
Urs
Title: Re: Order Status Email with Order Status Description
Post by: gtelegadis on March 25, 2011, 17:03:03 pm
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.
Title: Re: Order Status Email with Order Status Description
Post by: gtelegadis on March 25, 2011, 18:12:09 pm
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: [Select]
$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: [Select]
$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: [Select]
$q .= "AND order_status = order_status_code ";
ADD THIS CODE:

Code: [Select]
$q .= "AND order_status_description = order_status_description ";
STEP 2:  REPLACE THIS CODE AROUND LINE 372-394:

Code: [Select]
// 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: [Select]
// 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.
Title: Re: Order Status Email with Order Status Description
Post by: _fD_ on March 25, 2011, 18:33:00 pm
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
Title: Re: Order Status Email with Order Status Description
Post by: morob on April 12, 2011, 15:18:18 pm
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.
Title: Re: Order Status Email with Order Status Description
Post by: gtech on June 15, 2011, 15:26:50 pm
Confirmed working on 1.1.7
Thank you for your great work!
Title: Re: Order Status Email with Order Status Description
Post by: gajdam on August 20, 2011, 18:23:09 pm
Hi!
Is it working on VM 1.1.9 ?? Have sb tried?
Best regards!
Title: Re: Order Status Email with Order Status Description
Post by: maxispin on January 01, 2012, 11:31:05 am
1.1.7 hack works also on 1.1.9. Tested this: http://www.frefeldigital.com/media/virtuemart-hacks/ps_order.txt
Title: Re: Order Status Email with Order Status Description
Post by: grupavs on February 06, 2013, 14:04:06 pm
1.1.8 vm mail I send html code. The customer sees the example below. Please help crack head now

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hi Anna Name,

the status of your order No. 251 has been changed. The new status is:

The term of the


<p>Lorem Ipsum is simply dummy text of the </p>
<p><strong>Lorem Ipsum is simply dummy text of the </strong></p>
<p><br /><a href="http://companyname.com"><strong>Lorem Ipsum is simply dummy</strong></a></p>

If you want to see the order details, click this link (or copy the address into your browser):
http://www.companyname.com/index.php?option=com_virtuemart&page=account.order_details&order_id=251&Itemid=176

____________________________________________________________
company name

info@companyname.com

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

thank you in advance for any help