Jump to content

After 1.6.1.1 upgrade, now every order I get there is a new message.


Recommended Posts

I upgraded my shop to 1.6.1.1 last week.  Now every single order that is processed, there is a new message for it.    The message has transaction ID details, and for orders I create manually the message gives me details on who created the order.

This is creating a bunch of spam in my messages box, and I would like to disable this.   Is there a new feature for this I can shut off, or a modification to code that can stop it?

 

 

Link to comment
Share on other sites

There appears to be some change since PS v1.6.1 where private messages added by Payment Modules are appearing like customer messages. 

 

I'm not sure if this was an intentional change by Prestashop, or something done inadvertently.  Your best approach is to report the issue to Prestashop's forge so the development team is aware of the issue and can determine what to do about it.

 

The change itself occurred back in February with this commit.  Of course there is no reason given

https://github.com/PrestaShop/PrestaShop/commit/8d10e02ad0288a929f0a43416d6df08fe5aad15f

 

The change appears to be in PaymentModule.php, around line 424. 

// Optional message to attach to this order
if (isset($message) & !empty($message))
{
    $msg = new Message();
    $message = strip_tags($message, '<br>');
    if (Validate::isCleanHtml($message))
    {
        if (self::DEBUG_MODE)
            PrestaShopLogger::addLog('PaymentModule::validateOrder - Message is about to be added', 1, null, 'Cart', (int)$id_cart, true);
        $msg->message = $message;
        $msg->id_cart = (int)$id_cart;
        $msg->id_customer = intval($order->id_customer);
        $msg->id_order = intval($order->id);
        $msg->private = 1;
        $msg->add();
    }
}

Private messages like these were not associated to a cart or customer previously, but in PS v1.6.1 they added these 2 lines

        $msg->id_cart = (int)$id_cart;
        $msg->id_customer = intval($order->id_customer);

I tested by removing this line from the code above, and a customer message is no longer received.  I'm not sure what other effect this has, since they did not provide any reason why they made this change

        $msg->id_cart = (int)$id_cart;
Edited by bellini13 (see edit history)
  • Like 3
Link to comment
Share on other sites

I found the file PaymentModule.php within the 

 

shop/classes (43 kb, file date July 2015)

shop/override/classes  (30kb, file date January 2015) 

shop/modules/eu_legal/override/classes (file compare = equal to above)

 

The text "$msg->id_cart = (int)$id_cart;" is only within the shop/classes file and the text above is: "Optional message to attach to this order". I took out this whole part (/* */) and hope the next order will still work and be without any message. Fingers crossed!  B) 

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

 

There appears to be some change since PS v1.6.1 where private messages added by Payment Modules are appearing like customer messages. 

 

I'm not sure if this was an intentional change by Prestashop, or something done inadvertently.  Your best approach is to report the issue to Prestashop's forge so the development team is aware of the issue and can determine what to do about it.

 

The change itself occurred back in February with this commit.  Of course there is no reason given

https://github.com/PrestaShop/PrestaShop/commit/8d10e02ad0288a929f0a43416d6df08fe5aad15f

 

The change appears to be in PaymentModule.php, around line 424. 

// Optional message to attach to this order
if (isset($message) & !empty($message))
{
    $msg = new Message();
    $message = strip_tags($message, '<br>');
    if (Validate::isCleanHtml($message))
    {
        if (self::DEBUG_MODE)
            PrestaShopLogger::addLog('PaymentModule::validateOrder - Message is about to be added', 1, null, 'Cart', (int)$id_cart, true);
        $msg->message = $message;
        $msg->id_cart = (int)$id_cart;
        $msg->id_customer = intval($order->id_customer);
        $msg->id_order = intval($order->id);
        $msg->private = 1;
        $msg->add();
    }
}

Private messages like these were not associated to a cart or customer previously, but in PS v1.6.1 they added these 2 lines

        $msg->id_cart = (int)$id_cart;
        $msg->id_customer = intval($order->id_customer);

I tested by removing this line from the code above, and a customer message is no longer received.  I'm not sure what other effect this has, since they did not provide any reason why they made this change

        $msg->id_cart = (int)$id_cart;

 

Will a normal message a customer leaves with an order still show with this method?

Link to comment
Share on other sites

Yes they are separate things.  When the customer adds a message during checkout, that message is actually saved immediately to the database and associated to the id_cart.

 

Then when a payment module adds a private message during order creation, a second entry is added to the database and is supposed to be associated to the order, not the cart.  Well at least that is how it used to work.

 

I've tested this under PS v1.6.1.2 were they have applied a different solution to fix the issue.  I don't recall exactly what it was, but I believe they make proper use of the private indicator finally.

Link to comment
Share on other sites

  • 8 months later...

is there a way without having to go and edit the source code to be able to deactivate private customer order messages? Every time I change the order by adding or removing products, it sends the customer a new mail for each item I add or remove, if I add 4 items it sends 4 e-mails, if I remove 4 items it sends 4 e-mails again.The customers are complaining we are spamming their inbox with mails, How do I disable this function only with order changes?

Link to comment
Share on other sites

try to add + call this url manualy to your domain.../admin.../index.php?tab=AdminModules&tab_module=&module_name=mailalerts&anchor=Mailalerts

 

Should give a security warning (just ignore and continue). MailAlert is part of the Prestashop installation and the Cloud version.

 

Or have you set a "filter" to only see "active" modules - or only special authors?

Link to comment
Share on other sites

Thanks, tried that. It's the module I said earlier that wasn't installed. So the shop must have a pre-installed module for order messages. I now installed this mail alerts module and disabled the order edit notification, but I am still getting e-mails sent out to customers for every edit I make to an order by adding or removing products. Any other suggestions? Thanks

Link to comment
Share on other sites

is there a way without having to go and edit the source code to be able to deactivate private customer order messages? Every time I change the order by adding or removing products, it sends the customer a new mail for each item I add or remove, if I add 4 items it sends 4 e-mails, if I remove 4 items it sends 4 e-mails again.The customers are complaining we are spamming their inbox with mails, How do I disable this function only with order changes?

What version of Prestashop are you using... be specific...

Link to comment
Share on other sites

This is the function "sendChangedNotification" in the AdminOrdersController.php. 

 

This function appears to be called three times

1) When a product is added to an order

2) When a product is deleted from an order

3) When a product is editted for an order (something like a quantity change)

 

 

In PS v1.6.0.14, there is no option to disable this, so you would need to edit the sendChangedNotification function so it does not send the email.

 

Alternatively, it appears in the latest version of Prestashop (v1.6.1.6) that an email is not sent.  They replaced the sending of an email, with the 'actionOrderEdited' hook.  This means that the mailalerts module was updated with an option to enable/disable sending an email to the customer. 

 

So that gives you 2 more options

1) you could update your store to PS v1.6.1.6.  If you are using mailalerts module, then you could configure mailalerts module to disable sending emails upon order edit

2) you could change the sendChangedNotification function in AdminOrdersController.php so that it uses the code from PS v1.6.1.6

Link to comment
Share on other sites

  • 2 weeks later...

Great, thank you for this help.

 

If I upgrade my current version of PS, will it remove any of the information, content or products that I have loaded onto my shop at all??

Also, how would I go about changing the sendChangedNotification function in AdminOrdersController.php so that it uses the code from PS v1.6.1.6?? I'm not a computer programmer.

 

Thanks for the help again.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...