News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Possible bug: Table "_virtuemart_order_histories"

Started by EsSa55, July 30, 2018, 16:57:07 PM

Previous topic - Next topic

Studio 42

Really max, why you dont check to find a better solution?
I dont think that escaping all special char is needed, else Joomla and wordpress had more vulnerability about this.
If you save JSON, this need only to escape the double quotes too.
Your solution have many drawback, eg if you need to compare or search an encoded string.

GJC Web Design

yes..  but replace the "comments"

next tr up

the customer_note is only if the shopper left an original comment -- the code below is the last comment left by the admin when changing the status etc

echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br(htmlspecialchars_decode($this->orderDetails['history'][$nb-1]->comments, ENT_COMPAT)));
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

EsSa55

So,

<?php $nb=count($this->orderDetails['history']);
if($this->orderDetails['history'][$nb-1]->customer_notified && !(empty($this->orderDetails['history'][$nb-1]->comments))) { ?>
<tr>
<td width="580" colspan="3" style="border: 1px solid #CCCCCC;">
<?php echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br(htmlspecialchars_decode($this->orderDetails['history'][$nb-1]->comments, ENT_COMPAT))); ?>
</td>
</tr>
<?php } ?>
<?php if(!empty($this->orderDetails['details']['BT']->customer_note)){ ?>
<tr>
<td width="580" colspan="3" style="border: 1px solid #CCCCCC;">
<?php echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br($this->orderDetails['details']['BT']->customer_note)) ?>
</td>
</tr>

ES-> ?

dstockman

I know this is a bit out of date but I had the same problem on a client site when suddenly their html customer email messages that came from Status Updates in an Order weren't rendering and just came out as flat text, no line breaks or anything. Unfortunately the htmlspecialchars_decode fix did not work and I wound up using html_entity_decode for this.

<?php echo html_entity_decode($this->orderDetails['history'][$nb-1]->comments); ?>

I would not recommend that for customer comments but in my case this is only for the Admin order updates to customers that my client just copy/pastes in with shipping link/info. Also since this isn't the customer comments the earlier replies did not really use the right language constant. I am not sure what it should be since I just used the bare echo here.

GJC Web Design

hi Eddie

yes

use

<?php echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br(htmlspecialchars_decode($this->orderDetails['history'][$nb-1]->comments, ENT_COMPAT))); ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

holanpan7

Hi,

I tried the code on VirtueMart 3.6.2 10159 and it doesn't seems to work. Was there any more changes since V3.2.14.?
Any ideas?

Thanks

holanpan7


As mentionned by dstockman, html_entity_decode is working fine for me too.

<?php echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br(html_entity_decode($this->orderDetails['history'][$nb-1]->comments))); ?>

encreplus

Quote from: holanpan7 on November 19, 2019, 17:15:12 PM

As mentionned by dstockman, html_entity_decode is working fine for me too.

<?php echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br(html_entity_decode($this->orderDetails['history'][$nb-1]->comments))); ?>


Where did you put that code ?

GJC Web Design

front end?

then templates\xxxx\html\com_virtuemart\invoice\mail_html_shopper.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

encreplus

Quote from: GJC Web Design on March 01, 2019, 16:04:56 PM
hi Eddie

yes

use

<?php echo vmText::sprintf('COM_VIRTUEMART_MAIL_SHOPPER_QUESTION',nl2br(htmlspecialchars_decode($this->orderDetails['history'][$nb-1]->comments, ENT_COMPAT))); ?>

thanks it help me a lot ...

Quick question, how can i do the same with details_history.php  ---    <?php echo $_hist->comments; ?>

Is it possible ?