Author Topic: SOLUTION: To allow HTML in "Order Status Description"  (Read 12124 times)

ThestraL

  • Beginner
  • *
  • Posts: 10
SOLUTION: To allow HTML in "Order Status Description"
« 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..

ThestraL

  • Beginner
  • *
  • Posts: 10
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #1 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 :(

ThestraL

  • Beginner
  • *
  • Posts: 10
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #2 on: September 09, 2009, 17:55:27 pm »
Any help? :(

_fD_

  • Jr. Member
  • **
  • Posts: 118
    • Printdesign :: Joomla! CMS Webdesign :: Apple Computer Support
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #3 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

gtech

  • Beginner
  • *
  • Posts: 46
    • Suknie slubne
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #4 on: June 15, 2011, 15:25:22 pm »
I would love to see that working too. Please update.
I love what I do  - I do www
Suknie Slubne Suknie Wieczorowe

Fariida

  • Beginner
  • *
  • Posts: 39
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #5 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 :-)

servlet

  • Jr. Member
  • **
  • Posts: 348
  • Business optimization
    • Фототапети
  • VirtueMart Version: 3.2.2
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #6 on: January 27, 2012, 17:42:05 pm »
Fariida
it works
10x
I am using: Joomla 3.7.2 VM 3.2.2
Он-лайн магазин за фототапети http://mishelfoster.com

Fariida

  • Beginner
  • *
  • Posts: 39
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #7 on: February 01, 2012, 02:02:49 am »
great I'm glad that worked for you servlet. Cheers!

kvetka

  • Beginner
  • *
  • Posts: 9
    • Ooh-la-la-la Beadtique.com
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #8 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

Fariida

  • Beginner
  • *
  • Posts: 39
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #9 on: November 15, 2012, 18:25:32 pm »
Hi kvetka, use the tag <br/> for line breaks. /n is not recognized in HTML

kvetka

  • Beginner
  • *
  • Posts: 9
    • Ooh-la-la-la Beadtique.com
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #10 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. 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)

Fariida

  • Beginner
  • *
  • Posts: 39
Re: SOLUTION: To allow HTML in "Order Status Description"
« Reply #11 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. 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)