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

<depends> field doesn't work in system.xml for "radios" fields #9360

Closed
WaPoNe opened this issue Apr 22, 2017 · 6 comments
Closed

<depends> field doesn't work in system.xml for "radios" fields #9360

WaPoNe opened this issue Apr 22, 2017 · 6 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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

Comments

@WaPoNe
Copy link
Contributor

WaPoNe commented Apr 22, 2017

In system.xml file a field can depend on another field value; it will be shown or not depending from previous field choice.
It works fine if the field depends on a "select" field but if you try to use a "radios" field dependency the mechanism doesn't work and the field will always be shown.

Preconditions

  1. Magento 2.1.5

Steps to reproduce

app/code/vendorName/moduleName/etc/adminhtml/system.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="wapone" translate="label" sortOrder="1000">
            <label>WaPoNe</label>
        </tab>
        <section id="stickers" translate="label" type="text"
                 sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Stickers</label>
            <tab>wapone</tab>
            <resource>WaPoNe_Stickers::config_stickers</resource>
            <group id="stickers_page" translate="label" type="text"
                   sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Stickers page settings</label>
                <field id="discount_calculation" translate="label" type="radios"
                       sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Discount Calculation</label>
                    <source_model>WaPoNe\Stickers\Model\Config\Backend\DiscountCalculationType</source_model>
                </field>
                <field id="discount_category" translate="label" type="text"
                       sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Discount Product Category</label>
                    <depends>
                        <field id="stickers/stickers_page/discount_calculation">automatic</field>
                    </depends>
                </field>
            </group>
        </section>
    </system>
</config>

app/code/vendorName/moduleName/Model/Config/Backend/DiscountCalculationType.php:

<?php

namespace WaPoNe\Stickers\Model\Config\Backend;

use Magento\Framework\Option\ArrayInterface;

class DiscountCalculationType implements ArrayInterface
{
    public function toOptionArray()
    {
        $calculationType = array();

        $calculationType[] = [
            'value' => 'manual',
            'label' => __('Manual')
        ];
        $calculationType[] = [
            'value' => 'automatic',
            'label' => __('Automatic')
        ];

        return $calculationType;
    }
}

Expected result

  1. discount_calculation value = 'automatic' => discount_category is shown
  2. discount_calculation value = 'manual' => discount_category is not shown

Actual result

  1. discount_category is always shown so is not working

If I declare discount_calculation field as "select" type, all works fine

@magento-engcom-team magento-engcom-team added G1 Passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Oct 5, 2017
@magento-engcom-team
Copy link
Contributor

@WaPoNe, thank you for your report.
We've created internal ticket(s) MAGETWO-80952 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed 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 Oct 5, 2017
@osrecio
Copy link
Member

osrecio commented Oct 17, 2017

Assign to me

@jahvi
Copy link

jahvi commented Oct 18, 2017

I started working on this issue over at #11539, feel free to comment on it.

@okorshenko
Copy link
Contributor

The issue has been fixed and delivered to the 2.2-develop branch. Will be available with upcoming patch release

@okorshenko okorshenko reopened this Nov 22, 2017
@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 22, 2017
@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Apr 28, 2018
@magento-engcom-team
Copy link
Contributor

Hi @WaPoNe. Thank you for your report.
The issue has been fixed in magento-engcom-team/magento2ce#114 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@WaPoNe
Copy link
Contributor Author

WaPoNe commented Apr 29, 2018

@magento-engcom-team great job!

magento-devops-reposync-svc pushed a commit that referenced this issue Dec 3, 2024
[Arrows] Platform Health Delivery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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

No branches or pull requests

5 participants