Skip to content
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

New feature: Highlight popular countries in country select #4089

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ma4nn
Copy link
Contributor

@ma4nn ma4nn commented Jul 7, 2024

Description (*)

This PR backports a feature from Magento 2 (in a nicer way with option groups) that allows to configure countries that will be shown on top of the country list ("popular countries").

Also the code duplication for Mage_Checkout_Block_Onepage_Abstract::getCountryHtmlSelect() and Mage_Directory_Block_Data::getCountryHtmlSelect() is removed.

In addition a new event directory_get_top_countries is added, that allows to customize the logic (e.g. to determine top countries automatically from quotes/orders).

Bildschirmfoto 2024-07-07 um 11 15 54

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

Repeat the following tests 1.-5. for country dropdown in

  • cart estimate shipping
  • checkout billing
  • checkout shipping
  • customer account address edit
  • customer account register
  1. Disable config cache
  2. Without any configuration the country dropdown looks the same as before
  3. Configure one top country in System > Configuration > General > Countries Options > Top Countries and verify the country dropdown
  4. Configure multiple top countries in System > Configuration > General > Countries Options > Top Countries and verify the country dropdown
  5. Enable config cache, assure options are cached by reloading page multiple times and repeat steps 2-4
  6. Verify product attribute country_of_manufacture uses non-sorted country list in backend
  7. Verify product attribute country_of_manufacture can be displayed correctly on product detail page
  8. In checkout select "Ship to different address", then in shipping form select "Use Billing Address" and change country value -> "Use Billing Address" should be unchecked then

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

ma4nn added 3 commits July 7, 2024 11:19
…() to use related method in Mage_Directory to avoid code duplication, moved new code for top countries also to Mage_Directory
@github-actions github-actions bot added Component: Checkout Relates to Mage_Checkout Template : base Relates to base template Component: Directory Relates to Mage_Directory labels Jul 7, 2024
@SuSiSonnenschein111
Copy link

SuSiSonnenschein111 commented Jul 11, 2024

Please re-check ... cache-key DIRECTORY_COUNTRY_SELECT_STORE_ is used at several places ... (not tested nothing, just an idea)

@ma4nn
Copy link
Contributor Author

ma4nn commented Jul 11, 2024

Please re-check ... cache-key DIRECTORY_COUNTRY_SELECT_STORE_ is used at several places ... (not tested nothing, just an idea)

@SuSiSonnenschein111 thanks for your feedback (although it could have been a little bit more detailed).
By "several places" you mean Mage_Catalog_Model_Product_Attribute_Source_Countryofmanufacture?

But I agree, the result before sorting should be cached, I've pushed the change and extended the testing scenarios.

Moreover probably Mage_Catalog_Model_Product_Attribute_Source_Countryofmanufacture::getAllOptions() and Mage_Directory_Block_Data::getCountryHtmlSelect() should also be refactored further to remove the code duplication..

fballiano
fballiano previously approved these changes Jul 15, 2024
Copy link
Contributor

@fballiano fballiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quickly tested on frontend and backend and works fine

@fballiano fballiano changed the title Highlight popular countries in country select New feature: Highlight popular countries in country select Jul 15, 2024
@github-actions github-actions bot added the translations Relates to app/locale label Jul 17, 2024
@sreichel sreichel self-assigned this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Checkout Relates to Mage_Checkout Component: Directory Relates to Mage_Directory Template : base Relates to base template translations Relates to app/locale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants