VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Topic started by: ThestraL on September 06, 2009, 00:42:22 am

Title: SOLUTION: To allow HTML in "Order Status Description"
Post by: ThestraL on September 06, 2009, 00:42:22 am
Hi,

Before start, I dont know if this was posted before. So, Im sorry if it was. I'm going to share a hack that I did on my store. As i mentioned in the title, its simply allowing users to save HTML data into their order status descriptions. Here is the code:

In ps_order_status.php in line 117 and 151, change the field array which includes order_status_description, for both "add" and "update" functions.

Original:
Code: [Select]
$fields = array('order_status_code' => vmGet($d, 'order_status_code' ),
'order_status_name' => vmGet($d, 'order_status_name' ),
'order_status_description' => vmGet($d, 'order_status_description'),
'list_order' => vmRequest::getInt('list_order' )
);

Change to this:
Code: [Select]
$fields = array('order_status_code' => vmGet($d, 'order_status_code' ),
'order_status_name' => vmGet($d, 'order_status_name' ),
'order_status_description' => vmGet($d, 'order_status_description' ,'',VMREQUEST_ALLOWRAW),
'list_order' => vmRequest::getInt('list_order' )
);

Hope this helps.
Ps: I'm using J! 1.5.14 + VM 1.1.3
Sorry for my English.
Khan..
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: ThestraL on September 06, 2009, 01:30:24 am
Update: I've found bug within my hack. It allows saving HTML data, but when sending notify e-mail to the customers the data is being decoded. I tried removing html_entity_decode() function inside ps_order.php, but no luck. :( Any help will be appreciated. Btw, I'm sorry that I've posted my topic as a successful hack :(
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: ThestraL on September 09, 2009, 17:55:27 pm
Any help? :(
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: _fD_ on August 18, 2010, 17:44:02 pm
Hello ThestraL

Did you found a solution for this topic?

Please give me a short answer on it.

Best regards, Urs
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: gtech on June 15, 2011, 15:25:22 pm
I would love to see that working too. Please update.
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: Fariida on August 30, 2011, 19:28:53 pm
Maybe this could help point you in the right direction.

in the ps_order.php file

replaced
Code: [Select]
$result = vmMail( $dbv->f("contact_email"),  $dbv->f("vendor_name"),
$db->f("user_email"), $mail_Subject, $mail_Body, '' );

with

Code: [Select]
$headers = "Content-type: text/html\r\n";

$result = vmMail( $dbv->f("contact_email"),  $dbv->f("vendor_name"),
$db->f("user_email"), $mail_Subject, $mail_Body, $headers, '' );

This seems to do the trick with not stripping away any html tags.

Let me know if this helps :-)
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: servlet on January 27, 2012, 17:42:05 pm
Fariida
it works
10x
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: Fariida on February 01, 2012, 02:02:49 am
great I'm glad that worked for you servlet. Cheers!
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: kvetka on November 15, 2012, 05:42:02 am
Hello everyone.

Thank you very much for sharing all the valuable info for the benefit of others. Very kind of you.

I'm a newbie, a girl who makes handmade jewelry and is taking a shot at building her own website.  The information each one of you shared  has been very helpful. Thank you again.

Fariida your HTML code hack works fantastic. But I'm running into a new problem. Now that my email is in HTML format the whole email clumps up together. There are no line breaks. All the "\n\n" are not recognized in HTML format. I don't know anything about php, and I don't know who to fix this.

How do I fix the following code, so my emails have line breaks? Can anyone help please?

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");

Thank you ahead.

Kvetka
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: Fariida on November 15, 2012, 18:25:32 pm
Hi kvetka, use the tag <br/> for line breaks. /n is not recognized in HTML
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: kvetka on November 15, 2012, 22:30:02 pm
Thank you very much Fariida. It works fine now. I've replaced all \n with <br/> and my emails look just perfect. THANK YOU AGAIN, for taking time to reply.

Have a nice weekend :)

PS: I'm about to try your other hack for "Adding tracking numbers to orders and shipping confirmation emails", which was posted in http://forum.virtuemart.net/index.php?topic=75373.msg309569#msg309569 (http://forum.virtuemart.net/index.php?topic=75373.msg309569#msg309569). I must say I've done may hacks to my php and html files, but this one is the biggest one. I hope all goes well. If I should run into any difficulties, do you mind if I contact you again? (I do hope I won't run into any major issues, lol)
Title: Re: SOLUTION: To allow HTML in "Order Status Description"
Post by: Fariida on November 15, 2012, 22:32:49 pm
Awesome, I'm glad it worked out for you. If you need any help with the tracking code just post it up on that thread. Cheers!

Thank you very much Fariida. It works fine now. I've replaced all \n with <br/> and my emails look just perfect. THANK YOU AGAIN, for taking time to reply.

Have a nice weekend :)

PS: I'm about to try your other hack for "Adding tracking numbers to orders and shipping confirmation emails", which was posted in http://forum.virtuemart.net/index.php?topic=75373.msg309569#msg309569 (http://forum.virtuemart.net/index.php?topic=75373.msg309569#msg309569). I must say I've done may hacks to my php and html files, but this one is the biggest one. I hope all goes well. If I should run into any difficulties, do you mind if I contact you again? (I do hope I won't run into any major issues, lol)