0

I want to add a Multiselect under Stores -> Settings -> All Stores -> Store View

Store Switcher

I've added a new Field:

\Test\StoreSwitcher\Block\Store.php

<?php

namespace Test\StoreSwitcher\Block;

class Store extends \Magento\Backend\Block\System\Store\Edit\Form\Store
{
    protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form) {
        .....
        $storeSwitcherIds = $storeModel->getSwitcherIds();
        $fieldset->addField(
            'store_switcher_ids',
            'multiselect',
            [
                'name' => 'switcher_ids',
                'label' => __('Store Switcher'),
                'value' => $storeSwitcherIds,
                'values' => $this->getStores(),
                'required' => false,
                'disabled' => $storeModel->isReadOnly()
            ]
        );
        .....

My Problem is, if I select multiple values, switcher_ids has only one value.

I've checked Post Request and the error is already here. switcher_ids[] should have two values.

Post Request

Does somebody know what is wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.