Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can a magento adminhtml field depend on more then one field or value?

In http://alanstorm.com/magento_system_configuration_in_depth_tutorial @AlanStorm gives a very good tutorial for system configuration.

He also explains how to use a <depends> tag to make a field show only when a specific value is set in another field.

My Q is how can I make fieldB visible if field A has either value V1 or V2. and are there any other options with the <depends> ?

Also If someone knows where in magento's code this is implemented I would also like to have a look at the code myself.

Thanks

like image 904
epeleg Avatar asked Jan 31 '11 10:01

epeleg


1 Answers

If I correctly understand release notes from Magento 1.7.0.1, this functionnality has been implemented (http://goo.gl/ZgHG0). I have succeddfully tested it on a Magento CE 1.7.0.2.

You must declare a separator parameter in the field dependancy like this :

<depends>
    <depends_from_field separator=",">
        depends_from_field_value_1,depends_from_field_value_2
    </depends_from_field>
</depends>

Note that depends_from_field_value_1 and depends_from_field_value_2 are separated by a comma, the exact symbol that is declared in separator=","

like image 167
Hervé Guétin Avatar answered Sep 30 '22 02:09

Hervé Guétin