serdib Posted October 19, 2015 Share Posted October 19, 2015 (edited) Hello! When i make any PayPal transaction from orders page in prestashop i got messages in one line (please see screenshot). Refund operation result:REFUNDTRANSACTIONID: 51876667NM744635YFEEREFUNDAMT: 1.56GROSSREFUNDAMT: 46.00NETREFUNDAMT: 44.44CURRENCYCODE: GBPTOTALREFUNDEDAMOUNT: 46.00TIMESTAMP: 2015-10-19T10:23:11ZCORRELATIONID: 2d5659572b776ACK: SuccessVERSION: 106.0BUILD: 18308778REFUNDSTATUS: InstantPENDINGREASON: NonePayPal refund successful! I need to make paypal messages lookes like this (write new parameter as new line) Refund operation result: REFUNDTRANSACTIONID: 51876667NM744635YFEE REFUNDAMT: 1.56 GROSSREFUNDAMT: 46.00 NETREFUNDAMT: 44.44 CURRENCYCODE: GBP TOTALREFUNDEDAMOUNT: 46.00 I think this is some kind of bug. Because in 'paypal.php' i see this section with <br> tag included public function formatMessage($response, &$message) { foreach ($response as $key => $value) $message .= $key.': '.$value.'<br>'; } How can i fix this? Already tried to: replace <br> with <br />, reinstall module, clear cache. Thank you P.S. (Prestashop 1.6.1.1 + PayPal 3.10.2 Europe) Edited October 20, 2015 by serdib (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 19, 2015 Share Posted October 19, 2015 well, view the source of that html and see if those "br" elements have been removed of perhaps escaped Link to comment Share on other sites More sharing options...
serdib Posted October 19, 2015 Author Share Posted October 19, 2015 Yes, bellini13, this is excactly what happens. There is no <br> tag in source. But why? As i wrote before '<br>' tag exists in 'function formatMessage' Link to comment Share on other sites More sharing options...
bellini13 Posted October 25, 2015 Share Posted October 25, 2015 I do not know the exact reason, but my guess is that the message is being sanitized before it is displayed. You would have to trace through Prestashop's code and see what it is doing. Did you look at the message in the database and see if those <br> exist in the database? Perhaps they are removed before they are saved Link to comment Share on other sites More sharing options...
serdib Posted October 29, 2015 Author Share Posted October 29, 2015 (edited) I have found that in the database (ps_message table) this message is one line also (please see attachment). Also tried at my localhost. All the same. Edited October 29, 2015 by serdib (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 29, 2015 Share Posted October 29, 2015 this means that either the paypal module or the prestashop core has 'cleansed' this message before adding it to the database. This is the function from the Paypal module that is actually storing it in the database. You can see that the module uses the php strip_tags function to cleanse the message, but does use '<br>' as the second parameter, which means to ignore cleansing it. So either this is defective, or something in Prestashop core is removing them. You can prove this theory by commenting out the strip_tags line from the addNewPrivateMessage function and perform a test to see what happens. If it works, then you know the strip_tags function is defective. If it does not work, then you will need to dive deeper into the PS core code to see what is happening. public function _addNewPrivateMessage($id_order, $message) { if (!(bool)$id_order) return false; $new_message = new Message(); $message = strip_tags($message, '<br>'); if (!Validate::isCleanHtml($message)) $message = $this->l('Payment message is not valid, please check your module.'); $new_message->message = $message; $new_message->id_order = (int)$id_order; $new_message->private = 1; return $new_message->add(); } Link to comment Share on other sites More sharing options...
serdib Posted October 29, 2015 Author Share Posted October 29, 2015 (edited) You can prove this theory by commenting out the strip_tags line from the addNewPrivateMessage function and perform a test to see what happens. If it works, then you know the strip_tags function is defective. If it does not work, then you will need to dive deeper into the PS core code to see what is happening. Thanks for your reply! I tried to comment and delete this line $message = strip_tags($message, '<br>'); but it is still the same. In database too. Even tried in three different versions of Prestashop. Updated: tried with Prestashop 1.6.1.2rc4 — same issue. Edited October 29, 2015 by serdib (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 29, 2015 Share Posted October 29, 2015 so this should safely tell you that Prestashop core coding is removing these. I don't know where in the core code, that is something you will need to dive deeper into Link to comment Share on other sites More sharing options...
serdib Posted November 2, 2015 Author Share Posted November 2, 2015 (edited) I also tried to turn off HTML purifier (thanks Nemo for his tip — https://www.youtube.com/watch?v=ATsUtWH1bWw) with no luck . Thank you bellini13 for your help anyway! I have created bug report here — http://forge.prestashop.com/browse/PNM-3676 Edited November 14, 2015 by serdib (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now