<?php 
class ControllerModulePerfectOneCheckout extends Controller {
    private $error = array();

    private $data_to_view = array();

    public function __construct($registry) {

        parent::__construct($registry);

        $this->extension_type = 'module';
        $this->real_extension_type = (version_compare(VERSION, '2.3', '>=') ? 'extension/':'').$this->extension_type;

        $this->extension_url_cancel_oc_15x = 'common/home';
        $this->extension_url_cancel_oc_2x = 'common/dashboard';

        $this->extension_name = 'perfect_one_checkout';
        $this->extension_group_config = 'poc';
        $this->extension_id = '5938160e-756c-458a-bed5-0a00953eaa19';

        $this->oc_version = version_compare(VERSION, '3.0.0.0', '>=') ? 3 : (version_compare(VERSION, '2.0.0.0', '>=') ? 2 : 1);

        $this->data_to_view = array(
            'button_apply_allowed' => true,
            'button_save_allowed' => false,
            'extension_name' => $this->extension_name,
            'license_id' => $this->config->get($this->extension_group_config.'_license_id') ? $this->config->get($this->extension_group_config.'_license_id') : '',
            'oc_version' => $this->oc_version
        );
        $this->license_id = $this->config->get($this->extension_group_config.'_license_id') ? $this->config->get($this->extension_group_config.'_license_id') : '';
        $this->form_file_path = str_replace('system/', '', DIR_SYSTEM).$this->extension_name.'_form.txt';
        $this->form_file_url = HTTP_CATALOG.$this->extension_name.'_form.txt';

        $this->api_url = defined('DEVMAN_SERVER_TEST') ? DEVMAN_SERVER_TEST : 'https://devmanextensions.com/';
        $this->is_oc_3x = $this->oc_version >= 3;
        $this->use_session_form = !$this->is_oc_3x;

        $this->form_token_name = 'devmanextensions_form_token_'.$this->extension_group_config;
        $this->form_session_name = 'devmanextensions_form_'.$this->extension_group_config;

        //Devman Extensions - info@devmanextensions.com - 2017-06-26 21:41:41 - Added Opencart 3.X Compatibility
            $this->token_name = version_compare(VERSION, '3.0.0.0', '<') ? 'token' : 'user_token';
            $this->token = $this->session->data[$this->token_name];
            $this->extension_view = version_compare(VERSION, '3.0.0.0', '<') ? $this->extension_name.'.tpl' : $this->extension_name;
        //END

        $this->path_modules = version_compare(VERSION, '3', '>=') ? 'marketplace/extension' : (version_compare(VERSION, '2.3', '>=') ? 'extension/extension' : 'extension/module');
        $this->url_modules = $this->url->link($this->path_modules, $this->token_name.'=' . $this->token, 'SSL');

        $this->path_home = version_compare(VERSION, '2.3', '>=') ? 'common/dashboard' : 'common/home';
        $this->url_home = $this->url->link($this->path_home, $this->token_name.'=' . $this->token, 'SSL');

        $this->path_module = $this->real_extension_type.'/'.$this->extension_name;
        $this->url_module = $this->url->link($this->path_module, $this->token_name.'=' . $this->token, 'SSL');

        $loader = new Loader($registry);
        $loader->language($this->real_extension_type.'/'.$this->extension_name);
        $loader->model('design/layout');
        $loader->model('extension/devmanextensions/tools');
        $loader->model('localisation/language');
        $loader->model('catalog/product');
        $loader->model('tool/image');

        //Set layouts
            $layouts_temp = $this->model_design_layout->getLayouts();
            $layouts = array();
            foreach ($layouts_temp as $key => $layout) {
                $layouts[$layout['layout_id']] = $layout['name'];
            }
            $this->layouts = $layouts;
        //END Set layouts

        //Devman Extensons - info@devmanextensions.com - 2016-10-09 19:32:04 - Load stores
            $this->stores = $this->model_extension_devmanextensions_tools->getStores();
        //END

        //Set statuses
            $this->statuses = array(
                1 => $this->language->get('active'),
                0 => $this->language->get('disabled')
            );
        //END Set statuses

        //Set positions
            $this->positions = array(
                'content_top' => $this->language->get('text_content_top'),
                'content_bottom' => $this->language->get('text_content_bottom'),
                'column_left' => $this->language->get('text_column_left'),
                'column_right' => $this->language->get('text_column_right'),
            );
        //END Set positions

        //Is the first time that configure extension?
            $this->setting_group_code = version_compare(VERSION, '2.0.1.0', '>=') ? 'code' : '`group`';
            $results = $this->db->query('SELECT setting_id FROM '. DB_PREFIX . 'setting WHERE '.$this->setting_group_code.' = "'.$this->extension_group_config.'" AND `key` NOT LIKE "%license_id%" LIMIT 1');
            $this->first_configuration = empty($results->row['setting_id']);
        //END

        //Devman Extensons - info@devmanextensions.com - 2016-10-09 19:39:52 - Load languages
            $languages = $this->model_localisation_language->getLanguages();
            $this->langs = $this->model_extension_devmanextensions_tools->formatLanguages($languages);
        //END

        //Devman Extensions - info@devmanextensions.com - 2017-08-29 19:25:03 - Get customer groups
            $customer_groups = $this->model_extension_devmanextensions_tools->getCustomerGroups();
            $this->cg = $customer_groups;
        //END

        $this->oc_2 = version_compare(VERSION, '2.0.0.0', '>=');
        $this->oc_3 = version_compare(VERSION, '3.0.0.0', '>=');

        $this->no_image_thumb = $this->model_tool_image->resize('no_image.'.($this->oc_2 ? 'png':'jpg'), 100, 100);

        //Devman Extensions - info@devmanextensions.com - 2017-08-29 18:52:09 - Construct a variable to pass all basic datas to generate form in API
            $form_basic_datas = array(
                'tab_changelog' => true,
                'tab_help' => true,
                'tab_faq' => true,
                'extension_id' => $this->extension_id,
                'first_configuration' => $this->first_configuration,
                'positions' => $this->positions,
                'statuses' => $this->statuses,
                'stores' => $this->stores,
                'layouts' => $this->layouts,
                'languages' => $this->langs,
                'oc_version' => $this->oc_version,
                'oc_2' => $this->oc_2,
                'oc_3' => $this->oc_3,
                'customer_groups' => $this->cg,
                'version' => VERSION,
                'token' => $this->token,
                'extension_group_config' => $this->extension_group_config,
                'extension_name' => $this->extension_name,
                'no_image_thumb' => $this->no_image_thumb,
                'lang' => array(
                    'choose_store' => $this->language->get('choose_store'),
                    'text_browse' => $this->language->get('text_browse'),
                    'text_clear' => $this->language->get('text_clear'),
                    'text_sort_order' => $this->language->get('text_sort_order'),
                    'text_clone_row' => $this->language->get('text_clone_row'),
                    'text_remove' => $this->language->get('text_remove'),
                    'text_add_module' => $this->language->get('text_add_module'),
                    'tab_help' => $this->language->get('tab_help'),
                    'tab_changelog' => $this->language->get('tab_changelog'),
                    'tab_faq' => $this->language->get('tab_faq'),
                ),
            );

            $this->form_basic_datas = $form_basic_datas;
        //END

        $this->form_array = $this->_construct_view_form();
    }

