public function __construct() { global $cookie; $this->table = 'tax'; $this->className = 'Tax'; $this->lang = true; $this->edit = true; $this->delete = true; $this->fieldsDisplay = array('id_tax' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Name'), 'width' => 140), 'rate' => array('title' => $this->l('Rate'), 'align' => 'center', 'suffix' => '%', 'width' => 50), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)); $this->optionTitle = $this->l('Tax options'); $this->_fieldsOptions = array('PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'), 'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')); if (Configuration::get('PS_USE_ECOTAX')) { $this->_fieldsOptions['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g., French ecotax: 19.6%).'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions()); } parent::__construct(); }
public function __construct() { $this->table = 'tax'; $this->className = 'Tax'; $this->lang = true; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')), 'enableSelection' => array('text' => $this->l('Enable selection')), 'disableSelection' => array('text' => $this->l('Disable selection'))); $this->fields_list = array('id_tax' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Name'), 'width' => 'auto'), 'rate' => array('title' => $this->l('Rate'), 'align' => 'center', 'suffix' => '%', 'width' => 50), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)); $ecotax_desc = ''; if (Configuration::get('PS_USE_ECOTAX')) { $ecotax_desc = $this->l('If you disable the ecotax, the ecotax for all your products will be set to 0'); } $this->fields_options = array('general' => array('title' => $this->l('Tax options'), 'fields' => array('PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'), 'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array())); if (Configuration::get('PS_USE_ECOTAX')) { $this->fields_options['general']['fields']['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g. French ecotax: 19.6%).'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions()); } parent::__construct(); }
public function __construct() { $this->bootstrap = true; $this->table = 'tax'; $this->className = 'Tax'; $this->lang = true; $this->addRowAction('edit'); $this->addRowAction('delete'); parent::__construct(); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash')); $this->fields_list = array('id_tax' => array('title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->trans('Name', array(), 'Admin.Global'), 'width' => 'auto'), 'rate' => array('title' => $this->l('Rate'), 'align' => 'center', 'suffix' => '%', 'class' => 'fixed-width-md'), 'active' => array('title' => $this->trans('Enabled', array(), 'Admin.Global'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'class' => 'fixed-width-sm', 'remove_onclick' => true)); $ecotax_desc = ''; if (Configuration::get('PS_USE_ECOTAX')) { $ecotax_desc = $this->l('If you disable the ecotax, the ecotax for all your products will be set to 0.'); } $this->fields_options = array('general' => array('title' => $this->l('Tax options'), 'fields' => array('PS_TAX' => array('title' => $this->l('Enable tax'), 'desc' => $this->l('Select whether or not to include tax on purchases.'), 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in the shopping cart'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart.'), 'cast' => 'intval', 'type' => 'bool'), 'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Based on'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'), 'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions')))); if (Configuration::get('PS_USE_ECOTAX') || Tools::getValue('PS_USE_ECOTAX')) { $this->fields_options['general']['fields']['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax'), 'hint' => $this->l('Define the ecotax (e.g. French ecotax: 19.6%).'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions()); } $this->_where .= ' AND a.deleted = 0'; }
protected function displayAdminConfigurationForm($configData) { $default_lang = (int) Configuration::get('PS_LANG_DEFAULT'); $fields_form = array(); $fields_form[0] = array(); $fields_form[0]['form'] = array('legend' => array('title' => $this->l('admin_configuration_invipay_account')), 'input' => $this->getAdministractionConfigurationMetaData('form', array(0))); $fields_form[1] = array(); $fields_form[1]['form'] = array('legend' => array('title' => $this->l('admin_configuration_invipay_presta')), 'input' => $this->getAdministractionConfigurationMetaData('form', array(1))); $fields_form[2] = array(); $fields_form[2]['form'] = array('legend' => array('title' => $this->l('admin_configuration_invipay_payment_cost')), 'input' => $this->getAdministractionConfigurationMetaData('form', array(2))); $fields_form[3] = array(); $fields_form[3]['form'] = array('legend' => array('title' => $this->l('admin_configuration_invipay_promo')), 'input' => $this->getAdministractionConfigurationMetaData('form', array(3)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); $fields_form[2]['form']['input']['PAYMENT_METHOD_COST_TAX_RULE']['options']['query'] = TaxRulesGroup::getTaxRulesGroupsForOptions(); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; $helper->title = $this->displayName; $helper->show_toolbar = true; $helper->toolbar_scroll = true; $helper->submit_action = 'submit' . $this->name; $helper->toolbar_btn = array('save' => array('desc' => $this->l('Save'), 'href' => AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules')), 'back' => array('href' => AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list'))); $helper->fields_value = $configData; return $helper->generateForm($fields_form); }