This issue has been migrated from the Forge. Read the original ticket here.
Description
Private order messages created by validateOrder() from payment modules don't appear in the order page anymore.
Here is the change that created the bug: https://github.com/PrestaShop/PrestaShop/commit/e2b7a6e8dd73445136264dcdf0e4b199e1926cf3#diff-e8c291800c04b4827220486f7d14fef2
聽
Solution
To display the private message from the payment module.
How to reproduce the issue?
This comment has been migrated from the Forge. Read the original comment here.
Oops, for the bug recreation it should be ps_wirepayment/ not ps_wiretransfer/
This comment has been migrated from the Forge. Read the original comment here.
Hi Zack Hussain,
Are you talking about the message the customer can add during the order process ?
Or is it the message you can manually add to the invoice ?
Thanks & best regards, Salma
This comment has been migrated from the Forge. Read the original comment here.
Hi Salma,
It is neither of those messages.聽It's the messages added to orders by payment modules via the validateOrder() function. For example,聽a credit card payment module may output transaction data to the order messages upon a successful payment.
The messages passed to validateOrder() get stored in the ps_message聽table, but the aforementioned git commit changed the order page to retrieve those messages from ps_customer_message instead.
You can recreate it the way I explained above, by modifying the ps_wiretransfer module to output a message upon order validation. Notice that the order message will not appear, even though it is stored in ps_message.
This comment has been migrated from the Forge. Read the original comment here.
Hi Zack Hussain,
Thanks for the clarification.
I manage to reproduce the issue with the last version : 1.7.3.0 beta 1.
We will see how to fix it.
Thanks & best regards, Salma
This comment has been migrated from the Forge. Read the original comment here.
Hi Zack Hussain,
Thanks for diving into this!
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
This comment has been migrated from the Forge. Read the original comment here.
Hi Marion,
I tried, but unfortunately I don't have a good solution! Here's the initial issue that caused it聽https://github.com/PrestaShop/PrestaShop/pull/7789.聽It was because messages entered from the Order Details page weren't showing up on the AdminOrders page.
So the solution is to query all ps_message and ps_customer_message results into one array in AdminOrdersController.php on line 1864.
I tried:聽
'messages' => array_merge(Message::getMessagesByOrderId($order->id, true), CustomerThread::getCustomerMessagesOrder($order->id_customer, $order->id)),
But the results were not sorted by date. Someone should modify Message::getMessagesByOrderId() to query all ps_message & ps_customer_message rows sorted by date_add and it should fix it. I would do it but queries are not my strong suit.
Cheers,
This comment has been migrated from the Forge. Read the original comment here.
Hi Zack Hussain,
Thank you very much for these details !
It's added to our debug roadmap, we will see how to fix it.
Regards
Hello, please do not forget about this fix since we have several clients using our payment method that are missing the transaction information in prestashop 1.7.x and there is a heavy disadvantage.
Paga+Tarde
hi ho prestashop 1.7.5.0 but unfortunately this problem has not yet been solved.
How can I solicit the resolution?
Hi @mauweb,
Sorry, it is not fixed yet.
It is added to our bug roadmap so that it will be fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks for your understanding!
this bug creates big problems for me too with the message on the orders ... I use fastbay and I always have problems because I don't see the messages prestashop 1.7.5.1
Here is a quick fix for anyone that can't wait for a real solution:
Open the file /controllers/admin/AdminOrdersController.php and change the following (around line 1864 on PS 1.7):
'messages' => CustomerThread::getCustomerMessagesOrder($order->id_customer, $order->id),
To:
'messages' => array_merge(CustomerThread::getCustomerMessagesOrder($order->id_customer, $order->id), Message::getMessagesByOrderId($order->id, true)),
perfect zhmedia
thank you so much
Hey @khouloudbelguith, I think the issue is fixed. I receive well the message after the checkout on the order page. Could do a double-check for me to be sure? :smile:
Hi @MatShir,
I did not manage to reproduce the issue with PS1768 and PS1770rc1build2.
FO
BO
1768
1770rc1build2.
Since it is fixed, I close the issue.
Thanks!
@khouloudbelguith , @MatShir This bug is not concerning the customer leaving a comment on the checkout page, it is concerning payment modules leaving order messages when the order is validated (e.g. transaction details). This was described in one of my above messages:
It's the messages added to orders by payment modules via the validateOrder() function. For example, a credit card payment module may output transaction data to the order messages upon a successful payment.
I would suggest trying to reproduce the issue the way I had described earlier before closing this issue:
- Recreate by adding "test message" message to validateOrder() in ps_wirepayment/controllers/front/validation.php
- $bankwire->validateOrder($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $bankwire->displayName, "test message", array(), (int)$currency->id, false, $customer->secure_key);
- Place an order using Bankwire payment method and notice there are zero messages in the order page.
My apologies @zhmedia! it is the end of the day, I have been too hasty.
Thanks for your clarification.
Most helpful comment
Hello, please do not forget about this fix since we have several clients using our payment method that are missing the transaction information in prestashop 1.7.x and there is a heavy disadvantage.
Paga+Tarde