    public function index() {
        $this->load->language((version_compare(VERSION, '3.0.0.0', '>=') ? 'extension/' : '').$this->real_extension_type.'/'.$this->extension_name);
        $this->load->language($this->real_extension_type.'/'.$this->extension_name);
        /*$this->_construct_view_form();
        die("delete_this!");*/
        //Load languages

        //Set document title
            $this->document->setTitle($this->language->get('heading_title_2'));

        //Add scripts and css
            if(version_compare(VERSION, '2.0.0.0', '<'))
            {
                $this->document->addScript('view/javascript/devmanextensions/bootstrap.min.js?'.date('Ymdhis'));
                $this->document->addStyle('view/stylesheet/devmanextensions/bootstrap.min.css?'.date('Ymdhis'));
            }

            $this->document->addStyle('view/stylesheet/devmanextensions/colpick.css?'.date('Ymdhis'));
            $this->document->addStyle('view/stylesheet/devmanextensions/bootstrap-select.min.css?'.date('Ymdhis'));
            $this->document->addStyle('view/stylesheet/devmanextensions/bootstrap-switch.css?'.date('Ymdhis'));
            $this->document->addScript('view/javascript/devmanextensions/colpick.js?'.date('Ymdhis'));
            $this->document->addScript('view/javascript/devmanextensions/bootstrap-select.min.js?'.date('Ymdhis'));
            $this->document->addScript('view/javascript/devmanextensions/tools.js?'.date('Ymdhis'));
            $this->document->addScript('view/javascript/devmanextensions/jquery-sortable.js?'.date('Ymdhis'));
            $this->document->addScript('view/javascript/devmanextensions/bootstrap-switch.min.js?'.date('Ymdhis'));
            $this->document->addStyle('view/stylesheet/devmanextensions/license_form.css?'.date('Ymdhis'));

            if(version_compare(VERSION, '2.0.0.0', '>='))
            {
                $this->document->addScript('view/javascript/devmanextensions/oc2x.js?'.date('Ymdhis'));
                $this->document->addStyle('view/stylesheet/devmanextensions/oc2x.css?'.date('Ymdhis'));
            }
            else
            {
                $this->document->addScript('view/javascript/devmanextensions/oc15x.js?'.date('Ymdhis'));
                $this->document->addStyle('view/stylesheet/devmanextensions/oc15x.css?'.date('Ymdhis'));
                $this->document->addScript('view/javascript/ckeditor/ckeditor.js?'.date('Ymdhis'));
                $this->document->addStyle('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css?'.date('Ymdhis'));
            }
        //END Add scripts and css

        //Add custom js
            if(file_exists('view/javascript/devmanextensions_'.$this->extension_name.'.js'))
                $this->document->addScript('view/javascript/devmanextensions_'.$this->extension_name.'.js?'.date('Ymdhis'));

            if(version_compare(VERSION, '2.0.0.0', '>=') && file_exists('view/javascript/devmanextensions_'.$this->extension_name.'_oc2x.js'))
                $this->document->addScript('view/javascript/devmanextensions_'.$this->extension_name.'_oc2x.js?'.date('Ymdhis'));
            elseif(file_exists('view/javascript/devmanextensions_'.$this->extension_name.'_oc15x.js'))
                $this->document->addScript('view/javascript/devmanextensions_'.$this->extension_name.'_oc15x.js?'.date('Ymdhis'));

        //Add custom css
            if(file_exists('view/stylesheet/devmanextensions_'.$this->extension_name.'.css'))
                $this->document->addStyle('view/stylesheet/devmanextensions_'.$this->extension_name.'.css?'.date('Ymdhis'));

            if(version_compare(VERSION, '2.0.0.0', '>=') && file_exists('view/stylesheet/devmanextensions_'.$this->extension_name.'_oc2x.css'))
                $this->document->addStyle('view/stylesheet/devmanextensions_'.$this->extension_name.'_oc2x.css?'.date('Ymdhis'));
            elseif(file_exists('view/stylesheet/devmanextensions_'.$this->extension_name.'_oc15x.css'))
                $this->document->addStyle('view/stylesheet/devmanextensions_'.$this->extension_name.'_oc15x.css?'.date('Ymdhis'));

        //Devman Extensions - info@devmanextensions.com - 2016-10-21 18:57:30 - Custom functions
            if(
                !empty($this->request->post['ajax_function']) || !empty($this->request->get['ajax_function'])
                ||
                !empty($this->request->post[$this->extension_group_config.'_ajax_function']) || !empty($this->request->get[$this->extension_group_config.'ajax_function'])
            )
            {
                if(!empty($this->request->post['ajax_function']) || !empty($this->request->get['ajax_function']))
                    $index = 'ajax_function';
                else
                    $index = $this->extension_group_config.'_force_function';

                $post_get = !empty($this->request->post[$index]) ? 'post' : 'get';
                $this->{$this->request->{$post_get}[$index]}();
            }
        //END

        //Pressed save button
            if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
                $no_exit = !empty($this->request->post['no_exit']) ? 1 : 0;

                //Devman Extensions - info@devmanextensions.com - 2016-10-21 18:57:30 - Custom functions
                    if(
                        !empty($this->request->post['force_function']) || !empty($this->request->get['force_function'])
                        ||
                        !empty($this->request->post[$this->extension_group_config.'_force_function']) || !empty($this->request->get[$this->extension_group_config.'force_function'])
                    )
                    {
                        if(!empty($this->request->post['force_function']) || !empty($this->request->get['force_function']))
                            $index = 'force_function';
                        else
                            $index = $this->extension_group_config.'_force_function';

                        $post_get = !empty($this->request->post[$index]) ? 'post' : 'get';
                        $this->{$this->request->{$post_get}[$index]}();
                    }
                //END

                unset($this->request->post['no_exit']);

                //Serialize multiples field from table inputs
                    foreach ($this->request->post as $input_name => $data_post) {
                        if(is_array($data_post) && isset($data_post['replace_by_number']))
                        {
                            unset($data_post['replace_by_number']);

                            if(empty($data_post))
                                $this->request->post[$input_name] = '';
                            else
                                $this->request->post[$input_name] = base64_encode(serialize(array_values($data_post)));
                        }
                    }
                //END Serialize multiples field from table inputs

                $error = $this->_test_before_save();

                if(!$error)
                {
                    $this->load->model('setting/setting');
                    $this->model_setting_setting->editSetting($this->extension_group_config, $this->request->post);

                    if(!empty($no_exit))
                    {
                        $array_return = array(
                            'error' => false,
                            'message' => $this->language->get('text_success')
                        );
                        echo json_encode($array_return); die;
                    }
                    else
                        $this->session->data['success'] = $this->language->get('text_success');

                    $after_save_temp = version_compare(VERSION, '2.0.0.0', '>=') ? $this->extension_url_after_save_oc_20x : $this->extension_url_after_save_oc_15x;
                    $after_save_temp = version_compare(VERSION, '2.3.0.0', '>=') ? $this->extension_url_after_save_oc_23x : $after_save_temp;

                    if(version_compare(VERSION, '2.0.0.0', '>='))
                        $this->response->redirect($this->url->link($after_save_temp, $this->token_name.'=' . $this->token, 'SSL'));
                    else
                        $this->redirect($after_save_temp, $this->token_name.'=' . $this->token, 'SSL');
                }
                else
                {
                    if(!empty($no_exit))
                    {
                        $array_return = array(
                            'error' => true,
                            'message' => $error
                        );
                        echo json_encode($array_return); die;
                    }
                    else
                        $this->session->data['error'] = $error;

                    if(version_compare(VERSION, '2.0.0.0', '>='))
                        $this->response->redirect($this->url->link($this->extension_url_after_save_error, $this->token_name.'=' . $this->token, 'SSL'));
                    else
                        $this->redirect($this->extension_url_after_save_error, $this->token_name.'=' . $this->token, 'SSL');
                }
            }
        //END Pressed save button

        //Devman Extensons - info@devmanextensions.com - 2016-10-21 18:57:30 - Custom functions
            if(!empty($this->request->post['force_function']) || !empty($this->request->get['force_function']))
            {
                $post_get = !empty($this->request->post['force_function']) ? 'post' : 'get';
                $this->{$this->request->{$post_get}['force_function']}();
            }
        //END

        //Send token to view
            $this->data_to_view['token'] = $this->token;

        //Actions
            $this->data_to_view['action'] = $this->url->link($this->real_extension_type.'/'.$this->extension_name, $this->token_name.'=' . $this->token, 'SSL');
            $this->data_to_view['cancel'] = $this->url->link(version_compare(VERSION, '2.0.0.0', '>=') ? $this->extension_url_cancel_oc_20x : $this->extension_url_cancel_oc_15x, $this->token_name.'=' . $this->token, 'SSL');

        //Load extension languages
            $lang_array = array(
                'heading_title',
                'heading_title_2',
                'button_save',
                'button_cancel',
                'apply_changes',
                'text_image_manager',
                'text_browse',
                'text_clear',
                'text_validate_license',
                'text_license_id',
                'text_send',
            );

            foreach ($lang_array as $key => $value) {
                $this->data_to_view[$value] = $this->language->get($value);
            }
        //END Load extension languages

        //Construct view template form
            $form = $this->model_extension_devmanextensions_tools->_get_form_in_settings();
            $this->data_to_view['form'] =  !empty($form) ? $form : '';
        //END Construct view template form

        //Devman Extensons - info@devmanextensions.com - 2016-11-19 14:43:03 - Send custom variables to view
                $this->_send_custom_variables_to_view();
        //END

        $this->data_to_view['breadcrumbs'] = array();
        $this->data_to_view['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url_home,
            'separator' => false
        );

