magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.52k stars 9.31k forks source link

Tablerate Shipping regex not correct at RateQuery:134 #23948

Closed delve-game-studios closed 3 years ago

delve-game-studios commented 5 years ago

Preconditions (*)

  1. Magento version 2.3.2
  2. UK zip codes are separated by space not a dash and the tablerate plugin doesn't recognize it.
  3. File to be fixed: magento/module-offline-shipping/Model/ResourceModel/Carrier/Tablerate/RateQuery.php at line 134. It checks for prefixes from zip codes that are separated only by as dash but UK zip codes are separated by empty space.

Steps to reproduce (*)

  1. Add records to the DB with some specific ZIP code prefixes from the UK image

  2. Try to input your address in the checkout page with a full ZIP code. be sure to input the correct format e.g: "AB31 2AR"

image

Expected result (*)

  1. Show me the correct shipping method

Actual result (*)

  1. There is no shipping method found.

image

Way of fixing (*)

Add the white space as an option in the regex.

"/^(.+)-(.+)$/" - Original Regex "/^(.+)(\s|-)(.+)$/" - Fixed Regex

This way it will get the correct prefix and will show the

m2-assistant[bot] commented 5 years ago

Hi @milan-vugrinchev. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@milan-vugrinchev do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


m2-assistant[bot] commented 5 years ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

heldchen commented 5 years ago

this should be a configurable option (with a sane default) IMO, as it makes too many assumptions that are valid for just one (US?) / a few countries currently.

engcom-Bravo commented 5 years ago

Hello @milan-vugrinchev, Thanks for applying. Would You please give us a reference to the official source on Table Rate shipping method in Magento where it is said that the rate of a particular record in the DB table will be applied to all zip-codes starting with a string given in dest_zip field of that record. Or anything else saying that dest_zip value is not necessarily supposed to be a valid zip-code in order for the according rate to be applied. Thank You.

delve-game-studios commented 5 years ago

Can’t really give anything of value just stating that this should be an issue because it’s not said that the TableRate shipping method for (for example US only method) that’s the idea behind my issue. UK zip codes start with String and are separated by space not a dash. I would only like this to be an official release instead of me touching vendor folder. That’s all.

Best Regards, Milan Vugrinchev

From: Alexander Potoky Sent: Wednesday, July 31, 2019 11:52 AM To: magento/magento2 Cc: Milan Vugrinchev; Mention Subject: Re: [magento/magento2] Tablerate Shipping regex not correct atRateQuery:134 (#23948)

Hello @milan-vugrinchev, Thanks for applying. Would You please give us a reference to the official source on Table Rate shipping method in Magento where it is said that the rate of a particular record in the DB table will be applied to all zip-codes starting with a string given in dest_zip field of that record. Or anything else saying that dest_zip value is not necessarily supposed to be a valid zip-code in order for the according rate to be applied. Thank You. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

engcom-Bravo commented 5 years ago

Thank You for replly @milan-vugrinchev. Seems there is some misunderstanding. If You store not the prefix but the valid UK zip-code in the DB (like AB31 2AR with a space in between, just as it should be) then everything will work properly. And as so then where the bug is?

engcom-Bravo commented 5 years ago

Or @milan-vugrinchev You mean there is no bug. You simply want Magento to be able to work with prefixes and not just with the full zip-codes?

delve-game-studios commented 5 years ago

Of course… otherwise we’ll have a 100GB table only for zip codes and for each zip code there’ll be at least 20 rows for price per package_value_with_discount … which makes this method inefficient. It has the functionality to check for prefixes but only one kind… not everywhere the zip code is separated from the prefix with a dash in some countries is a space.

Best Regards, Milan Vugrinchev

From: Alexander Potoky Sent: Wednesday, July 31, 2019 2:08 PM To: magento/magento2 Cc: Milan Vugrinchev; Mention Subject: Re: [magento/magento2] Tablerate Shipping regex not correct atRateQuery:134 (#23948)

Or @milan-vugrinchev You mean there is no bug. You simply want Magento to be able to work with prefixes and not just with the full zip-codes? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

engcom-Bravo commented 5 years ago

Ok, @milan-vugrinchev, now everything has become clear. We are confirming Your issue. Thanks for reporting.

magento-engcom-team commented 5 years ago

:white_check_mark: Confirmed by @engcom-Bravo Thank you for verifying the issue. Based on the provided information internal tickets MC-18786 were created

Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] commented 5 years ago

Hi @maheshWebkul721. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Thank you for your contributions.

magento-engcom-team commented 3 years ago

Unfortunately, we are archiving this ticket now as it did not get much attention from both Magento Community and Core developers for an extended period. This is done in an effort to create a quality, community-driven backlog which will allow us to allocate the required attention more easily.

Please feel free to comment or reopen according to the Issue reporting guidelines the ticket if you are still facing this issue on the latest 2.x-develop branch. Thank you for collaboration.