[英]Prestashop User group 'group' form helper in custom module
我想在我的模塊中的輔助方法中使用客戶組組件(我在 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);
像 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));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.