360 lines
16 KiB
PHP
360 lines
16 KiB
PHP
<?php
|
|
|
|
use x13gpsr\Config\ConfigKeys;
|
|
|
|
$fields_form = [];
|
|
|
|
$hooksSelection = [];
|
|
|
|
|
|
$hooksSelection[] = [
|
|
'id' => 'displayFooterProduct',
|
|
'name' => $this->l('Product footer - displayFooterProduct', 'form'),
|
|
];
|
|
|
|
if (version_compare(_PS_VERSION_, '1.7', '>=')) {
|
|
$hooksSelection[] = [
|
|
'id' => 'displayProductAdditionalInfo',
|
|
'name' => $this->l('Extra product information - displayProductAdditionalInfo', 'form'),
|
|
];
|
|
|
|
$hooksSelection[] = [
|
|
'id' => 'displayProductExtraContent',
|
|
'name' => $this->l('Extra tab - displayProductExtraContent', 'form'),
|
|
];
|
|
} else {
|
|
$hooksSelection[] = [
|
|
'id' => 'displayLeftColumnProduct',
|
|
'name' => $this->l('Product left information - displayLeftColumnProduct', 'form'),
|
|
];
|
|
|
|
$hooksSelection[] = [
|
|
'id' => 'displayRightColumnProduct',
|
|
'name' => $this->l('Product right information - displayRightColumnProduct', 'form'),
|
|
];
|
|
}
|
|
|
|
|
|
//custom hook must be last
|
|
$hooksSelection[] = [
|
|
'id' => 'displayX13GpsrInformation',
|
|
'name' => $this->l('Custom position - displayX13GpsrInformation', 'form'),
|
|
];
|
|
|
|
|
|
|
|
|
|
$fields_form[] = [
|
|
'form' => [
|
|
'legend' => [
|
|
'title' => $this->l('Settings', 'form'),
|
|
'icon' => 'icon-cogs',
|
|
],
|
|
'input' => [
|
|
[
|
|
'name' => 'separator',
|
|
'ignore' => true,
|
|
'type' => 'html',
|
|
'html_content' => '<h2 class="h3" style="font-size:18px">' . $this->l('General settings', 'form') . '</h2>',
|
|
],
|
|
[
|
|
'type' => 'switch',
|
|
'label' => $this->l('Display modules in front office', 'form'),
|
|
'desc' => $this->l('If you want, you can hide the module for the client, but still manage the data.', 'form'),
|
|
'name' => ConfigKeys::DISPLAY_FRONT,
|
|
'values' => [
|
|
[
|
|
'id' => 'display_front_on',
|
|
'value' => 1,
|
|
'label' => $this->l('Yes', 'form'),
|
|
],
|
|
[
|
|
'id' => 'display_front_off',
|
|
'value' => 0,
|
|
'label' => $this->l('No', 'form'),
|
|
],
|
|
],
|
|
'default' => 1,
|
|
],
|
|
[
|
|
'type' => 'switch',
|
|
'label' => $this->l('Display information if product is not available for sale', 'form'),
|
|
'desc' => $this->l('If you want, you can hide the information if the product is not available for sale.', 'form'),
|
|
'name' => ConfigKeys::DISPLAY_IF_NOT_FOR_SALE,
|
|
'values' => [
|
|
[
|
|
'id' => 'display_if_not_for_sale_on',
|
|
'value' => 1,
|
|
'label' => $this->l('Yes', 'form'),
|
|
],
|
|
[
|
|
'id' => 'display_if_not_for_sale_off',
|
|
'value' => 0,
|
|
'label' => $this->l('No', 'form'),
|
|
],
|
|
],
|
|
'default' => 1,
|
|
],
|
|
// [
|
|
// 'type' => 'textarea',
|
|
// 'rows' => 10,
|
|
// 'cols' => 5,
|
|
// 'lang' => true,
|
|
// 'name' => ConfigKeys::ADDRESS_FORMAT,
|
|
// 'label' => $this->l('Address format', 'form'),
|
|
// 'desc' => $this->l('You can use the following placeholders: {name},{address}, {postcode}, {city}, {country}, {extra_note}', 'form'),
|
|
// 'default' => '',
|
|
// ],
|
|
[
|
|
'name' => 'separator',
|
|
'ignore' => true,
|
|
'type' => 'html',
|
|
'html_content' => '<h2 class="h3" style="font-size:18px">' . $this->l('Appearance', 'form') . '</h2>',
|
|
],
|
|
[
|
|
'type' => 'select',
|
|
'label' => $this->l('Where to display GPSR information? (hook)', 'form'),
|
|
'desc' => $this->l('While it is important to display the information, you can safely place it in the place where you think it will be most useful without making the page too cluttered.', 'form'),
|
|
'name' => ConfigKeys::PRODUCT_PAGE_DISPLAY_HOOK,
|
|
'validation' => 'isAnything',
|
|
'options' => [
|
|
'query' => $hooksSelection,
|
|
'id' => 'id',
|
|
'name' => 'name',
|
|
],
|
|
'default' => $this->ps_version == 1.6 ? 'displayFooterProduct' : 'displayProductExtraContent',
|
|
'class' => 'force-full-width',
|
|
],
|
|
[
|
|
'type' => 'html',
|
|
'name' => 'hook_displayX13GpsrInformation',
|
|
'label' => $this->l('Code for:', 'form') . ' displayX13GpsrInformation',
|
|
'ignore' => true,
|
|
'form_group_class' => $this->fieldDependsOn(
|
|
$this->fieldDependsOnValueEqualTo(),
|
|
[
|
|
ConfigKeys::PRODUCT_PAGE_DISPLAY_HOOK => 'displayX13GpsrInformation',
|
|
]
|
|
),
|
|
'html_content' => '<div>' .
|
|
'<div class="input-group">' .
|
|
'<input type="text" class="col-xs-6 col-sm-4" readonly id="code_displayX13GpsrInformation" value="' . htmlspecialchars('{hook h="displayX13GpsrInformation" product=$product}') . '" name="widget" />' .
|
|
'<span class="input-group-addon" style="padding:0"><button type="button" data-success="' . $this->l('Code has been copied to your clipboard.', 'form') .'" name="xgpsr-copy-code" data-target="#code_displayX13GpsrInformation" class="btn btn-success">' . $this->l('Copy', 'form') . '</button></span>' .
|
|
'</div>' .
|
|
'<p class="help-block">' . $this->l('You can use this code in template files used for Product page', 'form') . '</p>' .
|
|
'</div>' .
|
|
'<div class="alert alert-info">' .
|
|
($this->ps_version >= '1.7' ?
|
|
sprintf($this->l('To use custom hook, place %s in any template file used to render product page ex. product.tpl.', 'form'), '<b>' . '{hook h="displayX13GpsrInformation" product=$product}' . '</b>') :
|
|
sprintf($this->l('To use custom hook, place %s in your product.tpl template.', 'form'), '<b>' . '{hook h="displayX13GpsrInformation" product=$product}' . '</b>')
|
|
) .
|
|
'</div>',
|
|
],
|
|
[
|
|
'type' => 'image_option',
|
|
'label' => $this->l('Display style', 'form'),
|
|
'name' => ConfigKeys::LAYOUT,
|
|
'validation' => 'isAnything',
|
|
'options' => [
|
|
[
|
|
'id' => 'default',
|
|
'label' => $this->l('Default', 'form'),
|
|
'img' => _MODULE_DIR_ . $this->name . '/views/img/admin/display_styles/default.png',
|
|
],
|
|
[
|
|
'id' => 'box',
|
|
'label' => $this->l('Box', 'form'),
|
|
'img' => _MODULE_DIR_ . $this->name . '/views/img/admin/display_styles/box.png',
|
|
],
|
|
[
|
|
'id' => 'cloud',
|
|
'label' => $this->l('Cloud', 'form'),
|
|
'img' => _MODULE_DIR_ . $this->name . '/views/img/admin/display_styles/cloud.png',
|
|
],
|
|
[
|
|
'id' => 'cloud_with_tabs',
|
|
'label' => $this->l('Cloud with tabs', 'form'),
|
|
'img' => _MODULE_DIR_ . $this->name . '/views/img/admin/display_styles/cloud_with_tabs.png',
|
|
],
|
|
],
|
|
'default' => 'default',
|
|
'class' => 'fixed-width-xxl',
|
|
'form_group_class' => $this->fieldDependsOn(
|
|
$this->fieldDependsOnValueNotEqualTo(),
|
|
[
|
|
ConfigKeys::PRODUCT_PAGE_DISPLAY_HOOK => 'displayProductExtraContent',
|
|
]
|
|
),
|
|
],
|
|
[
|
|
'type' => 'color',
|
|
'label' => $this->l('Color links', 'form'),
|
|
'name' => ConfigKeys::COLOR_LINKS,
|
|
'default' => '#24b9d7',
|
|
],
|
|
[
|
|
'type' => 'color',
|
|
'label' => $this->l('Color tabs underlined', 'form'),
|
|
'name' => ConfigKeys::COLOR_TABS_UNDERLINED,
|
|
'default' => '#24b9d7',
|
|
'form_group_class' => $this->fieldDependsOn(
|
|
$this->fieldDependsOnValueEqualTo(),
|
|
[
|
|
ConfigKeys::LAYOUT => 'cloud_with_tabs',
|
|
]
|
|
),
|
|
],
|
|
[
|
|
'type' => 'switch',
|
|
'label' => $this->l('Display label address', 'form'),
|
|
'desc' => $this->l('Displaying a label in front of the street, i.e. instead of Dworcowa 12, it displays street Dworcowa 12', 'form'),
|
|
'name' => ConfigKeys::DISPLAY_ADDRESS_LABEL,
|
|
'values' => [
|
|
[
|
|
'id' => 'display_address_label_on',
|
|
'value' => 1,
|
|
'label' => $this->l('Yes', 'form'),
|
|
],
|
|
[
|
|
'id' => 'display_address_label_off',
|
|
'value' => 0,
|
|
'label' => $this->l('No', 'form'),
|
|
],
|
|
],
|
|
'default' => 0,
|
|
],
|
|
[
|
|
'type' => 'text',
|
|
'lang' => true,
|
|
'name' => ConfigKeys::GPSR_BLOCK_TITLE,
|
|
'label' => $this->l('Block title', 'form'),
|
|
'desc' => $this->l('You can set the title of the block that will be displayed in the place where you have set the module.', 'form'),
|
|
'default' => [
|
|
'pl' => 'Bezpieczeństwo produktów',
|
|
'en' => 'Product safety',
|
|
],
|
|
'form_group_class' => $this->fieldDependsOn(
|
|
$this->fieldDependsOnValueNotEqualTo(),
|
|
[
|
|
ConfigKeys::PRODUCT_PAGE_DISPLAY_HOOK => 'displayProductExtraContent',
|
|
]
|
|
),
|
|
],
|
|
[
|
|
'type' => 'text',
|
|
'lang' => true,
|
|
'name' => ConfigKeys::GPSR_TAB_TITLE,
|
|
'label' => $this->l('Tab title', 'form'),
|
|
'desc' => $this->l('You can set the title of the tab that will be displayed in the product page.', 'form'),
|
|
'default' => [
|
|
'pl' => 'Bezpieczeństwo produktów',
|
|
'en' => 'Product safety',
|
|
],
|
|
'form_group_class' => $this->fieldDependsOn(
|
|
$this->fieldDependsOnValueEqualTo(),
|
|
[
|
|
ConfigKeys::PRODUCT_PAGE_DISPLAY_HOOK => 'displayProductExtraContent',
|
|
]
|
|
),
|
|
],
|
|
[
|
|
'type' => 'switch',
|
|
'label' => $this->l('Display logo of the brand (if available)', 'form'),
|
|
'desc' => $this->l('If you want, you can hide the logo of the brand. Remember that it is about brand that you add to the product, not the responsible manufacturer.', 'form'),
|
|
'name' => ConfigKeys::DISPLAY_BRAND_LOGO,
|
|
'values' => [
|
|
[
|
|
'id' => 'display_brand_logo_on',
|
|
'value' => 1,
|
|
'label' => $this->l('Yes', 'form'),
|
|
],
|
|
[
|
|
'id' => 'display_brand_logo_off',
|
|
'value' => 0,
|
|
'label' => $this->l('No', 'form'),
|
|
],
|
|
],
|
|
'default' => 0,
|
|
],
|
|
[
|
|
'type' => 'switch',
|
|
'label' => $this->l('Display extra safety information', 'form'),
|
|
'desc' => $this->l('If you want, you can hide the extra safety information.', 'form'),
|
|
'name' => ConfigKeys::DISPLAY_EXTRA_SAFETY_INFORMATION,
|
|
'values' => [
|
|
[
|
|
'id' => 'display_extra_safety_information_on',
|
|
'value' => 1,
|
|
'label' => $this->l('Yes', 'form'),
|
|
],
|
|
[
|
|
'id' => 'display_extra_safety_information_off',
|
|
'value' => 0,
|
|
'label' => $this->l('No', 'form'),
|
|
],
|
|
],
|
|
'default' => 1,
|
|
],
|
|
[
|
|
'name' => 'separator',
|
|
'ignore' => true,
|
|
'type' => 'html',
|
|
'html_content' => '<h2 class="h3" style="font-size:18px">' . $this->l('Advanced settings', 'form') . '</h2>',
|
|
],
|
|
[
|
|
'type' => 'textarea',
|
|
'name' => ConfigKeys::CUSTOM_CSS,
|
|
'label' => $this->l('Custom css', 'form'),
|
|
'default' => '',
|
|
'ignore' => true,
|
|
'desc' => $this->l('There is one CSS per all shop. If you want to add custom CSS for a given shop, target .x13gpsr-shop-{$shopId} class, where {$shopId} is ID of a target shop.', 'form'),
|
|
],
|
|
// [
|
|
// 'name' => 'separator',
|
|
// 'ignore' => true,
|
|
// 'type' => 'html',
|
|
// 'html_content' => '<h2 class="h4" style="font-size:15px">' . $this->l('Miscellaneous', 'form') . '</h2>',
|
|
// ],
|
|
// [
|
|
// 'name' => 'separator',
|
|
// 'ignore' => true,
|
|
// 'type' => 'html',
|
|
// 'html_content' => '<h2 class="h4" style="font-size:15px">' . $this->l('Troubleshooting', 'form') . '</h2>',
|
|
// ],
|
|
// [
|
|
// 'type' => 'select',
|
|
// 'label' => $this->l('FontAwesome compatibility', 'form'),
|
|
// 'desc' => $this->l('If you use third-party theme with FontAwesome instead of default MaterialUI icons, turn this option on', 'form'),
|
|
// 'name' => ConfigKeys::THEME_FONTAWESOME,
|
|
// 'validation' => 'isAnything',
|
|
// 'options' => [
|
|
// 'query' => [
|
|
// [
|
|
// 'id' => 0,
|
|
// 'name' => $this->l('No', 'form'),
|
|
// ],
|
|
// [
|
|
// 'id' => 1,
|
|
// 'name' => $this->l('Yes', 'form'). ' '.$this->l('(version 4 or 6)', 'form'),
|
|
// ],
|
|
// [
|
|
// 'id' => 2,
|
|
// 'name' => $this->l('Yes', 'form'). ' '.$this->l('(version 5 or 6)', 'form'),
|
|
// ],
|
|
// ],
|
|
// 'id' => 'id',
|
|
// 'name' => 'name',
|
|
// ],
|
|
// 'default' => 0,
|
|
// 'class' => 'fixed-width-xxl',
|
|
// 'form_group_class' => $this->ps_version < 1.7 ? 'hide' : '',
|
|
// ],
|
|
],
|
|
'submit' => [
|
|
'title' => $this->l('Save', 'form'),
|
|
],
|
|
],
|
|
];
|
|
|
|
return $fields_form;
|