Closed cdiacon closed 7 years ago
@adeelq we don't task for this one, what was this about https://github.com/dotmailer/dotmailer-magento2-extension/commit/4856cc04dff5fba10bc3e115bea76c5f8a9fe443 ?
@cdiacon As per this commit https://github.com/adeelq/dotmailer-magento2-extension/commit/915c40e8a59ad56d50b1d7449405a87e8194799c We will not find and create guest during order sync prcoess
However from above commit this code will create duplicates since we will be getting all guest contacts that are not in contacts table. So there can be more then one guest order made by same guest contact.
//get the order collection
$salesOrderCollection = $this->salesOrderFactory->create()
->getCollection()
->addFieldToFilter('customer_is_guest', ['eq' => 1])
->addFieldToFilter('customer_email', ['notnull' => true])
->addFieldToFilter('customer_email', ['nin' => $contacts]);
foreach ($salesOrderCollection as $order) {
$storeId = $order->getStoreId();
$websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
//add guest to the list
$this->guests[] = [
'email' => $order->getCustomerEmail(),
'website_id' => $websiteId,
'store_id' => $storeId,
'is_guest' => 1
];
}
I'm closing this and will be doing commit in the original issue https://github.com/dotmailer/dotmailer-magento2-extension/issues/187
Modified orders will create duplicate guest in email_contact table for the same websites.