renderForm format – Prestashop 1.7
You can use form element when needed.
public function renderForm()
{
$this->fields_form = array(
‘tinymce’ => false,
‘legend’ => array(
‘title’ => $this->l(‘Product label’),
‘icon’ => ‘icon-tags’
),
‘input’ => array(
array(
‘type’ => ((float)_PS_VERSION_ < 1.6 ? ‘radio’ : ‘switch’),
‘label’ => $this->l(‘Enabled’),
‘name’ => ‘active’,
‘class’ => ‘t’,
‘required’ => false,
‘is_bool’ => true,
‘values’ => array(
array(
‘id’ => ‘active_on’,
‘value’ => 1,
‘label’ => $this->l(‘Enabled’)
),
array(
‘id’ => ‘active_off’,
‘value’ => 0,
‘label’ => $this->l(‘Disabled’)
)
),
‘hint’ => $this->l(‘Will be hidden on all products if not enabled:’),
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘Name’),
‘name’ => ‘name’,
‘required’ => true,
‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’,
),
array(
‘type’ => ‘radio’,
‘label’ => $this->l(‘For’),
‘desc’ => $this->l(‘Only one!’),
‘name’ => ‘select_for’,
‘required’ => true,
‘class’ => ‘t’,
‘is_bool’ => true,
‘values’ => array(
array(
‘id’ => ‘select_categories’,
‘value’ => 1,
‘label’ => $this->l(‘Categories’)
),
array(
‘id’ => ‘select_manufacturer’,
‘value’ => 0,
‘label’ => $this->l(‘Manufacturer’)
),
array(
‘id’ => ‘select_supplier’,
‘value’ => 2,
‘label’ => $this->l(‘Supplier’)
),
array(
‘id’ => ‘select_status’,
‘value’ => 3,
‘label’ => $this->l(‘Status’)
),
array(
‘id’ => ‘select_cart_rules’,
‘value’ => 4,
‘label’ => $this->l(‘Cart rules’)
),
array(
‘id’ => ‘select_condition’,
‘value’ => 5,
‘label’ => $this->l(‘Condition’)
)
),
),
array(
‘type’ => ((float)_PS_VERSION_ < 1.6 ? ‘radio’ : ‘switch’),
‘label’ => $this->l(‘Display in the child category’),
‘name’ => ‘include_category_product’,
‘class’ => ‘t’,
‘required’ => false,
‘is_bool’ => true,
‘values’ => array(
array(
‘id’ => ‘include_category_product_on’,
‘value’ => 1,
‘label’ => $this->l(‘Enabled’)
),
array(
‘id’ => ‘include_category_product_off’,
‘value’ => 0,
‘label’ => $this->l(‘Disabled’)
)
),
‘hint’ => $this->l(
‘If yes: It will appear on all products where there is at least least one selected
category. If no: will be displayed only in the products for which the default category’
), /* mouse over on label */
),
array(
‘type’ => ‘categories_select2’,
‘label’ => $this->l(‘Categories for views’),
‘name’ => ‘categories’
),
array(
‘type’ => ‘manufacturer_select2’,
‘label’ => $this->l(‘Manufacturer for views’),
‘name’ => ‘manufacturer’
),
array(
‘type’ => ‘supplier_select2’,
‘label’ => $this->l(‘Supplier for views’),
‘name’ => ‘supplier’
),
array(
‘type’ => ‘html’,
‘label’ => $this->l(‘Product status’),
‘name’ => null,
‘html_content’ => $this->getContentProductStatusButtonsForm() //Product status (New,Sale)
),
array(
‘type’ => ‘swap’,
‘label’ => $this->l(‘Cart rules for views’),
‘name’ => ‘cart_rules’,
‘options’ => array(
‘id’ => ‘id_cart_rule’,
‘name’ => ‘name’,
‘query’ => ProductLabel::getCartRules() //all cart rule
)
),
array(
‘type’ => ‘html’,
‘label’ => $this->l(‘Condition’),
‘name’ => null,
‘html_content’ => $this->getContentProductConditionButtonsForm() // new ,used,republished
),
array(
‘type’ => ‘excluded_select2’,
‘label’ => $this->l(‘Excluded product’),
‘name’ => ‘excluded’,
),
array(
‘type’ => ‘position’,
‘label’ => $this->l(‘Position’),
‘name’ => ‘position’
),
array(
‘type’ => ‘button’,
‘name’ => ‘label_type’,
‘label’ => $this->l(”),
‘values’ => array(
array(
‘value’ => ‘image’,
‘id’ => ‘select_type_image’,
‘label’ => $this->l(‘Image label’)
),
array(
‘value’ => ‘text’,
‘id’ => ‘select_type_text’,
‘label’ => $this->l(‘Text label’)
)
)
),
array(
‘type’ => ‘file_style’,
‘label’ => $this->l(‘Image’),
‘required’ => false,
‘lang’ => true,
‘name’ => ‘image’,
‘hint’ => $this->l(‘Upload a image from your computer.’),
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for image in home page’),
‘name’ => ‘index_image_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: width: 80px; heigth: 80px;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for image in product page’),
‘name’ => ‘product_image_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: width: 80px; heigth: 80px;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for image in category page’),
‘name’ => ‘category_image_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: width: 80px; heigth: 80px;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘Text’),
‘name’ => ‘text’,
‘lang’ => true,
‘required’ => false,
‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for text’),
‘name’ => ‘text_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: color:red; font-size: 1.8em;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘URL’),
‘name’ => ‘url’,
‘lang’ => true,
‘required’ => false,
‘hint’ => $this->l(‘Wrap label in link tag if not empty’),
),
array(
‘type’ => ‘textarea’,
‘label’ => $this->l(‘Hint’),
‘name’ => ‘hint’,
‘lang’ => true,
‘required’ => false,
‘autoload_rte’ => true, //timymce
‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’,
),
array(
‘type’ => ‘color’,
‘label’ => $this->l(‘Hint text color’),
‘name’ => ‘hint_text_color’,
‘required’ => false,
‘hint’ => $this->l(‘Default: white(#ffffff)’)
),
array(
‘type’ => ‘color’,
‘label’ => $this->l(‘Hint background’),
‘name’ => ‘hint_background’,
‘required’ => false,
‘hint’ => $this->l(‘Default: black(#000000)’)
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘Hint opacity’),
‘name’ => ‘hint_opacity’,
‘required’ => false,
‘default_value’ => 1,
‘hint’ => $this->l(‘Default: not transparent(1)’)
),
array(
‘type’ => ‘group’,
‘label’ => $this->l(‘Group access’),
‘name’ => ‘groupBox’,
‘values’ => Group::getGroups(Context::getContext()->language->id), //visitor ,guest,customer
‘hint’ => $this->l(‘Mark the groups to which the logo will be displayed.’)
),
array(
‘type’ => ‘date_from_to’,
‘label’ => $this->l(‘Valid’),
‘name’ => ”,
‘name_from’ => ‘date_from’,
‘name_to’ => ‘date_to’
)
),
‘submit’ => array(
‘title’ => $this->l(‘Save’),
)
array(
'type' => 'categories',
'label' => $this->l('Select categories'),
'name' => 'am_category_products_ids',
'tree' => array(
'id' => 'exclude_cats',
'use_checkbox' => true,
'selected_categories' => explode(",", Configuration::get('am_category_products_ids')),
),
),
);
{
$this->fields_form = array(
‘tinymce’ => false,
‘legend’ => array(
‘title’ => $this->l(‘Product label’),
‘icon’ => ‘icon-tags’
),
‘input’ => array(
array(
‘type’ => ((float)_PS_VERSION_ < 1.6 ? ‘radio’ : ‘switch’),
‘label’ => $this->l(‘Enabled’),
‘name’ => ‘active’,
‘class’ => ‘t’,
‘required’ => false,
‘is_bool’ => true,
‘values’ => array(
array(
‘id’ => ‘active_on’,
‘value’ => 1,
‘label’ => $this->l(‘Enabled’)
),
array(
‘id’ => ‘active_off’,
‘value’ => 0,
‘label’ => $this->l(‘Disabled’)
)
),
‘hint’ => $this->l(‘Will be hidden on all products if not enabled:’),
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘Name’),
‘name’ => ‘name’,
‘required’ => true,
‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’,
),
array(
‘type’ => ‘radio’,
‘label’ => $this->l(‘For’),
‘desc’ => $this->l(‘Only one!’),
‘name’ => ‘select_for’,
‘required’ => true,
‘class’ => ‘t’,
‘is_bool’ => true,
‘values’ => array(
array(
‘id’ => ‘select_categories’,
‘value’ => 1,
‘label’ => $this->l(‘Categories’)
),
array(
‘id’ => ‘select_manufacturer’,
‘value’ => 0,
‘label’ => $this->l(‘Manufacturer’)
),
array(
‘id’ => ‘select_supplier’,
‘value’ => 2,
‘label’ => $this->l(‘Supplier’)
),
array(
‘id’ => ‘select_status’,
‘value’ => 3,
‘label’ => $this->l(‘Status’)
),
array(
‘id’ => ‘select_cart_rules’,
‘value’ => 4,
‘label’ => $this->l(‘Cart rules’)
),
array(
‘id’ => ‘select_condition’,
‘value’ => 5,
‘label’ => $this->l(‘Condition’)
)
),
),
array(
‘type’ => ((float)_PS_VERSION_ < 1.6 ? ‘radio’ : ‘switch’),
‘label’ => $this->l(‘Display in the child category’),
‘name’ => ‘include_category_product’,
‘class’ => ‘t’,
‘required’ => false,
‘is_bool’ => true,
‘values’ => array(
array(
‘id’ => ‘include_category_product_on’,
‘value’ => 1,
‘label’ => $this->l(‘Enabled’)
),
array(
‘id’ => ‘include_category_product_off’,
‘value’ => 0,
‘label’ => $this->l(‘Disabled’)
)
),
‘hint’ => $this->l(
‘If yes: It will appear on all products where there is at least least one selected
category. If no: will be displayed only in the products for which the default category’
), /* mouse over on label */
),
array(
‘type’ => ‘categories_select2’,
‘label’ => $this->l(‘Categories for views’),
‘name’ => ‘categories’
),
array(
‘type’ => ‘manufacturer_select2’,
‘label’ => $this->l(‘Manufacturer for views’),
‘name’ => ‘manufacturer’
),
array(
‘type’ => ‘supplier_select2’,
‘label’ => $this->l(‘Supplier for views’),
‘name’ => ‘supplier’
),
array(
‘type’ => ‘html’,
‘label’ => $this->l(‘Product status’),
‘name’ => null,
‘html_content’ => $this->getContentProductStatusButtonsForm() //Product status (New,Sale)
),
array(
‘type’ => ‘swap’,
‘label’ => $this->l(‘Cart rules for views’),
‘name’ => ‘cart_rules’,
‘options’ => array(
‘id’ => ‘id_cart_rule’,
‘name’ => ‘name’,
‘query’ => ProductLabel::getCartRules() //all cart rule
)
),
array(
‘type’ => ‘html’,
‘label’ => $this->l(‘Condition’),
‘name’ => null,
‘html_content’ => $this->getContentProductConditionButtonsForm() // new ,used,republished
),
array(
‘type’ => ‘excluded_select2’,
‘label’ => $this->l(‘Excluded product’),
‘name’ => ‘excluded’,
),
array(
‘type’ => ‘position’,
‘label’ => $this->l(‘Position’),
‘name’ => ‘position’
),
array(
‘type’ => ‘button’,
‘name’ => ‘label_type’,
‘label’ => $this->l(”),
‘values’ => array(
array(
‘value’ => ‘image’,
‘id’ => ‘select_type_image’,
‘label’ => $this->l(‘Image label’)
),
array(
‘value’ => ‘text’,
‘id’ => ‘select_type_text’,
‘label’ => $this->l(‘Text label’)
)
)
),
array(
‘type’ => ‘file_style’,
‘label’ => $this->l(‘Image’),
‘required’ => false,
‘lang’ => true,
‘name’ => ‘image’,
‘hint’ => $this->l(‘Upload a image from your computer.’),
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for image in home page’),
‘name’ => ‘index_image_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: width: 80px; heigth: 80px;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for image in product page’),
‘name’ => ‘product_image_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: width: 80px; heigth: 80px;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for image in category page’),
‘name’ => ‘category_image_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: width: 80px; heigth: 80px;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘Text’),
‘name’ => ‘text’,
‘lang’ => true,
‘required’ => false,
‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘CSS for text’),
‘name’ => ‘text_css’,
‘required’ => false,
‘hint’ => $this->l(‘Example’).’: color:red; font-size: 1.8em;’,
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘URL’),
‘name’ => ‘url’,
‘lang’ => true,
‘required’ => false,
‘hint’ => $this->l(‘Wrap label in link tag if not empty’),
),
array(
‘type’ => ‘textarea’,
‘label’ => $this->l(‘Hint’),
‘name’ => ‘hint’,
‘lang’ => true,
‘required’ => false,
‘autoload_rte’ => true, //timymce
‘hint’ => $this->l(‘Invalid characters:’).’ <>;=#{}’,
),
array(
‘type’ => ‘color’,
‘label’ => $this->l(‘Hint text color’),
‘name’ => ‘hint_text_color’,
‘required’ => false,
‘hint’ => $this->l(‘Default: white(#ffffff)’)
),
array(
‘type’ => ‘color’,
‘label’ => $this->l(‘Hint background’),
‘name’ => ‘hint_background’,
‘required’ => false,
‘hint’ => $this->l(‘Default: black(#000000)’)
),
array(
‘type’ => ‘text’,
‘label’ => $this->l(‘Hint opacity’),
‘name’ => ‘hint_opacity’,
‘required’ => false,
‘default_value’ => 1,
‘hint’ => $this->l(‘Default: not transparent(1)’)
),
array(
‘type’ => ‘group’,
‘label’ => $this->l(‘Group access’),
‘name’ => ‘groupBox’,
‘values’ => Group::getGroups(Context::getContext()->language->id), //visitor ,guest,customer
‘hint’ => $this->l(‘Mark the groups to which the logo will be displayed.’)
),
array(
‘type’ => ‘date_from_to’,
‘label’ => $this->l(‘Valid’),
‘name’ => ”,
‘name_from’ => ‘date_from’,
‘name_to’ => ‘date_to’
)
),
‘submit’ => array(
‘title’ => $this->l(‘Save’),
)
array(
'type' => 'categories',
'label' => $this->l('Select categories'),
'name' => 'am_category_products_ids',
'tree' => array(
'id' => 'exclude_cats',
'use_checkbox' => true,
'selected_categories' => explode(",", Configuration::get('am_category_products_ids')),
),
),
);
return parent::renderForm();
Comments
Post a Comment