-
Notifications
You must be signed in to change notification settings - Fork 9.4k
resolved default country selection issue while creating new customer … #13024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolved default country selection issue while creating new customer … #13024
Conversation
/** | ||
* @var \Magento\Store\Model\StoreManagerInterface | ||
*/ | ||
protected $storeManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid adding new protected
methods and properties. This may be made private.
@@ -98,6 +103,7 @@ public function __construct( | |||
\Magento\Framework\Stdlib\ArrayUtils $arrayUtils, | |||
\Magento\Framework\Locale\ResolverInterface $localeResolver, | |||
\Magento\Framework\App\Helper\AbstractHelper $helperData, | |||
\Magento\Store\Model\StoreManagerInterface $storeManager, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a new required parameter to the constructor may break compatibility for any client code that already extends it.
To try and avoid it please refactor it in the backward compatible way. More information is available in the devdocs.
@@ -275,6 +282,15 @@ public function toOptionArray($emptyLabel = ' ') | |||
$sort = [$name => $foregroundCountry] + $sort; | |||
} | |||
$isRegionVisible = (bool)$this->helperData->isShowNonRequiredState(); | |||
$defaultCountry = []; | |||
foreach ($this->storeManager->getWebsites() as $website) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to load configurations for all the websites at once?
@@ -46,6 +46,19 @@ define([ | |||
|
|||
this.setOptions(result); | |||
this.reset(); | |||
|
|||
if(!this.value()){ | |||
_.each(result, function (item) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it is possible to refactor this using _.filter
?
Hi @pradeep-wagento
|
Applied changes requested by @ishakhsuvarov |
Backend Works
Description
Insert the "is_default" field country options based on website scope into country option array.
Used the "is_default" value in customer edit address form to pre selected the country.
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist