magepal / magento2-edit-order-email

Magento2 - Edit Order Email from Admin
http://www.magepal.com
33 stars 13 forks source link

Update customer record email address not working #1

Closed visualwebs closed 4 years ago

visualwebs commented 4 years ago

Hi, developers

I want to notice an issue in our installation of Magento 2.3.2

When you have the value of 'Automatically update customer record email address' to No (Default) and you edit the order e-mail checking the checkbox ' Update Customer Record', the customer data are is really not modified. I debugged the MagePal\EditOrderEmail\Controller\Adminhtml\Edit\Index and the 'update_customer_email' param received appears undefined, so the logic never proceeds to change the e-mail in the customer account.

I think the solution would be just to change the part of template view/adminhtml/templates/email.phtml

<input type="checkbox" class="checkbox" id="update_customer_email" name="update_customer_email" value="<?= $block->getAutocheckEmail() ?>" <?= $checked ?>>

to

<input type="checkbox" class="checkbox" id="update_customer_email" name="update_customer_email" value=1 <?= $checked ?>>

I tested it and looks working.

srenon commented 4 years ago

@visualwebs ... I will look into this shortly

But instead of changing the phtml try

in app/code/MagePal/EditOrderEmail/Block/Adminhtml/Email/Edit.php

Change this method from

public function getAutocheckEmail()
{
    return $this->_helper->getConfigValue('magepal_editorderemail/general/update_customer_email');
}

To

public function getAutocheckEmail()
{
    return $this->_helper->getConfigValue('magepal_editorderemail/general/update_customer_email') ? 1 : 0;
}
srenon commented 4 years ago

@visualwebs ... Thanks for reporting these issues. Please download the latest version