dotmailer / dotmailer-magento2-extension

The official Dotdigital for Magento2 extension
https://dotdigital.com/integrations/magento
MIT License
48 stars 63 forks source link

Store ID should be sent in getScopeAdjustedDob() #554

Closed gingerben closed 4 years ago

gingerben commented 4 years ago

In the file dotmailer/dotmailer-magento2-extension/Model/Apiconnector/ContactData.php

line 171 you are sending the website ID, this should be set to send the store ID case 'dob': $value = $this->model->getDob() ? $this->getScopeAdjustedDob($this->model->getWebsiteId()) : null; break;

should be

case 'dob': $value = $this->model->getDob() ? $this->getScopeAdjustedDob($this->model->getStoreId()) : null; break;

ContactData.php.zip

sta1r commented 4 years ago

@gingerben Thanks for raising. It's true that most calls to TimezoneInterface::scopeDate() in core do get passed a store id for the $scope param. We assumed here that because 'Timezone' is website-scope, then $websiteId was what we needed to pass in to get a scoped date.

We'll fix to use $storeId but would be interested to learn more about the impact in your case?

gingerben commented 4 years ago

hi @sta1r

it had no impact on the front end, but the ddg_automation_order_sync cron twas failing every time. this was because our website ids and store ids do not match

we have a store with a website id of 4 but a store id of 11, this was causing a no such entity exception as the store id it was looking for does not exist.

thanks

ben

sta1r commented 4 years ago

Thanks. I'm puzzled as to how your order sync issue and the getScopeAdjustedDob() method are related - we only get the DOB when syncing contacts. However the change to use store ID is now in develop and will be released this week in 4.3.3.

gingerben commented 4 years ago

Cheers for the update

Also I was getting the wrong cron mixed up, it was the contacts, the order cron was failing when deleted products were on orders which was fixed in 4.3.2.

Thanks Ben