Prestashop用户组“组”自定义模块中的表单助手

问题描述 投票:0回答:1

我想在助手方法中的模块中使用Customer组componnet(我在AdminPattern控制器中找到它)。我可以将选中的复选框保存到配置表中(我对数组进行了序列化,并将选项另存为文本),但是无法将保存的值加载回窗体。

    array(
                    'type' => 'group',
                    'label' => 'group',
                    'name' => 'configuration[]',
                    'values' => Group::getGroups(Context::getContext()->language->id),
                ),

正在处理中:

if (Tools::isSubmit('submitTallerOrden'))
    {
        $_POST['configuration'] = implode(',', Tools::getValue('configuration'));
    }

我具有渲染形式:

$this->fields_value['configuration[]'] = explode(',',$obj->configuration);
forms prestashop helper form-helpers
1个回答
0
投票

像AdminCustomersController

形式:

            array(
                'type' => 'group',
                'label' => $this->l('Group access'),
                'name' => 'groupBox',
                'values' => Group::getGroups($this->default_form_language, true),
                'required' => true,
                'col' => '6',
                'hint' => $this->l('Select all the groups that you would like to apply to this customer.')
            ),

在renderForm中:

foreach ($groups as $group) {
        $this->fields_value['groupBox_'.$group['id_group']] =
            Tools::getValue('groupBox_'.$group['id_group'], in_array($group['id_group'], $customer_groups_ids));
    }
© www.soinside.com 2019 - 2024. All rights reserved.