Skip to content

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

Conversation

pradeep-wagento
Copy link
Contributor

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)

  1. Default country selection issue while creating new customer from backend #3483: Default country selection issue while creating new customer from backend

Manual testing scenarios

  1. Fresh Install
  2. Tested in all Modes
  3. Ran Successfull Test Cases

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jan 7, 2018

CLA assistant check
All committers have signed the CLA.

@dmanners dmanners added the mm18in label Jan 7, 2018
@magento-engcom-team magento-engcom-team added bugfix Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Jan 7, 2018
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;
Copy link
Contributor

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,
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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?

@ishakhsuvarov
Copy link
Contributor

Hi @pradeep-wagento
Thank you for your contribution. Please fix the following so we will be able to proceed with the processing:

@sidolov
Copy link
Contributor

sidolov commented Mar 9, 2018

Applied changes requested by @ishakhsuvarov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Award: test coverage bugfix Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants