1

I used this example to create my own table with configuration in admin. Now I'm trying to figure out how to preselect my saved values on page loads. I have this table now:

enter image description here

For preselecting this example uses _prepareArrayRow()

This is value from core_config _data:

a:4:{s:18:"_1486995392381_381";a:3:{s:12:"m2_attribute";s:16:"required_options";s:13:"chq_attribute";s:14:"CustomDecimal1";s:9:"push_once";s:5:"false";}s:18:"_1486995402858_858";a:3:{s:12:"m2_attribute";s:14:"fabric_content";s:13:"chq_attribute";s:6:"Rental";s:9:"push_once";s:4:"true";}s:18:"_1486995407176_176";a:3:{s:12:"m2_attribute";s:9:"fabricfit";s:13:"chq_attribute";s:13:"CustomNumber3";s:9:"push_once";s:4:"true";}s:17:"_1486995414029_29";a:3:{s:12:"m2_attribute";s:17:"short_description";s:13:"chq_attribute";s:17:"ItemCustomNumber6";s:9:"push_once";s:5:"false";}}

This is how unserialized value looks like:

Array
(
    [_1486995392381_381] => Array
        (
            [m2_attribute] => required_options
            [chq_attribute] => CustomDecimal1
            [push_once] => false
        )

    [_1486995402858_858] => Array
        (
            [m2_attribute] => fabric_content
            [chq_attribute] => Rental
            [push_once] => true
        )

    [_1486995407176_176] => Array
        (
            [m2_attribute] => fabricfit
            [chq_attribute] => CustomNumber3
            [push_once] => true
        )

    [_1486995414029_29] => Array
        (
            [m2_attribute] => short_description
            [chq_attribute] => ItemCustomNumber6
            [push_once] => false
        )

)

Any help will be appreciated!

4
  • Can you post this Json value from core_config_data here? Feb 13, 2017 at 15:51
  • a:4:{s:18:"_1486995392381_381";a:3:{s:12:"test1";s:16:"required_options";s:13:"test2";s:14:"CustomDecimal1";s:9:"test3";s:5:"false";}s:18:"_1486995402858_858";a:3:{s:12:"test1";s:14:"fabric_content";s:13:"test2";s:6:"Rental";s:9:"test3";s:4:"true";}s:18:"_1486995407176_176";a:3:{s:12:"test1";s:9:"fabricfit";s:13:"test2";s:13:"CustomNumber3";s:9:"test3";s:4:"true";}s:17:"_1486995414029_29";a:3:{s:12:"test1";s:17:"short_description";s:13:"test2";s:17:"ItemCustomNumber6";s:9:"test3";s:5:"false";}} Feb 13, 2017 at 15:58
  • Let's try on this example: [["old_id","CustomText1",true],["new_id","CustomText2",false],["custom","CustomText3",true]] Feb 13, 2017 at 16:26
  • I need the value from your core_config_data, because, I want to make sure the saved value is corrected. I think your issue is hard to debug because your custom code is not available. It's better if you post your module on Github or here. Feb 13, 2017 at 16:30

1 Answer 1

1

Finally I figured out how to make it. I created repo and you can check test module there. The answer for this question is in file Block/System/Config/Form/Field/Active.php in method _prepareArrayRow()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.