        $this->data_to_view['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_'.$this->extension_type),
            'href'      => $this->url_modules,
            'separator' => ' :: '
        );

        $this->data_to_view['breadcrumbs'][] = array(
            'text'      => $this->language->get('heading_title_2'),
            'href'      => $this->url->link($this->real_extension_type.'/'.$this->extension_name, $this->token_name.'=' . $this->token, 'SSL'),
            'separator' => ' :: '
        );

        //Devman Extensions - info@devmanextensions.com - 2017-06-28 20:47:35 - Opencart 3.x compatibility with alerts
            if(version_compare(VERSION, '3.0.0.0', '>='))
            {
                if(!empty($this->session->data['error']))
                {
                    $this->data_to_view['error_warning'] = $this->session->data['error'];
                    unset($this->session->data['error']);
                }

                if(!empty($this->session->data['error_expired']))
                {
                    $this->data_to_view['error_warning_expired'] = $this->session->data['error_expired'];
                    unset($this->session->data['error_expired']);
                }

                if(!empty($this->session->data['success']))
                {
                    $this->data_to_view['success_message'] = $this->session->data['success'];
                    unset($this->session->data['success']);
                }

                if(!empty($this->session->data['info']))
                {
                    $this->data_to_view['info_message'] = $this->session->data['info'];
                    unset($this->session->data['info']);
                }
            }
        //END

        //OC Versions compatibility
            if(version_compare(VERSION, '2.0.0.0', '>='))
            {
                $data = $this->data_to_view;
                $data['header'] = $this->load->controller('common/header');
                $data['column_left'] = $this->load->controller('common/column_left');
                $data['footer'] = $this->load->controller('common/footer');

                $this->response->setOutput($this->load->view($this->real_extension_type.'/'.$this->extension_view, $data));
            }
            else
            {
                $this->data = $this->data_to_view;
                $this->template = $this->real_extension_type.'/'.$this->extension_view;
                $this->children = array(
                    'common/header',
                    'common/footer'
                );

                $this->response->setOutput($this->render());
            }
    }

    private function validate() {
        if (!$this->user->hasPermission('modify', $this->real_extension_type.'/'.$this->extension_name)) {
            if(!empty($this->request->post['no_exit']))
            {
                $array_return = array(
                    'error' => true,
                    'message' => $this->language->get('error_permission')
                );
                echo json_encode($array_return); die;
            }
            else
                $this->session->data['error'] = $this->language->get('error_permission');
            return false;
        }
        return true;
    }

    public function _construct_view_form()
    {
        if(version_compare(VERSION, '3.0.0.0', '>=')) {
            if(is_file(DIR_APPLICATION.'view/template/module/perfect_one_checkout.tpl'))
                unlink(DIR_APPLICATION.'view/template/module/perfect_one_checkout.tpl');
        }

        $validation_rules = array(
            '' => $this->language->get('rule_not_rule'),
            'not_empty' => $this->language->get('rule_not_empty'),
            'between_1_32' => $this->language->get('rule_between_1_32'),
            'between_2_10' => $this->language->get('rule_between_2_10'),
            'between_3_32' => $this->language->get('rule_between_3_32'),
            'between_4_20' => $this->language->get('rule_between_4_20'),
            'between_2_128' => $this->language->get('rule_between_2_128'),
            'between_3_128' => $this->language->get('rule_between_3_128'),
            'valid_email' => $this->language->get('rule_valid_email'),
        );

        //<editor-fold desc="Inputs to guest shipping form">
            $addresses = array('billing', 'delivery');
            $inputs = array(
                'customer_group_id' => array(
                    'type' => 'radio',
                    'default' => false,
                    'skip' => 'delivery',
                    'var_options' => 'customer_groups',
                    'delete' => array(
                        'billing' => array('rule_guest', 'status_guest', 'placeholder', 'validation_rule', 'error_message', 'status_logged', 'rule_logged', 'rule_register'),
                    )
                ),
                'firstname' => array('rule' => 'between_1_32'),
                'lastname' => array('rule' => 'between_1_32'),
                'email' => array(
                    'rule' => 'valid_email',
                    'skip' => 'delivery',
                    'delete' => array(
                        'billing' => array('status_logged', 'rule_logged'),
                        'delivery' => array('status_logged', 'rule_logged')
                    )
                ),
                'telephone' => array(
                    'rule' => 'between_3_32',
                    'skip' => 'delivery',
                    'delete' => array(
                        'billing' => array('status_logged', 'rule_logged'),
                        'delivery' => array('status_logged', 'rule_logged')
                    )
                ),
                'fax' => array(
                    'default' => false,
                    'skip' => 'delivery',
                    'delete' => array(
                        'billing' => array('status_logged', 'rule_logged'),
                        'delivery' => array('status_logged', 'rule_logged')
                    )
                ),
                'company' => array('default' => false),
                'address_1' => array('rule' => 'between_3_128'),
                'address_2' => array('default' => false),
                'city' => array('rule' => 'between_2_128'),
                'postcode' => array('rule' => 'between_2_10'),
                'country_id' => array('rule' => 'not_empty', 'type' => 'select', 'var_options' => 'countries', 'onchange' => 'ajax_get_zones($(this))', 'default_value' => 'default_country_id'),
                'zone_id' => array('rule' => 'not_empty', 'type' => 'select', 'var_options' => 'zones'),
                'password' => array(
                    'type' => 'password',
                    'rule' => 'between_4_20',
                    'skip' => 'delivery',
                    'delete' => array(
                        'billing' => array('status_guest', 'rule_guest', 'status_logged', 'rule_logged')
                    ),
                ),
                'confirm' => array(
                    'type' => 'password',
                    'rule' => 'not_empty',
                    'skip' => 'delivery',
                    'delete' => array(
                        'billing' => array('status_guest', 'rule_guest', 'status_logged', 'rule_logged')
                    ),
                ),
                'newsletter' => array(
                    'type' => 'checkbox',
                    'delete' => array(
                        'billing' => array('placeholder', 'validation_rule', 'error_message', 'status_guest', 'rule_guest', 'status_logged', 'rule_logged')
                    ),
                    'skip' => 'delivery'
                ),
                'agree_privacy_policy' => array(
                    'type' => 'checkbox',
                    'delete' => array(
                        'billing' => array('placeholder', 'status_logged', 'rule_logged')
                    ),
                    'skip' => 'delivery',
                    'default' => true,
                    'rule' => 'not_empty'
                )
            );

            //Devman Extensions - info@devmanextensions.com - 2017-07-15 17:27:15 - Insert custom fields
                if(version_compare(VERSION, '2.0.0.0', '>='))
                {
                    $model_to_load = version_compare(VERSION, '2.1', '<') ? 'sale/custom_field' : 'customer/custom_field';
                    $model_name = version_compare(VERSION, '2.1', '<') ? 'model_sale_custom_field' : 'model_customer_custom_field';

                    $this->load->model($model_to_load);
                    $custom_fields = $this->{$model_name}->getCustomFields(array());

                    if(!empty($custom_fields))
                    {
                        foreach ($custom_fields as $key => $cf) {
                            $inputs['custom_field_'.$cf['custom_field_id']] = array(
                                'is_custom_field' => true,
                                'name' => $cf['name'],
                                'custom_field_id' => $cf['custom_field_id'],
                            );
                        }
                    }
                }
            //END

            foreach ($addresses as $key => $address) {
                ${$address.'_form_inputs'} = array();

                //Devman Extensions - info@devmanextensions.com - 2017-02-27 20:04:28 - Restore order
                    $inputs_ordered = array();

                    $config_data = $this->config->get('poc_'.$address.'_address');

                    if(!empty($config_data))
                    {
                        foreach ($config_data as $input_name => $val) {
                            if(in_array($input_name, $inputs))
                                $inputs_ordered[$input_name] = $inputs[$input_name];
                        }

                        //Insert loose inputs
                        foreach ($inputs as $input_name => $input_val) {
                            if(!isset($inputs_ordered[$input_name]))
                                $inputs_ordered[$input_name] = $input_val;
                        }
                    }
                    else
                        $inputs_ordered = $inputs;
                //END

                foreach ($inputs_ordered as $input_name => $input) {
                    if(empty($input['is_custom_field']) && empty($input['skip']) || (!empty($input['skip']) && $address != $input['skip']))
                    {
                        if(in_array($input_name, array('country_id', 'zone_id')))
                            $input['var_options'] .= '_'.$address;

                        $temp = array(
                            array(
                                'type' => 'text',
                                'name' => '['.$input_name.'][label]',
                                'multilanguage' => true,
                                'default' => $this->language->get($address.'_input_'.$input_name.'_label_default'),
                                'placeholder' => $this->language->get($address.'_input_'.$input_name.'_label_default'),
                                'name_to_delete' => 'label'
                            ),
                            array(
                                'type' => 'text',
                                'name' => '['.$input_name.'][placeholder]',
                                'multilanguage' => true,
                                'default' => $this->language->get($address.'_input_'.$input_name.'_placeholder_default'),
                                'placeholder' => $this->language->get($address.'_input_'.$input_name.'_label_default'),
                                'name_to_delete' => 'placeholder'
                            ),
                            array(
                                'type' => 'select',
                                'name' => '['.$input_name.'][validation_rule]',
                                'options' => $validation_rules,
                                'default' => !empty($input['rule']) ? $input['rule'] : '',
                                'name_to_delete' => 'validation_rule'
                            ),
                            array(
                                'type' => 'text',
                                'name' => '['.$input_name.'][error_message]',
                                'default' => $this->language->get($address.'_input_'.$input_name.'_error_message_default'),
                                'multilanguage' => true,
                                'name_to_delete' => 'error_message'
                            ),
                            array(
                                array(
                                    'type' => 'switch_label',
                                    'on_label' => $this->language->get($address.'_input_'.$input_name.'_status_yes'),
                                    'off_label' => $this->language->get($address.'_input_'.$input_name.'_status_no'),
                                    'middle_label' => $this->language->get($address.'_input_'.$input_name.'_status'),
                                    'name' => '['.$input_name.'][status_guest]',
                                    'default' => isset($input['default']) ? $input['default']: true,
                                    'name_to_delete' => 'status_guest'
                                ),
                                array(
                                    'type' => 'switch_label',
                                    'on_label' => $this->language->get($address.'_input_'.$input_name.'_rule_yes'),
                                    'off_label' => $this->language->get($address.'_input_'.$input_name.'_rule_no'),
                                    'middle_label' => $this->language->get($address.'_input_'.$input_name.'_rule'),
                                    'name' => '['.$input_name.'][rule_guest]',
                                    'default' => isset($input['default']) ? $input['default']: true,
                                    'name_to_delete' => 'rule_guest'
                                )
                            ),
                            array(
                                array(
                                    'type' => 'switch_label',
                                    'on_label' => $this->language->get($address.'_input_'.$input_name.'_status_yes'),
                                    'off_label' => $this->language->get($address.'_input_'.$input_name.'_status_no'),
                                    'middle_label' => $this->language->get($address.'_input_'.$input_name.'_status'),
                                    'name' => '['.$input_name.'][status_register]',
                                    'default' => isset($input['default']) ? $input['default']: true,
                                    'name_to_delete' => 'status_register'
                                ),
                                array(
                                    'type' => 'switch_label',
                                    'on_label' => $this->language->get($address.'_input_'.$input_name.'_rule_yes'),
                                    'off_label' => $this->language->get($address.'_input_'.$input_name.'_rule_no'),
                                    'middle_label' => $this->language->get($address.'_input_'.$input_name.'_rule'),
                                    'name' => '['.$input_name.'][rule_register]',
                                    'default' => isset($input['default']) ? $input['default']: true,
                                    'name_to_delete' => 'rule_register'
                                )
                            ),
                            array(
                                array(
                                    'type' => 'switch_label',
                                    'on_label' => $this->language->get($address.'_input_'.$input_name.'_status_yes'),
                                    'off_label' => $this->language->get($address.'_input_'.$input_name.'_status_no'),
                                    'middle_label' => $this->language->get($address.'_input_'.$input_name.'_status'),
                                    'name' => '['.$input_name.'][status_logged]',
                                    'default' => isset($input['default']) ? $input['default']: true,
                                    'name_to_delete' => 'status_logged'
                                ),
                                array(
                                    'type' => 'switch_label',
                                    'on_label' => $this->language->get($address.'_input_'.$input_name.'_rule_yes'),
                                    'off_label' => $this->language->get($address.'_input_'.$input_name.'_rule_no'),
                                    'middle_label' => $this->language->get($address.'_input_'.$input_name.'_rule'),
                                    'name' => '['.$input_name.'][rule_logged]',
                                    'default' => isset($input['default']) ? $input['default']: true,
                                    'name_to_delete' => 'rule_logged'
                                )
                            ),
                            array(
                                'type' => 'hidden',
                                'name' => '['.$input_name.'][type]',
                                'value' => !empty($input['type']) ? $input['type'] : 'text'
                            ),
                            array(
                                'type' => 'hidden',
                                'name' => '['.$input_name.'][var_options]',
                                'value' => !empty($input['var_options']) ? $input['var_options'] : ''
                            ),
                            array(
                                'type' => 'hidden',
                                'name' => '['.$input_name.'][onchange]',
                                'value' => !empty($input['onchange']) ? $input['onchange'] : ''
                            ),
                            array(
                                'type' => 'hidden',
                                'name' => '['.$input_name.'][default_value]',
                                'value' => !empty($input['default_value']) ? $input['default_value'] : ''
                            )
                        );

                        if(!empty($input['delete']) && !empty($input['delete'][$address]))
                            $temp = $this->model_extension_devmanextensions_tools->unsetArrayByValue($temp, 'name_to_delete', $input['delete'][$address], false);

                        //Devman Extensions - info@devmanextensions.com - 2017-03-04 12:15:37 - Remove elements depends input
                            //Only show wish subscribe in column register
                                if(in_array($input_name, array('newsletter')))
                                {
                                    $temp[5][1] = array(
                                        'type' => 'switch_label',
                                        'on_label' => $this->language->get($address.'_input_'.$input_name.'_rule_yes'),
                                        'off_label' => $this->language->get($address.'_input_'.$input_name.'_rule_no'),
                                        'middle_label' => $this->language->get($address.'_input_'.$input_name.'_checked'),
                                        'name' => '['.$input_name.'][checked_register]',
                                        'default' => true
                                    );
                                } else if(in_array($input_name, array('agree_privacy_policy'))) {
                                    $temp[4][2] = array(
                                        'type' => 'switch_label',
                                        'on_label' => $this->language->get($address.'_input_'.$input_name.'_rule_yes'),
                                        'off_label' => $this->language->get($address.'_input_'.$input_name.'_rule_no'),
                                        'middle_label' => $this->language->get($address.'_input_'.$input_name.'_checked'),
                                        'name' => '['.$input_name.'][checked_guest]',
                                        'default' => false
                                    );
                                    $temp[5][2] = array(
                                        'type' => 'switch_label',
                                        'on_label' => $this->language->get($address.'_input_'.$input_name.'_rule_yes'),
                                        'off_label' => $this->language->get($address.'_input_'.$input_name.'_rule_no'),
                                        'middle_label' => $this->language->get($address.'_input_'.$input_name.'_checked'),
                                        'name' => '['.$input_name.'][checked_register]',
                                        'default' => false
                                    );
                                }
                            //END
                        //END

                        //Devman Extensions - info@devmanextensions.com - 2017-03-07 20:54:49 - In delivery form delete columns register and logged
                            if($address == 'delivery')
                            {
                                unset($temp[5]);
                                unset($temp[6]);
                            }
                        //END

                        ${$address.'_form_inputs'}[] = $temp;
                    }
                    elseif (!empty($input['is_custom_field']))
                    {
                        $temp = array(
                            array(
                                'type' => 'text',
                                'readonly' => true,
                                'name' => '[custom_field_'.$input['custom_field_id'].'][label]',
                                'default' => $input['name'],
                                'placeholder' => $input['name']
                            ),
                            array(),
                            array(),
                            array(
                                'type' => 'text',
                                'name' => '[custom_field_'.$input['custom_field_id'].'][error_message]',
                                'default' => '',
                                'multilanguage' => true,
                                'name_to_delete' => 'error_message'
                            ),
                            array(),
                            array(),
                            array(),
                        );

                        if($address == 'delivery')
                        {
                            unset($temp[6]);
                            unset($temp[5]);
                        }

                        ${$address.'_form_inputs'}[] = $temp;
                    }
                }
            }
        //</editor-fold>

        //<editor-fold desc="Payment & shipping methods">
            $fields_payment_shipping_methods = array();

            $types = array('payment', 'shipping');
            foreach ($types as $key => $type) {

                if(version_compare(VERSION, '2', '<') || version_compare(VERSION, '3.0.0.0', '>=')) {
                    $this->load->model('setting/extension');
                    $modules = $this->model_setting_extension->getInstalled($type);
                } else {
                    $this->load->model('extension/extension');
                    $modules = $this->model_extension_extension->getInstalled($type);
                }

                $fields_payment_shipping_methods[] = array(
                    'type' => 'legend',
                    'text' => $this->language->get($type.'_method_image_legend')
                );
                if(!empty($modules)) {
                    foreach ($modules as $key => $module_code) {
                        if(version_compare(VERSION, '2', '>='))
                            $this->load->language('extension/'.$type.'/' . $module_code);

                        $this->load->language($type.'/' . $module_code);
                        $image_route = 'view/theme/perfect_one_checkout/img/'.$type.'/'.$module_code.'.png';
                        $image_path = DIR_CATALOG.$image_route;

                        $fields_payment_shipping_methods[] = array(
                            'type' => 'image',
                            'label' => $this->language->get('heading_title'),
                            'help' => $this->language->get('shipping_payment_method_image_recomended_ratio'),
                            'name' => $type.'_method_image_'.$module_code
                        );

                        $fields_payment_shipping_methods[] = array(
                            'type' => 'html_code',
                            'html_code' => sprintf($this->language->get('shipping_payment_method_image_alternative'), '/catalog/'.$image_route).' -> '.(is_file($image_path) ? '<span style="font-weight:bold; color: #8fbb6c;">'.$this->language->get('shipping_payment_method_image_alternative_exist').'</span>' : '<span style="font-weight:bold; color: #f56b6b;">'.$this->language->get('shipping_payment_method_image_alternative_not_exist').'</span>')
                        );
                    }
                }
            }
        //</editor-fold>

        $pp_locales = array(
            "zh-cn" => "Chinese (People's Republic of China)",
            "zh-hk" => "Chinese (Hong Kong)",
            "zh-tw" => "Chinese (Taiwan)",
            "zh-xc" => "Chinese (US)",
            "da-dk" => "Danish",
            "nl-nl" => "Dutch",
            "en-gb" => "English (Great Britain)",
            "en-au" => "English (Australia)",
            "en-us" => "English (US)",
            "fr-fr" => "French",
            "fr-ca" => "French (Canada)",
            "fr-xc" => "French (international)",
            "de-de" => "German",
            "he-il" => "Hebrew (Israel)",
            "id-id" => "Indonesian",
            "it-il" => "Italian",
            "ja-jp" => "Japanese",
            "no-no" => "Norwegian",
            "pl-pl" => "Polish",
            "pt-pt" => "Portuguese",
            "pt-br" => "Portuguese (Brazil)",
            "ru-ru" => "Russian",
            "es-es" => "Spanish",
            "es-xc" => "Spanish (Mexico)",
            "sv-se" => "Swedish",
            "th-th" => "Thai",
            "tr-tr" => "Turkish",
        );

        $form_view = array(
            'action' => $this->url->link($this->real_extension_type.'/'.$this->extension_name, $this->token_name.'=' . $this->token, 'SSL'),
            'id' => $this->extension_name,
            'extension_name' => $this->extension_name,
            'columns' => 1,
            'tabs' => array(
                $this->language->get('tab_general') => array(
                    'icon' => '<i class="fa fa-cog"></i>',
                    'fields' => array(
                        array(
                            'label' => $this->language->get('status'),
                            'type' => 'boolean',
                            'name' => 'status',
                            'default' => true
                        ),
                        array(
                            'label' => $this->language->get('debug_mode'),
                            'help' => $this->language->get('debug_mode_help'),
                            'type' => 'select',
                            'options' => $this->model_extension_devmanextensions_tools->getUsersSelect(),
                            'name' => 'debug_mode',
                        ),
                        array(
                            'label' => $this->language->get('design_container_max_width'),
                            'help' => $this->language->get('design_container_max_width_help'),
                            'type' => 'text',
                            'name' => 'design_container_max_width',
                            'default' => ''
                        ),
                        array(
                            'label' => $this->language->get('design_container_remove_padding'),
                            'help' => $this->language->get('design_container_remove_padding_help'),
                            'type' => 'boolean',
                            'name' => 'design_container_remove_padding',
                            'default' => false
                        ),
                        array(
                            'label' => $this->language->get('design_icons'),
                            'help' => $this->language->get('design_icons_help'),
                            'type' => 'select',
                            'name' => 'design_icons',
                            'options' => array(
                                'typicons' => $this->language->get('design_icons_typicons_label'),
                                'fontawesome' => $this->language->get('design_icons_awesome_label')
                            )
                        ),
                        array(
                            'label' => $this->language->get('design_include_icon_awesome_lib'),
                            'type' => 'boolean',
                            'name' => 'design_include_icon_awesome_lib',
                            'default' => true
                        ),
                        array(
                            'label' => $this->language->get('design_include_icon_tyicons_lib'),
                            'type' => 'boolean',
                            'name' => 'design_include_icon_tyicons_lib',
                            'default' => true
                        ),
                        array(
                            'label' => $this->language->get('coupon'),
                            'type' => 'boolean',
                            'name' => 'coupon',
                            'default' => true
                        ),
                        array(
                            'label' => $this->language->get('gift'),
                            'type' => 'boolean',
                            'name' => 'gift',
                            'default' => true
                        ),
                        array(
                            'label' => $this->language->get('reward'),
                            'type' => 'boolean',
                            'name' => 'reward',
                            'default' => false
                        ),
                        array(
                            'label' => $this->language->get('guest_buy'),
                            'type' => 'boolean',
                            'name' => 'guest_buy',
                            'default' => true
                        ),
                        array(
                            'type' => 'boolean',
                            'name' => 'go_to_checkout_after_add_to_cart',
                            'label' => $this->language->get('go_to_checkout_after_add_to_cart'),
                            'help' => $this->language->get('go_to_checkout_after_add_to_cart_help'),
                            'default' => false
                        ),
                    ),
                ),
                $this->language->get('tab_address') => array(
                    'icon' => '<i class="fa fa-book fa-fw" aria-hidden="true"></i>',
                    'fields' => array(
                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('billing_explain_general')
                        ),

                        array(
                            'type' => 'boolean',
                            'name' => 'billing_same_address_checked',
                            'label' => $this->language->get('billing_same_address_checked'),
                            'default' => true
                        ),
                        array(
                            'type' => 'boolean',
                            'name' => 'modals_in_forms',
                            'label' => $this->language->get('modals_in_forms'),
                            'default' => false
                        ),
                        array(
                            'type' => 'boolean',
                            'name' => 'popup_form_validations',
                            'label' => $this->language->get('popup_form_validations'),
                            'help' => $this->language->get('popup_form_validations_help'),
                            'default' => false
                        ),
                        array(
                            'type' => 'boolean',
                            'name' => 'order_comment_required',
                            'label' => $this->language->get('order_comment_required'),
                            'default' => false
                        ),
                        array(
                            'type' => 'boolean',
                            'name' => 'address_geo_ip_localization',
                            'label' => $this->language->get('address_geo_ip_localization'),
                            'help' => $this->language->get('address_geo_ip_localization_help'),
                            'default' => false
                        ),
                        array(
                            'label' => $this->language->get('google_api_address_autocomplete'),
                            'help' => $this->language->get('google_api_address_autocomplete_help'),
                            'type' => 'password',
                            'name' => 'google_api_address_autocomplete',
                            'default' => ''
                        ),
                        array(
                            'type' => 'html_code',
                            'label' => $this->language->get('google_api_address_autocomplete_information'),
                            'html_code' => $this->language->get('google_api_address_autocomplete_information_link')
                        ),
                        array(
                            'label' => $this->language->get('phone_mask'),
                            'help' => $this->language->get('phone_mask_help'),
                            'type' => 'text',
                            'name' => 'phone_mask',
                            'default' => '',
                            'multilanguage' => true
                        ),
                        array(
                            'label' => $this->language->get('post_code_mask'),
                            'help' => $this->language->get('post_code_mask_help'),
                            'type' => 'text',
                            'name' => 'post_code_mask',
                            'default' => '',
                            'multilanguage' => true
                        ),

                        array(
                            'type' => 'legend',
                            'text' => '<i class="fa fa-book fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;'.$this->language->get('billing_explain_legend')
                        ),

                        array(
                            'type' => 'table',
                            'preffix_config' => 'billing_address',
                            'class' => 'billing_config',
                            'order_draggable' => true,
                            'theads' => array(
                                $this->language->get('billing_thead_label_text'),
                                $this->language->get('billing_thead_placeholder_text'),
                                $this->language->get('billing_thead_required'),
                                $this->language->get('billing_thead_required_text'),
                                $this->language->get('billing_thead_guest'),
                                $this->language->get('billing_thead_register'),
                                $this->language->get('billing_thead_logged'),
                                '',
                                '',
                                ''
                            ),
                            'data' => $billing_form_inputs
                        ),

                        array(
                            'type' => 'legend',
                            'text' => '<i class="fa fa-book fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;'.$this->language->get('delivery_explain_legend')
                        ),

                        array(
                            'type' => 'table',
                            'preffix_config' => 'delivery_address',
                            'class' => 'delivery_config',
                            'order_draggable' => true,
                            'theads' => array(
                                $this->language->get('delivery_thead_label_text'),
                                $this->language->get('delivery_thead_placeholder_text'),
                                $this->language->get('delivery_thead_required'),
                                $this->language->get('delivery_thead_required_text'),
                                $this->language->get('delivery_thead_guest'),
                                '',
                                '',
                                ''
                            ),
                            'data' => $delivery_form_inputs
                        ),
                    ),
                ),
                $this->language->get('tab_translations') => array(
                    'icon' => '<i class="fa fa-language"></i>',
                    'fields' => array(
                        //Identification panel
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_identification_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_title]',
                                'multilanguage' => true,
                                'default' => 'Identification'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_icon'),
                                'columns' => 4,
                                'help' => $this->language->get('lang_identification_icon_help'),
                                'type' => 'text',
                                'name' => 'lang[lang][identification_icon]',
                                'multilanguage' => true,
                                'default' => 'user'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_button_login'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_button_login]',
                                'multilanguage' => true,
                                'default' => 'Login'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_button_register'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_button_register]',
                                'multilanguage' => true,
                                'default' => 'Register'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_button_guest'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_button_guest]',
                                'multilanguage' => true,
                                'default' => 'Guest'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_welcome'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_welcome]',
                                'multilanguage' => true,
                                'default' => 'Welcome <b>%s %s</b>, continue the purchase process.'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_forgotten_password'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_forgotten_password]',
                                'multilanguage' => true,
                                'default' => '[link]Forgotten Password[/link]'
                            ),
                        //END
                        //Sign social
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_sign_in_leged')
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_main_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_main_title]',
                                'multilanguage' => true,
                                'default' => 'Sign-In with:'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_success_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_success_title]',
                                'multilanguage' => true,
                                'default' => 'You datas was loaded!'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_google_icon'),
                                'help' => $this->language->get('lang_sign_in_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_google_icon]',
                                'multilanguage' => true,
                                'default' => 'social-google-plus'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_google_text'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_google_text]',
                                'multilanguage' => true,
                                'default' => 'Google'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_facebook_icon'),
                                'help' => $this->language->get('lang_sign_in_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_facebook_icon]',
                                'multilanguage' => true,
                                'default' => 'social-facebook'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_facebook_text'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_facebook_text]',
                                'multilanguage' => true,
                                'default' => 'Facebook'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_paypal_icon'),
                                'help' => $this->language->get('lang_sign_in_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_paypal_icon]',
                                'multilanguage' => true,
                                'default' => 'paypal'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_paypal_text'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_paypal_text]',
                                'multilanguage' => true,
                                'default' => 'Paypal'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_linkedin_icon'),
                                'help' => $this->language->get('lang_sign_in_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_linkedin_icon]',
                                'multilanguage' => true,
                                'default' => 'social-linkedin'
                            ),
                            array(
                                'label' => $this->language->get('lang_sign_in_linkedin_text'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][sign_in_linkedin_text]',
                                'multilanguage' => true,
                                'default' => 'Linkedin'
                            ),
                        //END
                        //Modal login
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_modal_login_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_modal_login_heading'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_login_heading]',
                                'multilanguage' => true,
                                'default' => 'Login'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_modal_login_email'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_login_email]',
                                'multilanguage' => true,
                                'default' => 'E-mail'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_modal_login_error_email'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_login_error_email]',
                                'multilanguage' => true,
                                'default' => 'Entry an email'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_modal_login_password'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_login_password]',
                                'multilanguage' => true,
                                'default' => 'Password'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_modal_login_error_password'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_login_error_password]',
                                'multilanguage' => true,
                                'default' => 'Entry a password'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_error_login'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_error_login]',
                                'multilanguage' => true,
                                'default' => 'Warning: No match for E-Mail Address and/or Password.'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_error_attemps'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_error_attemps]',
                                'multilanguage' => true,
                                'default' => 'Warning: Your account has exceeded allowed number of login attempts. Please try again in 1 hour.'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_button_accept'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_button_accept]',
                                'multilanguage' => true,
                                'default' => 'Login'
                            ),
                            array(
                                'label' => $this->language->get('lang_identification_button_cancel'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_button_cancel]',
                                'multilanguage' => true,
                                'default' => 'Cancel'
                            ),
                        //END
                        //Register login
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_register_modal_legend')
                            ),
                            array(
                                'label' => $this->language->get('lan_identification_modal_register_heading'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_register_heading]',
                                'multilanguage' => true,
                                'default' => 'Register account'
                            ),
                            array(
                                'label' => $this->language->get('lan_identification_modal_register_button_accept'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_register_button_accept]',
                                'multilanguage' => true,
                                'default' => 'Register'
                            ),
                            array(
                                'label' => $this->language->get('lan_identification_modal_register_button_cancel'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][identification_modal_register_button_cancel]',
                                'multilanguage' => true,
                                'default' => 'Cancel'
                            ),
                        //END
                        //Addresses panel
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_addresses_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_title]',
                                'multilanguage' => true,
                                'default' => 'Addresses'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_icon'),
                                'columns' => 4,
                                'help' => $this->language->get('lang_addresses_icon_help'),
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_icon]',
                                'multilanguage' => true,
                                'default' => 'location'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_billing_address'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_billing_address]',
                                'multilanguage' => true,
                                'default' => 'Billing'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_billing_address_icon'),
                                'help' => $this->language->get('lang_addresses_button_billing_address_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_billing_address_icon]',
                                'multilanguage' => true,
                                'default' => 'contacts'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_delivery_address'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_delivery_address]',
                                'multilanguage' => true,
                                'default' => 'Delivery'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_delivery_address_icon'),
                                'help' => $this->language->get('lang_addresses_button_delivery_address_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_delivery_address_icon]',
                                'multilanguage' => true,
                                'default' => 'contacts'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_same_address'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_same_address]',
                                'multilanguage' => true,
                                'default' => 'Same delivery and billing addresses'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_delivery_billing_address'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_delivery_billing_address]',
                                'multilanguage' => true,
                                'default' => 'Delivery & Billing'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_delivery_billing_address_icon'),
                                'help' => $this->language->get('lang_addresses_button_delivery_billing_address_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_delivery_billing_address_icon]',
                                'multilanguage' => true,
                                'default' => 'contacts'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_button_add_new_address_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_button_add_new_address_text]',
                                'multilanguage' => true,
                                'default' => 'New address'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_billing_address_selector_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_billing_address_selector_title]',
                                'multilanguage' => true,
                                'default' => 'Billing'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_delivery_address_selector_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_delivery_address_selector_title]',
                                'multilanguage' => true,
                                'default' => 'Delivery'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_none_state'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_none_state]',
                                'multilanguage' => true,
                                'default' => 'None region / state'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_not_addresses'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_not_addresses]',
                                'multilanguage' => true,
                                'default' => 'Login, register or buy as guest to know addresses information'
                            ),
                        //END
                        //Modal billing addresss
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_addresses_modal_billing_address_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_billing_address_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_billing_address_title]',
                                'multilanguage' => true,
                                'default' => 'Billing address'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_billing_address_button_accept'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_billing_address_button_accept]',
                                'multilanguage' => true,
                                'default' => 'Save'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_billing_address_button_cancel'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_billing_address_button_cancel]',
                                'multilanguage' => true,
                                'default' => 'Cancel'
                            ),
                        //END
                        //Modal delivery addresss
                           array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_addresses_modal_delivery_address_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_delivery_address_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_delivery_address_title]',
                                'multilanguage' => true,
                                'default' => 'Delivery address'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_delivery_address_button_accept'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_delivery_address_button_accept]',
                                'multilanguage' => true,
                                'default' => 'Save'
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_delivery_address_button_cancel'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_delivery_address_button_cancel]',
                                'multilanguage' => true,
                                'default' => 'Cancel'
                            ),
                        //END
                        //Modal delivery & billing addresss
                           array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_addresses_modal_delivery_billing_address_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_addresses_modal_delivery_billing_address_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][addresses_modal_delivery_billing_address_title]',
                                'multilanguage' => true,
                                'default' => 'Delivery & billing address'
                            ),
                        //END
                        //Shipping panel
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_shipping_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_shipping_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][shipping_title]',
                                'multilanguage' => true,
                                'default' => 'Shipping method'
                            ),
                            array(
                                'label' => $this->language->get('lang_shipping_icon'),
                                'columns' => 4,
                                'help' => $this->language->get('lang_shipping_icon_help'),
                                'type' => 'text',
                                'name' => 'lang[lang][shipping_icon]',
                                'multilanguage' => true,
                                'default' => 'globe'
                            ),
                            array(
                                'label' => $this->language->get('lang_shipping_no_shipping_methods'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][shipping_no_shipping_methods]',
                                'multilanguage' => true,
                                'default' => 'Insert a delivery country/zone to get shipping methods'
                            ),
                        //END
                        //Payment panel
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_payment_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_payment_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][payment_title]',
                                'multilanguage' => true,
                                'default' => 'Payment method'
                            ),
                            array(
                                'label' => $this->language->get('lang_payment_icon'),
                                'columns' => 4,
                                'help' => $this->language->get('lang_payment_icon_help'),
                                'type' => 'text',
                                'name' => 'lang[lang][payment_icon]',
                                'multilanguage' => true,
                                'default' => 'credit-card'
                            ),
                            array(
                                'label' => $this->language->get('lang_payment_no_payment_methods'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][payment_no_payment_methods]',
                                'multilanguage' => true,
                                'default' => 'Insert a billing country/zone to get payment methods'
                            ),
                        //END
                        //Cart panel
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_cart_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_title]',
                                'multilanguage' => true,
                                'default' => 'Shopping cart'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_icon'),
                                'columns' => 4,
                                'help' => $this->language->get('lang_cart_icon_help'),
                                'type' => 'text',
                                'name' => 'lang[lang][cart_icon]',
                                'multilanguage' => true,
                                'default' => 'shopping-cart'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_thead_image'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_thead_image]',
                                'multilanguage' => true,
                                'default' => 'Image'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_thead_name'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_thead_name]',
                                'multilanguage' => true,
                                'default' => 'Name'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_thead_quantity'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_thead_quantity]',
                                'multilanguage' => true,
                                'default' => 'Quantity'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_thead_price'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_thead_price]',
                                'multilanguage' => true,
                                'default' => 'Price'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_thead_total'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_thead_total]',
                                'multilanguage' => true,
                                'default' => 'Total'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_insert_coupon'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_insert_coupon]',
                                'multilanguage' => true,
                                'default' => 'Insert coupon code'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_coupon_icon'),
                                'help' => $this->language->get('lang_cart_coupon_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_coupon_icon]',
                                'multilanguage' => true,
                                'default' => 'ticket'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_coupon_success'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_coupon_success]',
                                'multilanguage' => true,
                                'default' => 'Coupon applied successfully!'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_insert_gift'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_insert_gift]',
                                'multilanguage' => true,
                                'default' => 'Insert gift certificate'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_gift_icon'),
                                'help' => $this->language->get('lang_cart_gift_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_gift_icon]',
                                'multilanguage' => true,
                                'default' => 'gift'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_gift_success'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_gift_success]',
                                'multilanguage' => true,
                                'default' => 'Gift applied successfully!'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_insert_reward'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_insert_reward]',
                                'multilanguage' => true,
                                'default' => 'User reward points (Available %s)'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_reward_icon'),
                                'help' => $this->language->get('lang_cart_reward_icon_help'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_reward_icon]',
                                'multilanguage' => true,
                                'default' => 'star-outline'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_reward_success'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_reward_success]',
                                'multilanguage' => true,
                                'default' => 'Reward points applied successfully!'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_out_stock_error'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_out_stock_error]',
                                'multilanguage' => true,
                                'default' => 'The product marked in red are not available in the desired quantity or not in stock'
                            ),
                            array(
                                'label' => $this->language->get('lang_cart_minimum_error'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][cart_minimum_error]',
                                'multilanguage' => true,
                                'default' => ' Minimum order amount for %s is %s!'
                            ),
                        //END
                        //Confirm panel
                            array(
                                'type' => 'legend',
                                'text' => $this->language->get('lang_confirm_legend')
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_title'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_title]',
                                'multilanguage' => true,
                                'default' => 'Confirm order'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_icon'),
                                'columns' => 4,
                                'help' => $this->language->get('lang_confirm_icon_help'),
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_icon]',
                                'multilanguage' => true,
                                'default' => 'thumbs-up'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_comments'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_comments]',
                                'multilanguage' => true,
                                'default' => 'Order comments'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_comments_error'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_comments_error]',
                                'multilanguage' => true,
                                'default' => 'Insert order comments'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_checkbox_terms'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_checkbox_terms]',
                                'multilanguage' => true,
                                'default' => 'I have read and agree to the [link]Terms & Conditions[/link]'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_checkbox_terms_error'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_checkbox_terms_error]',
                                'multilanguage' => true,
                                'default' => 'Accept terms to confirm order'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_button'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_button]',
                                'multilanguage' => true,
                                'default' => 'Confirm Order'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_register_button'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_register_button]',
                                'multilanguage' => true,
                                'default' => 'Register'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error]',
                                'multilanguage' => true,
                                'default' => 'Complete all steps to confirm order'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_billing'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_billing]',
                                'multilanguage' => true,
                                'default' => 'Complete Billing Address'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_shipping'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_shipping]',
                                'multilanguage' => true,
                                'default' => 'Complete Delivery Address'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_shipping_method'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_shipping_method]',
                                'multilanguage' => true,
                                'default' => 'Select one shipping method'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_payment_method'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_payment_method]',
                                'multilanguage' => true,
                                'default' => 'Select one payment method'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_panel_confirm'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_panel_confirm]',
                                'multilanguage' => true,
                                'default' => 'Complete confirm order panel'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_register'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_register]',
                                'multilanguage' => true,
                                'default' => 'Error during register'
                            ),
                            array(
                                'label' => $this->language->get('lang_confirm_error_show_errors'),
                                'columns' => 4,
                                'type' => 'text',
                                'name' => 'lang[lang][confirm_error_show_errors]',
                                'multilanguage' => true,
                                'default' => 'Click to show errors'
                            ),


                        //END
                    )
                ),
                $this->language->get('tab_steps') => array(
                    'icon' => '<i class="fa fa-check-square-o" aria-hidden="true"></i>',
                    'fields' => array(
                        array(
                            'type' => 'boolean',
                            'name' => 'steps_status',
                            'label' => $this->language->get('steps_status'),
                            'default' => true
                        ),
                        array(
                            'type' => 'boolean',
                            'name' => 'hide_uncompleted_panels',
                            'label' => $this->language->get('hide_uncompleted_panels')
                        ),
                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_steps_identification')
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_identification_title'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_identification_title]',
                            'multilanguage' => true,
                            'default' => 'Identification'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_identification_subtitle'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_identification_subtitle]',
                            'multilanguage' => true,
                            'default' => 'Login or create an account'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_identification_icon'),
                            'columns' => 4,
                            'help' => $this->language->get('lang_steps_identification_icon_help'),
                            'type' => 'text',
                            'name' => 'lang[lang][steps_identification_icon]',
                            'multilanguage' => true,
                            'default' => 'user'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_steps_addresses')
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_addresses_title'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_addresses_title]',
                            'multilanguage' => true,
                            'default' => 'Addresses'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_addresses_subtitle'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_addresses_subtitle]',
                            'multilanguage' => true,
                            'default' => 'Set shipping/billing address'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_addresses_icon'),
                            'columns' => 4,
                            'help' => $this->language->get('lang_steps_addresses_icon_help'),
                            'type' => 'text',
                            'name' => 'lang[lang][steps_addresses_icon]',
                            'multilanguage' => true,
                            'default' => 'location'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_steps_shipping')
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_shipping_title'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_shipping_title]',
                            'multilanguage' => true,
                            'default' => 'Shipping'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_shipping_subtitle'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_shipping_subtitle]',
                            'multilanguage' => true,
                            'default' => 'Choose shipping method'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_shipping_icon'),
                            'columns' => 4,
                            'help' => $this->language->get('lang_steps_shipping_icon_help'),
                            'type' => 'text',
                            'name' => 'lang[lang][steps_shipping_icon]',
                            'multilanguage' => true,
                            'default' => 'globe'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_steps_payment')
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_payment_title'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_payment_title]',
                            'multilanguage' => true,
                            'default' => 'Payment'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_payment_subtitle'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_payment_subtitle]',
                            'multilanguage' => true,
                            'default' => 'Choose payment method'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_payment_icon'),
                            'columns' => 4,
                            'help' => $this->language->get('lang_steps_payment_icon_help'),
                            'type' => 'text',
                            'name' => 'lang[lang][steps_payment_icon]',
                            'multilanguage' => true,
                            'default' => 'credit-card'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_steps_confirm')
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_confirm_title'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_confirm_title]',
                            'multilanguage' => true,
                            'default' => 'Confirm Order!'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_confirm_subtitle'),
                            'columns' => 4,
                            'type' => 'text',
                            'name' => 'lang[lang][steps_confirm_subtitle]',
                            'multilanguage' => true,
                            'default' => 'All done =)'
                        ),
                        array(
                            'label' => $this->language->get('lang_steps_confirm_icon'),
                            'columns' => 4,
                            'help' => $this->language->get('lang_steps_confirm_icon_help'),
                            'type' => 'text',
                            'name' => 'lang[lang][steps_confirm_icon]',
                            'multilanguage' => true,
                            'default' => 'thumbs-up'
                        ),
                    )
                ),
                $this->language->get('tab_payment_shipping_methods') => array(
                    'icon' => '<i class="fa fa-truck" aria-hidden="true"></i><i class="fa fa-credit-card" aria-hidden="true"></i>',
                    'fields' => $fields_payment_shipping_methods
                ),
                $this->language->get('tab_sign_in') => array(
                    'icon' => '<i class="fa fa-facebook" aria-hidden="true"></i>',
                    'fields' => array(
                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('sign_in_facebook_legend'),
                            'name' => 'sign_in_facebook_legend'
                        ),
                        array(
                            'type' => 'boolean',
                            'label' => $this->language->get('sign_in_facebook_status'),
                            'name' => 'sign_in_facebook_status'
                        ),
                        array(
                            'type' => 'text',
                            'label' => $this->language->get('sign_in_facebook_app_id'),
                            'name' => 'sign_in_facebook_app_id'
                        ),
                        array(
                            'type' => 'password',
                            'label' => $this->language->get('sign_in_facebook_app_secret'),
                            'name' => 'sign_in_facebook_app_secret'
                        ),
                        array(
                            'type' => 'html_code',
                            'label' => $this->language->get('sign_in_facebook_more_information_label'),
                            'name' => 'sign_in_facebook_more_information_label',
                            'html_code' => $this->language->get('sign_in_facebook_more_information_text')
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('sign_in_paypal_legend'),
                            'name' => 'sign_in_paypal_legend'
                        ),
                        array(
                            'type' => 'boolean',
                            'label' => $this->language->get('sign_in_paypal_status'),
                            'name' => 'sign_in_paypal_status'
                        ),
                        array(
                            'type' => 'text',
                            'label' => $this->language->get('sign_in_paypal_app_id'),
                            'name' => 'sign_in_paypal_app_id'
                        ),
                        array(
                            'type' => 'password',
                            'label' => $this->language->get('sign_in_paypal_secret_id'),
                            'name' => 'sign_in_paypal_secret_id'
                        ),
                        array(
                            'type' => 'select',
                            'options' => $pp_locales,
                            'label' => $this->language->get('sign_in_paypal_locale'),
                            'name' => 'sign_in_paypal_locale'
                        ),
                        array(
                            'type' => 'html_code',
                            'label' => $this->language->get('sign_in_paypal_more_information_label'),
                            'name' => 'sign_in_paypal_more_information_label',
                            'html_code' => $this->language->get('sign_in_paypal_more_information_text')
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('sign_in_linkedin_legend'),
                            'name' => 'sign_in_linkedin_legend'
                        ),
                        array(
                            'type' => 'boolean',
                            'label' => $this->language->get('sign_in_linkedin_status'),
                            'name' => 'sign_in_linkedin_status'
                        ),
                        array(
                            'type' => 'text',
                            'label' => $this->language->get('sign_in_linkedin_client_id'),
                            'name' => 'sign_in_linkedin_client_id'
                        ),
                        array(
                            'type' => 'password',
                            'label' => $this->language->get('sign_in_linkedin_secret_id'),
                            'name' => 'sign_in_linkedin_secret_id'
                        ),
                        array(
                            'type' => 'html_code',
                            'label' => $this->language->get('sign_in_linkedin_more_information_label'),
                            'name' => 'sign_in_linkedin_more_information_label',
                            'html_code' => $this->language->get('sign_in_linkedin_more_information_text')
                        ),


                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('sign_in_google_legend'),
                            'name' => 'sign_in_google_legend'
                        ),
                        array(
                            'type' => 'boolean',
                            'label' => $this->language->get('sign_in_google_status'),
                            'name' => 'sign_in_google_status'
                        ),
                        array(
                            'type' => 'password',
                            'label' => $this->language->get('sign_in_google_client_id'),
                            'name' => 'sign_in_google_client_id'
                        ),
                        array(
                            'type' => 'html_code',
                            'label' => $this->language->get('sign_in_google_more_information_label'),
                            'name' => 'sign_in_google_more_information_label',
                            'html_code' => sprintf($this->language->get('sign_in_google_more_information_text'), 'https://developers.google.com/identity/sign-in/web/devconsole-project')
                        ),
                    )
                ),
                $this->language->get('tab_layout') => array(
                    'icon' => '<i class="fa fa-eye"></i>',
                    'fields' => array(
                        array(
                            'label' => $this->language->get('layout_columns'),
                            'type' => 'select',
                            'options' => array(
                                1 => 1,
                                2 => 2,
                                3 => 3,
                            ),
                            'name' => 'layout_columns',
                            'class' => 'layout_columns',
                            'default' => 3,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'label' => $this->language->get('layout_columns_size_1'),
                            'type' => 'select',
                            'options' => array(
                                3 => '3/12',
                                4 => '4/12',
                                6 => '6/12',
                                8 => '8/12',
                                12 => '12/12'
                            ),
                            'name' => 'layout_columns_size_1',
                            'class' => 'layout_columns_size_1',
                            'default' => 12,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'label' => $this->language->get('layout_columns_size_2'),
                            'type' => 'select',
                            'options' => array(
                                3 => '3/12',
                                4 => '4/12',
                                6 => '6/12',
                                8 => '8/12',
                                12 => '12/12'
                            ),
                            'name' => 'layout_columns_size_2',
                            'class' => 'layout_columns_size_2',
                            'default' => 6,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'label' => $this->language->get('layout_columns_size_3'),
                            'type' => 'select',
                            'options' => array(
                                3 => '3/12',
                                4 => '4/12',
                                6 => '6/12',
                                8 => '8/12',
                                12 => '12/12'
                            ),
                            'name' => 'layout_columns_size_3',
                            'class' => 'layout_columns_size_3',
                            'default' => 6,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'type' => 'html_hard',
                            'html_code' => '<div class="row layout_container">'
                        ),
                            array(
                                'type' => 'html_hard',
                                'html_code' => '<div class="col-md-4">'
                            ),
                                array(
                                    'type' => 'table',
                                    'preffix_config' => 'layout',
                                    'class' => 'layout_config',
                                    'order_draggable' => true,
                                    'theads' => array(
                                        $this->language->get('layout_panel'),
                                        $this->language->get('layout_panel_status'),
                                        $this->language->get('layout_panel_size'),
                                        $this->language->get('layout_panel_position_column')
                                    ),
                                    'data' => $this->_get_layout_configuration(false)
                                ),
                            array(
                                'type' => 'html_hard',
                                'html_code' => '</div>'
                            ),
                            array(
                                'type' => 'html_hard',
                                'html_code' => '<div class="col-md-8">'
                            ),
                                array(
                                    'type' => 'html_hard',
                                    'html_code' => ($this->oc_version == 1 ? '<tr class="field_tr"><td colspan="2">' : '').'<div class="layout_preview_container">
                                        <div class="row">
                                            <div class="col_1 column_layout"></div>
                                            <div class="col_2 column_layout"></div>
                                            <div class="col_3 column_layout"></div>
                                        </div>
                                    </div>'.($this->oc_version == 1 ? '</tr></td>' : '')
                                ),
                            array(
                                'type' => 'html_hard',
                                'html_code' => '</div>'
                            ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => '</div>'
                        ),
                    ),
                ),
                $this->language->get('tab_layout_logged') => array(
                    'icon' => '<i class="fa fa-eye"></i>',
                    'fields' => array(
                        array(
                            'label' => $this->language->get('layout_columns'),
                            'type' => 'select',
                            'options' => array(
                                1 => 1,
                                2 => 2,
                                3 => 3,
                            ),
                            'name' => 'layout_logged_columns',
                            'class' => 'layout_logged_columns',
                            'default' => 3,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'label' => $this->language->get('layout_columns_size_1'),
                            'type' => 'select',
                            'options' => array(
                                3 => '3/12',
                                4 => '4/12',
                                6 => '6/12',
                                8 => '8/12',
                                12 => '12/12'
                            ),
                            'name' => 'layout_logged_columns_size_1',
                            'class' => 'layout_logged_columns_size_1',
                            'default' => 12,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'label' => $this->language->get('layout_columns_size_2'),
                            'type' => 'select',
                            'options' => array(
                                3 => '3/12',
                                4 => '4/12',
                                6 => '6/12',
                                8 => '8/12',
                                12 => '12/12'
                            ),
                            'name' => 'layout_logged_columns_size_2',
                            'class' => 'layout_logged_columns_size_2',
                            'default' => 6,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'label' => $this->language->get('layout_columns_size_3'),
                            'type' => 'select',
                            'options' => array(
                                3 => '3/12',
                                4 => '4/12',
                                6 => '6/12',
                                8 => '8/12',
                                12 => '12/12'
                            ),
                            'name' => 'layout_logged_columns_size_3',
                            'class' => 'layout_logged_columns_size_3',
                            'default' => 6,
                            'onchange' => 'layout_construct()'
                        ),

                        array(
                            'type' => 'html_hard',
                            'html_code' => '<div class="row layout_logged_container">'
                        ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => '<div class="col-md-4">'
                        ),
                        array(
                            'type' => 'table',
                            'preffix_config' => 'layout_logged',
                            'class' => 'layout_logged_config',
                            'order_draggable' => true,
                            'theads' => array(
                                $this->language->get('layout_panel'),
                                $this->language->get('layout_panel_status'),
                                $this->language->get('layout_panel_size'),
                                $this->language->get('layout_panel_position_column')
                            ),
                            'data' => $this->_get_layout_configuration(true)
                        ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => '</div>'
                        ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => '<div class="col-md-8">'
                        ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => ($this->oc_version == 1 ? '<tr class="field_tr"><td colspan="2">' : '').'<div class="layout_logged_preview_container">
                                        <div class="row">
                                            <div class="col_1 column_layout"></div>
                                            <div class="col_2 column_layout"></div>
                                            <div class="col_3 column_layout"></div>
                                        </div>
                                    </div>'.($this->oc_version == 1 ? '</tr></td>' : '')
                        ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => '</div>'
                        ),
                        array(
                            'type' => 'html_hard',
                            'html_code' => '</div>'
                        ),
                    ),
                ),
                $this->language->get('tab_style') => array(
                    'icon' => '<i class="fa fa-eyedropper"></i>',
                    'fields' => array(
                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_panel')
                        ),
                        array(
                            'label' => $this->language->get('style_panel_heading_background'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_heading_background',
                            'default' => 'f5f5f5'
                        ),
                        array(
                            'label' => $this->language->get('style_panel_heading_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_heading_font_color',
                            'default' => '666666'
                        ),
                        array(
                            'label' => $this->language->get('style_panel_heading_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_heading_border_color',
                            'default' => 'dddddd'
                        ),

                        array(
                            'label' => $this->language->get('style_panel_heading_background_error'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_heading_background_error',
                            'default' => 'a94442'
                        ),
                        array(
                            'label' => $this->language->get('style_panel_heading_font_color_error'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_heading_font_color_error',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_panel_heading_border_color_error'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_heading_border_color_error',
                            'default' => 'a94442'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_buttons_default')
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_default_background_top'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_default_background_top',
                            'default' => 'fbfbfb'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_default_background_bottom'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_default_background_bottom',
                            'default' => 'e6e7e7'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_default_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_default_font_color',
                            'default' => '7c7c7c'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_default_font_color_hover'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_default_font_color_hover',
                            'default' => '333333'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_default_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_default_border_color',
                            'default' => 'bababa'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_buttons_active')
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_active_background_top'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_active_background_top',
                            'default' => '23a0d0'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_active_background_bottom'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_active_background_bottom',
                            'default' => '1f90bb '
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_active_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_active_font_color',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_active_font_color_hover'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_active_font_color_hover',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_active_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_active_border_color',
                            'default' => '1f90bb'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_buttons_confirm_order')
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_confirm_order_background_top'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_confirm_order_background_top',
                            'default' => '23a0d0'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_confirm_order_background_bottom'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_confirm_order_background_bottom',
                            'default' => '1f90bb '
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_confirm_order_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_confirm_order_font_color',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_confirm_order_font_color_hover'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_confirm_order_font_color_hover',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_buttons_confirm_order_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_buttons_confirm_order_border_color',
                            'default' => '1f90bb'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_steps')
                        ),
                        array(
                            'label' => $this->language->get('lang_legend_steps_outborder_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_outborder_color',
                            'default' => 'e2e2e2'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_steps_default')
                        ),
                        array(
                            'label' => $this->language->get('style_steps_default_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_default_border_color',
                            'default' => 'D4D4D5'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_default_background_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_default_background_color',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_default_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_default_font_color',
                            'default' => '666666'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_default_number_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_default_number_color',
                            'default' => 'c4c4c4'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_steps_completed')
                        ),
                        array(
                            'label' => $this->language->get('style_steps_completed_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_completed_border_color',
                            'default' => 'D4D4D5'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_completed_background_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_completed_background_color',
                            'default' => '21BA45'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_completed_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_completed_font_color',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_completed_number_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_completed_number_color',
                            'default' => 'c4c4c4'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_steps_error')
                        ),
                        array(
                            'label' => $this->language->get('style_steps_error_border_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_error_border_color',
                            'default' => 'D4D4D5'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_error_background_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_error_background_color',
                            'default' => 'a94442'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_error_font_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_error_font_color',
                            'default' => 'ffffff'
                        ),
                        array(
                            'label' => $this->language->get('style_steps_error_number_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_steps_error_number_color',
                            'default' => 'c4c4c4'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_legend_discount_zone')
                        ),
                        array(
                            'label' => $this->language->get('style_discount_zone_icon_class'),
                            'help' => $this->language->get('style_discount_zone_icon_class_help'),
                            'columns' => 3,
                            'type' => 'text',
                            'name' => 'style_discount_zone_icon_class',
                            'default' => 'gift'
                        ),
                        array(
                            'label' => $this->language->get('style_discount_zone_icon_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_discount_zone_icon_color',
                            'default' => '9edfff'
                        ),
                        array(
                            'label' => $this->language->get('style_discount_zone_background'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_discount_zone_background',
                            'default' => 'c3f6ff'
                        ),

                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_style_panel_confirm')
                        ),
                        array(
                            'label' => $this->language->get('style_panel_confirm_outborder_color'),
                            'columns' => 3,
                            'type' => 'colpick',
                            'name' => 'style_panel_confirm_outborder_color',
                            'default' => 'c2e4ff'
                        ),
                        array(
                            'label' => $this->language->get('style_panel_confirm_buttons_selectors'),
                            'help' => $this->language->get('style_panel_confirm_buttons_selectors_help'),
                            'type' => 'text',
                            'columns' => 3,
                            'name' => 'style_panel_confirm_buttons_selectors'
                        ),
                    )
                ),
                $this->language->get('tab_custom') => array(
                    'icon' => '<i class="fa fa-flask"></i>',
                    'fields' => array(
                        array(
                            'type' => 'legend',
                            'text' => $this->language->get('lang_custom_legend')
                        ),
                        array(
                            'label' => $this->language->get('custom_code'),
                            'type' => 'textarea',
                            'name' => 'custom_code',
                            'style' => 'height:400px;'
                        ),
                    )
                ),
            )
        );

        $form_view = $this->model_extension_devmanextensions_tools->_get_form_values($form_view);
        return $form_view;
    }

    public function _send_custom_variables_to_view()
    {
        $this->data_to_view['jquery_variables'] = array(
            'token' => $this->token,
            'token_name' => $this->token_name,
            'link_ajax_get_form' => htmlspecialchars_decode($this->url->link($this->real_extension_type.'/'.$this->extension_name.'&ajax_function=ajax_get_form', $this->token_name.'=' . $this->session->data[$this->token_name], 'SSL')),
            'link_ajax_open_ticket' => htmlspecialchars_decode($this->url->link($this->real_extension_type.'/'.$this->extension_name.'&ajax_function=ajax_open_ticket', $this->token_name.'=' . $this->session->data[$this->token_name], 'SSL')),
            'text_image_manager' => $this->language->get('text_image_manager')
        );
    }

    public function ajax_get_form($license_id = '')
    {
        $this->model_extension_devmanextensions_tools->ajax_get_form($license_id);
    }

    public function ajax_open_ticket()
    {
        $data = $this->request->post;
        $data['domain'] = HTTP_CATALOG;
        $data['license_id'] = $this->config->get($this->extension_group_config.'_license_id');
        $result = $this->model_extension_devmanextensions_tools->curl_call($data, $this->api_url.'opencart/ajax_open_ticket');

        //from API are in json_encode
        echo $result; die;
    }

    public function _get_layout_configuration($logged = false)
    {
        $config_name = 'poc_layout'.($logged ? '_logged' : '');
        $previus_config = $this->config->get($config_name);
        
        if(!empty($previus_config))
        {
            $panels = array();
            foreach ($previus_config as $panel_name => $value) {
                array_push($panels, $panel_name);
            }
        }
        else
            $panels = array('identification', 'addresses', 'shipping', 'payment', 'cart', 'confirm');

        $return_conf = array();
        $can_disable = array('identification', 'cart');

        foreach ($panels as $key => $panel) {
            $default_column = 1;

            switch ($panel)
            {
                case 'identification':
                    $default_column = 1;
                    break;
                case 'addresses':
                    $default_column = !$logged ? 2 : 1;
                    break;
                case 'addresses':
                    $default_column = !$logged ? 2 : 1;
                    break;
                case 'cart':
                    $default_column = !$logged ? 3 : 2;
                    break;
                default:
                    $default_column = 3;
                    break;
            }

            $temp = array(
                array(
                    'type' => 'html_hard',
                    'html_code' => $this->language->get('layout_panel_'.$panel).'<input name="panel_name" type="hidden" value="'.$panel.'"><input name="panel_title" type="hidden" value="'.$this->language->get('layout_panel_'.$panel).'">'
                ),
                array(
                    'type' => 'boolean',
                    'name' => '['.$panel.'][status]',
                    'default' => $logged && $panel == 'identification' ? false : true,
                    'onchange' => 'layout_construct()'
                ),
                array(
                    'type' => 'select',
                    'options' => array(
                        3 => '3/12',
                        4 => '4/12',
                        6 => '6/12',
                        8 => '8/12',
                        12 => '12/12'
                    ),
                    'name' => '['.$panel.'][cols]',
                    'default' => 12,
                    'onchange' => 'layout_construct()'
                ),
                array(
                    'type' => 'select',
                    'options' => array(
                        1 => 1,
                        2 => 2,
                        3 => 3,
                    ),
                    'name' => '['.$panel.'][col_position]',
                    'class' => 'layout_cols_position',
                    'default' => $default_column,
                    'onchange' => 'layout_construct()'
                ),
            );

            if(!in_array($panel, $can_disable))
            {
                $temp[1]['disabled'] = 'disabled';
                $temp[1]['value'] = 1;
            }
            
            $return_conf[] = $temp;
        }

        return $return_conf;
    }
    public function install()
    {
        return true;
    }

    public function _test_before_save()
    {
        return false;
    }
}
?>