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.5k stars 9.31k forks source link

Active state of shipping method not respecting store scope config in adminhtml #14664

Closed JeroenVanLeusden closed 5 years ago

JeroenVanLeusden commented 6 years ago

Preconditions

  1. Magento 2.2.2
  2. PHP 7.1.15-1
  3. MySQL 5.7.16-10

Steps to reproduce

  1. Make sure all shipping methods are disabled.
  2. Add group to a etc/adminhtml/system.xml file
    <group id="subscription_carriers" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Shipping Methods</label>
    <field id="shipping_methods" translate="label" type="multiselect" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
        <label>Enabled Shipping Methods</label>
        <source_model>Magento\Shipping\Model\Config\Source\Allmethods</source_model>
    </field>
    </group>
  3. Change to website view scope.
  4. Enable shipping method flatrate on a website scope.
  5. Go to your module where above added group will be shown.

Expected result

  1. flatrate shipping method is shown in the multiselect.

Actual result

  1. flatrate shipping method isn't shown in the multiselect.
  2. All shipping methods are considered not active in source model.

Point of origin

https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php#L126-L138 $this->getStore is null for adminhtml requests and causes Magento to fallback to default config value.

or

https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Config.php#L69 Where scopeResolver is resolving to default scope instead of store view.

engcom-backlog-nickolas commented 6 years ago

Hello @JeroenVanLeusden, thank you for your report. We've acknowledged the issue and added to our backlog.

I've changed step 2 and 3 to website view scope, as enabling shipping methods have no store view scope in vanilla magento.

magento-engcom-team commented 5 years ago

Hi @AleksLi. 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:

magento-engcom-team commented 5 years ago

@JeroenVanLeusden, thank you for your report.

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, reopen or create new ticket according to the Issue reporting guidelines if you are still facing this issue on the latest 2.3-develop branch. Thank you for collaboration.