magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

New feature: Highlight popular countries in country select

Open ma4nn opened this issue 1 year ago • 2 comments

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 (*)

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

ma4nn avatar Jul 07 '24 16:07 ma4nn

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

SuSiSonnenschein111 avatar Jul 11 '24 03:07 SuSiSonnenschein111

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..

ma4nn avatar Jul 11 '24 08:07 ma4nn

@kiatng cs ... :P

sreichel avatar Dec 09 '24 06:12 sreichel