limegrow / ingenico-m2-payments

2 stars 15 forks source link

Bug with multi stores and email #7

Closed angelflo closed 3 years ago

angelflo commented 3 years ago

Hi,

Theire are some bugs with the sendreminder (and probably other email) feature in your last version of m2-payment extension for magento 2.4.2. We use multisite feature and it doesn't work as expected :

m2-payment/Model/Connector.php

public function sendMail => in your original code you use : ->setFrom($sender) in that case the Sender used is not the good one and display another website Sender Name

I tried to replace it by new version of the Magento 2.4.2 core specification : (see note in magento/Framework/Mail/Template/TransportBuilder.php) ->setFromByScope($sender) But in that case, it now use the backend info (and still not the email define at the website level in backend for the corresponding website of the order)

Do you have a solution for this issue please ... it's a really big pb for us?

AND ALSO in the email reminder received : Header and footer of the template are well relative to the good website domain BUT : %shop_name% variable return the name of the root website when it should return the name of the corresponding website of the order => so thereminder.text1 message doesn't display the name of the good website domain $imageUrl variable also return the name of the root website when it should return the name of the corresponding website of the order => so the picture doesn't display in the reminder email

A fix to solve all these bug are more than welcome.

Thanks a lot

angelflo commented 3 years ago

UPDATE : In Connector.php if i use ->setFromByScope($sender,$this->getStoreId()) in replacement of ->setFrom($sender)

It now use the good sender name and email

so pleae, can you confirm this fix is the good solution to fix this bug ?

Now, need to fix other bug in your email

1/ For the Logo who doesn't display the good website info : why do you have commented //$this->_getStoreEmailLogo($order->getStoreId()) does it mean that your function doesn't work correctly ? how to fix it properly ?

2/ For the store name who is not the good store name relative to website of the order $this->_cnf->getStoreName() this part doesn't return the good info.

angelflo commented 3 years ago

UPDATE

Connector.php

You don't have the good website if you use : AbstractConnector::PARAM_NAME_SHOP_URL => $this->getUrl('') The getUrl() need to be called inside the startEnvironmentEmulation

So please define something like this $this->setOrderId($orderId); $order = $this->_processor->getOrderByIncrementId($orderId); $this->_appEmulation->startEnvironmentEmulation($order->getStoreId(), \Magento\Framework\App\Area::AREA_FRONTEND, true); // DEFINE HERE $ShopUrl = $this->getUrl(''); .... $this->_appEmulation->stopEnvironmentEmulation();

And REPLACE AbstractConnector::PARAM_NAME_SHOP_URL => $this->getUrl(''), BY AbstractConnector::PARAM_NAME_SHOP_URL => $ShopUrl,

angelflo commented 3 years ago

Hi,

Please can you give me an answer to solve bugs relative to multi-sites and if my logic is correct, please can you integrate the patch above to your extension and apply it also for the other emails ... waiting an answer since more than 20 days now. currently can't use your extension and your payment process in production due to these bugs :-(

olegisk commented 3 years ago

@angelflo Please don't worry. We are working on that. We will release new version very soon

olegisk commented 3 years ago

@angelflo Can you contact me please? oleg@iskusnyh.pro

angelflo commented 3 years ago

did you receive my email ?

olegisk commented 3 years ago

@angelflo Yes, i've sent you answer

angelflo commented 3 years ago

Hi, Version 2.7.0 seems to fix the multisite bugs. Need more investigation to validate all cases but I had currently check the reminder email and it's ok. Thanks for your job.

raidoa commented 3 years ago

@angelflo Hi! Is this issue resolved?

olegisk commented 3 years ago

@raidoa I think this issue was resolved and can be closed