本文整理汇总了PHP中Tax::getTaxes方法的典型用法代码示例。如果您正苦于以下问题:PHP Tax::getTaxes方法的具体用法?PHP Tax::getTaxes怎么用?PHP Tax::getTaxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tax
的用法示例。
在下文中一共展示了Tax::getTaxes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
global $cookie;
$this->className = 'Configuration';
$this->table = 'configuration';
$max_upload = (int) ini_get('upload_max_filesize');
$max_post = (int) ini_get('post_max_size');
$upload_mb = min($max_upload, $max_post);
$timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM ' . _DB_PREFIX_ . 'timezone');
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
foreach (Tax::getTaxes((int) $cookie->id_lang) as $tax) {
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
}
$order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout')));
$round_mode = array(array('value' => PS_ROUND_UP, 'name' => $this->l('superior')), array('value' => PS_ROUND_DOWN, 'name' => $this->l('inferior')), array('value' => PS_ROUND_HALF, 'name' => $this->l('classical')));
$cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
foreach (CMS::listCms($cookie->id_lang) as $cms_file) {
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
}
$this->_fieldsGeneral = array('PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'maintenance_ip', 'size' => 30, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use of CMS page'), 'desc' => $this->l('Choose the Conditions of use of CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrap pricing'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Maximum attachment size'), 'desc' => $this->l('Set the maximum size of attached files (in Megabytes ).') . ' ' . $this->l('Maximum:') . ' ' . ((int) str_replace('M', '', ini_get('post_max_size')) > (int) str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '2'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Save cart content and re-display it at login'), 'desc' => $this->l('Recall and display contents of shopping cart following customer login'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), 'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_FORCE_SMARTY_2' => array('title' => $this->l('Use Smarty 2 instead of 3'), 'desc' => $this->l('Enable if your theme is incompatible with Smarty 3 (you should update your theme, since Smarty 2 will be unsupported from PrestaShop v1.5)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_LIMIT_UPLOAD_FILE_VALUE' => array('title' => $this->l('Limit upload file value'), 'desc' => $this->l('Define the limit upload for a downloadable product, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1'), 'PS_LIMIT_UPLOAD_IMAGE_VALUE' => array('title' => $this->l('Limit upload image value'), 'desc' => $this->l('Define the limit upload for an image, this value has to be inferior or equal to your server\'s maximum upload file ') . sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'limit', 'default' => '1'));
if (function_exists('date_default_timezone_set')) {
$this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name');
}
// No HTTPS activation if you haven't already.
if (!Tools::usingSecureMode() && !_PS_SSL_ENABLED_) {
$this->_fieldsGeneral['PS_SSL_ENABLED']['type'] = 'disabled';
$this->_fieldsGeneral['PS_SSL_ENABLED']['disabled'] = '<a href="https://' . Tools::getShopDomainSsl() . Tools::safeOutput($_SERVER['REQUEST_URI']) . '">' . $this->l('Please click here to use HTTPS protocol before enabling SSL.') . '</a>';
}
parent::__construct();
}
示例2: initRuleForm
public function initRuleForm()
{
$this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('New tax rule'), 'icon' => 'icon-money'), 'input' => array(array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'country', 'id' => 'country', 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('All')))), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'states[]', 'id' => 'states', 'multiple' => true, 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('All')))), array('type' => 'hidden', 'name' => 'action'), array('type' => 'text', 'label' => $this->l('Zip/postal code range'), 'name' => 'zipcode', 'required' => false, 'hint' => $this->l('You can define a range of Zip/postal codes (e.g., 75000-75015) or simply use one Zip/postal code.')), array('type' => 'select', 'label' => $this->l('Behavior'), 'name' => 'behavior', 'required' => false, 'options' => array('query' => array(array('id' => 0, 'name' => $this->l('This tax only')), array('id' => 1, 'name' => $this->l('Combine')), array('id' => 2, 'name' => $this->l('One after another'))), 'id' => 'id', 'name' => 'name'), 'hint' => array($this->l('You must define the behavior if an address matches multiple rules:') . '<br>', $this->l('- This tax only: Will apply only this tax') . '<br>', $this->l('- Combine: Combine taxes (e.g.: 10% + 5% = 15%)') . '<br>', $this->l('- One after another: Apply taxes one after another (e.g.: 0 + 10% = 0 + 5% = 5.5)'))), array('type' => 'select', 'label' => $this->l('Tax'), 'name' => 'id_tax', 'required' => false, 'options' => array('query' => Tax::getTaxes((int) $this->context->language->id), 'id' => 'id_tax', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('No Tax'))), 'hint' => sprintf($this->l('(Total tax: %s)'), '9%')), array('type' => 'select', 'label' => $this->l('Grupos'), 'name' => 'id_group', 'required' => false, 'options' => array('query' => Group::getGroups($this->default_form_language, true), 'id' => 'id_group', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('Default'))), 'hint' => sprintf($this->l('(Total tax: %s)'), '9%')), array('type' => 'text', 'label' => $this->l('Description'), 'name' => 'description')), 'submit' => array('title' => $this->l('Save and stay'), 'stay' => true));
if (!($obj = $this->loadObject(true))) {
return;
}
$this->fields_value = array('action' => 'create_rule', 'id_tax_rules_group' => $obj->id, 'id_tax_rule' => '');
$this->getlanguages();
$helper = new HelperForm();
$helper->override_folder = $this->tpl_folder;
$helper->currentIndex = self::$currentIndex;
$helper->token = $this->token;
$helper->table = 'tax_rule';
$helper->identifier = 'id_tax_rule';
$helper->id = $obj->id;
$helper->toolbar_scroll = true;
$helper->show_toolbar = true;
$helper->languages = $this->_languages;
$helper->default_form_language = $this->default_form_language;
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
$helper->fields_value = $this->getFieldsValue($this->object);
$helper->toolbar_btn['save_new_rule'] = array('href' => self::$currentIndex . '&id_tax_rules_group=' . $obj->id . '&action=create_rule&token=' . $this->token, 'desc' => 'Save tax rule', 'class' => 'process-icon-save');
$helper->submit_action = 'create_rule';
return $helper->generateForm($this->fields_form);
}
示例3: getTax
public function getTax($request)
{
if ($this->checkDetails($request)) {
$object = new Tax();
$array = $object->getTaxes($request["restaurantID"]);
return $array;
}
}
示例4: testGetAllTaxes
public function testGetAllTaxes()
{
$allTaxesCount = Tax::getTaxes()->getTotalRecordCount();
$taxEnabled = Tax::getNewInstance('testing');
$taxEnabled->save();
$taxDisabled = Tax::getNewInstance('testing');
$taxDisabled->save();
$this->assertEqual(Tax::getTaxes()->getTotalRecordCount(), $allTaxesCount + 2);
}
示例5: __construct
public function __construct()
{
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
// List of CMS tabs
$cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
foreach (CMS::listCms($this->context->language->id) as $cms_file) {
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
}
// List of order process types
$order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout')));
// Tax list
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
foreach (Tax::getTaxes($this->context->language->id) as $tax) {
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
}
$this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'tab-preferences', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Guests can place an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate order'), 'desc' => $this->l('Set to 0 to disable this feature'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multi-shipping'), 'desc' => $this->l('Allow the customer to ship his order to multiple addresses. This option will convert the customer\'s cart into one or more orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->l('Delayed shipping'), 'desc' => $this->l('Allow the customer to split his order: one with the products currently "in stock", and another with the other products. This option will convert the customer\'s cart into two orders.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'tab-preferences', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')));
}
示例6: convert_product_price
function convert_product_price()
{
$taxes = Tax::getTaxes();
$taxRates = array();
foreach ($taxes as $data) {
$taxRates[$data['id_tax']] = (double) $data['rate'] / 100;
}
$resource = DB::getInstance()->ExecuteS('SELECT `id_product`, `price`, `id_tax` FROM `' . _DB_PREFIX_ . 'product`', false);
while ($row = DB::getInstance()->nextRow($resource)) {
if ($row['id_tax']) {
$price = $row['price'] * (1 + $taxRates[$row['id_tax']]);
$decimalPart = $price - (int) $price;
if ($decimalPart < 1.0E-6) {
$newPrice = (double) number_format($price, 6, '.', '');
$newPrice = Tools::floorf($newPrice / (1 + $taxRates[$row['id_tax']]), 6);
DB::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'product` SET `price` = ' . $newPrice . ' WHERE `id_product` = ' . (int) $row['id_product']);
}
}
}
}
示例7: __construct
public function __construct()
{
global $cookie;
$this->className = 'Configuration';
$this->table = 'configuration';
$tmz = Tools::getTimezones();
$txs = Tax::getTaxes(intval($cookie->id_lang));
$timezone = array();
foreach ($tmz as $id => $name) {
$timezone[] = array('id' => $id, 'name' => $name);
}
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
foreach ($txs as $tax) {
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
}
$this->_fieldsGeneral = array('PS_BASE_URI' => array('title' => $this->l('PS directory:'), 'desc' => $this->l('Name of the PrestaShop directory on your Web server, bracketed by forward slashes (e.g., /shop/)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 20, 'default' => '/'), 'PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop:'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP:'), 'desc' => $this->l('IP address allowed to access the Front Office while the shop is disabled (e.g., 42.24.4.2)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 15, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL:'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)') . '<p class="hint clear" style="display: block;">' . $this->l('If you turn on this feature, you must') . ' <a href="?tab=AdminGenerator&token=' . Tools::getAdminToken('AdminGenerator' . intval(Tab::getIdFromClassName('AdminGenerator')) . intval($cookie->id_employee)) . '">' . $this->l('generate a .htaccess file') . '</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes:'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service:'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping:'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price:'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax:'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging:'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Cart re-display at login:'), 'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'));
if (function_exists('date_default_timezone_set')) {
$this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Timezone:'), 'validation' => 'isUnsignedId', 'cast' => 'intval', 'type' => 'select', 'list' => $timezone, 'identifier' => 'id');
}
parent::__construct();
}
示例8: __construct
public function __construct()
{
global $cookie;
$this->className = 'Configuration';
$this->table = 'configuration';
$timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT name FROM ' . _DB_PREFIX_ . 'timezone');
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
foreach (Tax::getTaxes((int) $cookie->id_lang) as $tax) {
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
}
$order_process_type = array(array('value' => PS_ORDER_PROCESS_STANDARD, 'name' => $this->l('Standard (5 steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One page checkout')));
$round_mode = array(array('value' => PS_ROUND_UP, 'name' => $this->l('superior')), array('value' => PS_ROUND_DOWN, 'name' => $this->l('inferior')), array('value' => PS_ROUND_HALF, 'name' => $this->l('classical')));
$cms_tab = array(0 => array('id' => 0, 'name' => $this->l('None')));
foreach (CMS::listCms($cookie->id_lang) as $cms_file) {
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
}
$this->_fieldsGeneral = array('PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it. Please note that the webservice will not be disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use a comma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 15, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_COOKIE_CHECKIP' => array('title' => $this->l('Check IP on the cookie'), 'desc' => $this->l('Check the IP address of the cookie in order to avoid your cookie being stolen'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_ATTACHMENT_MAXIMUM_SIZE' => array('title' => $this->l('Attachment maximum size'), 'desc' => $this->l('Set the maximum size of attachment files (in MegaBytes)'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Cart re-display at login'), 'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PRICE_ROUND_MODE' => array('title' => $this->l('Round mode'), 'desc' => $this->l('You can choose how to round prices: always round superior; always round inferior, or classic rounding'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $round_mode, 'identifier' => 'value'), 'PRESTASTORE_LIVE' => array('title' => $this->l('Automatically check for module updates'), 'desc' => $this->l('New modules and updates are displayed on the modules page'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HIDE_OPTIMIZATION_TIPS' => array('title' => $this->l('Hide optimization tips'), 'desc' => $this->l('Hide optimization tips on the back office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISPLAY_SUPPLIERS' => array('title' => $this->l('Display suppliers and manufacturers'), 'desc' => $this->l('Display manufacturers and suppliers list even if corresponding blocks are disabled'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_FORCE_SMARTY_2' => array('title' => $this->l('Use Smarty 2 instead of 3'), 'desc' => $this->l('Enable if your theme is incompatible with Smarty 3 (you should update your theme, since Smarty 2 will be unsupported from PrestaShop v1.5)'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'));
if (function_exists('date_default_timezone_set')) {
$this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Time Zone:'), 'validation' => 'isAnything', 'type' => 'select', 'list' => $timezones, 'identifier' => 'name');
}
parent::__construct();
}
示例9: getAllTax
public function getAllTax()
{
$all_tax = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `id_tax_eco`, `rate`
FROM `' . _DB_PREFIX_ . 'ec_ecopresto_tax`');
$response = '';
$tax_PS = Tax::getTaxes(self::getInfoEco('ID_LANG'));
foreach ($all_tax as $tax) {
$tax_eco = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT id_tax_rules_group FROM `' . _DB_PREFIX_ . 'ec_ecopresto_tax_shop` WHERE `id_tax_eco`=' . (int) $tax['id_tax_eco'] . ' AND `id_shop`=' . (int) self::getInfoEco('ID_SHOP'));
$response .= '<p>Tax EcoPresto :' . $tax['rate'] . ' =>';
$response .= ' <select name="tax_ps[]">
<option value="' . $tax['id_tax_eco'] . '_0"> 0 </option>';
foreach ($tax_PS as $taxPS) {
$response .= '<option value="' . $tax['id_tax_eco'] . '_' . $taxPS['id_tax'] . '" ' . ($tax_eco == $taxPS['id_tax'] ? 'selected="selected"' : '') . '>' . $taxPS['rate'] . '</option>';
}
$response .= '</select>';
}
return $response;
}
示例10: displayForm
public function displayForm()
{
global $currentIndex, $cookie;
$obj = $this->loadObject(true);
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$currentLanguage = intval($cookie->id_lang);
$languages = Language::getLanguages();
echo '
<script type="text/javascript">
id_language = Number(' . $defaultLanguage . ');
</script>
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data">
' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
<fieldset class="width3"><legend><img src="../img/admin/delivery.gif" />' . $this->l('Carriers') . '</legend>
<label>' . $this->l('Company:') . ' </label>
<div class="margin-form">
<input type="text" size="25" name="name" value="' . htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
<span class="hint" name="help_box">' . $this->l('Allowed characters: letters, spaces and') . ' ().-<span class="hint-pointer"> </span></span>
<p class="clear">' . $this->l('Carrier name displayed during checkout') . '<br />' . $this->l('With a value of 0, the carrier name will be replaced by the shop name') . '</p>
</div>
<label>' . $this->l('Logo:') . ' </label>
<div class="margin-form">
<input type="file" name="logo" />
<p>' . $this->l('Upload logo from your computer') . ' (.gif, .jpg, .jpeg ' . $this->l('or') . ' .png)</p>
</div>
<label>' . $this->l('Transit time:') . ' </label>
<div class="margin-form">';
foreach ($languages as $language) {
echo '
<div id="delay_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" size="41" maxlength="128" name="delay_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'delay', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
</div>';
}
$this->displayFlags($languages, $defaultLanguage, 'delay', 'delay');
echo '
<p style="clear: both">' . $this->l('Time taken for product delivery; displayed during checkout') . '</p>
</div>
<label>' . $this->l('URL:') . ' </label>
<div class="margin-form">
<input type="text" size="40" name="url" value="' . htmlentities($this->getFieldValue($obj, 'url'), ENT_COMPAT, 'UTF-8') . '" />
<p class="clear">' . $this->l('URL for the tracking number; type \'@\' where the tracking number will appear') . '</p>
</div>
<label>' . $this->l('Tax:') . '</label>
<div class="margin-form">
<select name="id_tax">
<option value="0"' . (($obj->id and $obj->id_tax == 0) ? ' selected="selected"' : '') . '>' . $this->l('No tax') . '</option>';
$tvaList = Tax::getTaxes($currentLanguage);
foreach ($tvaList as $line) {
echo '<option value="' . $line['id_tax'] . '"' . (($obj->id and $obj->id_tax == $line['id_tax']) ? ' selected="selected"' : '') . '>' . $line['name'] . '</option>';
}
echo '</select>
<p>' . $this->l('Include tax on carrier, e.g., VAT') . '</p>
</div>
<label>' . $this->l('Zone:') . '</label>
<div class="margin-form">';
$carrier_zones = $obj->getZones();
$zones = Zone::getZones(true);
foreach ($zones as $zone) {
echo '<input type="checkbox" id="zone_' . $zone['id_zone'] . '" name="zone_' . $zone['id_zone'] . '" value="true" ' . (Tools::getValue('zone_' . $zone['id_zone'], is_array($carrier_zones) and in_array(array('id_carrier' => $obj->id, 'id_zone' => $zone['id_zone']), $carrier_zones)) ? ' checked="checked"' : '') . '><label class="t" for="zone_' . $zone['id_zone'] . '"> <b>' . $zone['name'] . '</b></label><br />';
}
echo '<p>' . $this->l('The zone in which this carrier is to be used') . '</p>
</div>
<label>' . $this->l('Group access:') . '</label>
<div class="margin-form">';
$groups = Group::getGroups(intval($cookie->id_lang));
if (sizeof($groups)) {
echo '
<table cellspacing="0" cellpadding="0" class="table" style="width: 28em;">
<tr>
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'groupBox[]\', this.checked)"' . (!isset($obj->id) ? 'checked="checked" ' : '') . ' /></th>
<th>' . $this->l('ID') . '</th>
<th>' . $this->l('Group name') . '</th>
</tr>';
$irow = 0;
foreach ($groups as $group) {
echo '
<tr class="' . ($irow++ % 2 ? 'alt_row' : '') . '">
<td><input type="checkbox" name="groupBox[]" class="groupBox" id="groupBox_' . $group['id_group'] . '" value="' . $group['id_group'] . '" ' . ((Db::getInstance()->getValue('SELECT id_group FROM ' . _DB_PREFIX_ . 'carrier_group WHERE id_carrier=' . intval($obj->id) . ' AND id_group=' . intval($group['id_group'])) or !isset($obj->id)) ? 'checked="checked" ' : '') . '/></td>
<td>' . $group['id_group'] . '</td>
<td><label for="groupBox_' . $group['id_group'] . '" class="t">' . $group['name'] . '</label></td>
</tr>';
}
echo '
</table>
<p style="padding:0px; margin:10px 0px 10px 0px;">' . $this->l('Mark all groups you want to give access to this carrier') . '</p>
';
} else {
echo '<p>' . $this->l('No group created') . '</p>';
}
echo ' </div>
<label>' . $this->l('Status:') . ' </label>
<div class="margin-form">
<input type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
<input type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
<p>' . $this->l('Include or exclude carrier from list of carriers on Front Office') . '</p>
</div>
<label>' . $this->l('Shipping & handling:') . ' </label>
<div class="margin-form">
//.........这里部分代码省略.........
示例11: getAvailableTaxesDetails
private function getAvailableTaxesDetails()
{
$all_taxes = Tax::getTaxes();
$return_array = array();
foreach ($all_taxes as $tax) {
$tax_obj = new Tax((int) $tax['id_tax']);
$return_array[(int) $tax['id_tax']] = (string) $tax_obj->name[1];
unset($tax_obj);
}
return $return_array;
}
示例12: array
function _getFees($conditions)
{
if (empty($conditions)) {
return;
}
$this->FeeSlab->bindModel(array('belongsTo' => array('FrequencyType' => array('className' => 'FrequencyType', 'foreignKey' => '', 'conditions' => 'FeeSlab.frequency_id = FrequencyType.frequency_id', 'fields' => '', 'order' => ''))));
$resFeeSlabs = $this->FeeSlab->find('all', array('conditions' => $conditions));
App::import('Model', 'Tax');
$objTax = new Tax();
$resultTax = $objTax->getTaxes();
$feeSlabs = array();
$x = array();
foreach ($resFeeSlabs as $k => $v) {
if (!empty($v['FeeSlab']['entrance_fee'])) {
$x['entrance_fee'] = $this->_getTaxOnAmt($resultTax, $v['FeeSlab']['entrance_fee']);
}
if (!empty($v['FeeSlab']['application_fee'])) {
$x['application_fee'] = $this->_getTaxOnAmt($resultTax, $v['FeeSlab']['application_fee']);
}
$feeSlabs[] = $x;
}
return $feeSlabs;
}
示例13: generateTaxData
protected function generateTaxData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/taxes.vsc', 'w');
foreach ($this->tax_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$taxes = Tax::getTaxes();
if ($taxes) {
foreach ($taxes as $tax) {
$t = new Tax($tax['id_tax'], $this->use_lang);
foreach ($this->tax_fields as $field => $array) {
$line[$field] = property_exists('Tax', $field) && !is_array($t->{$field}) && !Tools::isEmpty($t->{$field}) ? $t->{$field} : '';
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
fclose($f);
}
示例14: initRuleForm
public function initRuleForm()
{
$this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('New tax rule'), 'image' => '../img/admin/dollar.gif'), 'input' => array(array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'country[]', 'id' => 'country', 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('All')))), array('type' => 'select', 'label' => $this->l('State:'), 'name' => 'states[]', 'id' => 'states', 'multiple' => true, 'size' => 5, 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name', 'default' => array('value' => 0, 'label' => $this->l('All')))), array('type' => 'hidden', 'name' => 'action'), array('type' => 'hidden', 'name' => 'id_tax_rules_group'), array('type' => 'text', 'label' => $this->l('Zip Code range:'), 'name' => 'zipcode', 'required' => false, 'hint' => $this->l('You can define a range (eg: 75000-75015) or a simple zipcode')), array('type' => 'select', 'label' => $this->l('Behavior:'), 'name' => 'behavior', 'required' => false, 'options' => array('query' => array(array('id' => 0, 'name' => $this->l('This tax only')), array('id' => 1, 'name' => $this->l('Combine')), array('id' => 2, 'name' => $this->l('One After Another'))), 'id' => 'id', 'name' => 'name'), 'hint' => $this->l('Define the behavior if an address matches multiple rules:') . '<br />
<b>' . $this->l('This Tax Only:') . '</b> ' . $this->l('Will apply only this tax') . '<br />
<b>' . $this->l('Combine:') . '</b> ' . $this->l('Combine taxes (eg: 10% + 5% => 15%)') . '<br />
<b>' . $this->l('One After Another:') . '</b> ' . $this->l('Apply taxes one after another (eg: 100€ + 10% => 110€ + 5% => 115.5€)')), array('type' => 'select', 'label' => $this->l('Tax:'), 'name' => 'id_tax', 'required' => false, 'options' => array('query' => Tax::getTaxes((int) $this->context->language->id), 'id' => 'id_tax', 'name' => 'name', 'default' => array('value' => 'name', 'label' => $this->l('No Tax'))), 'desc' => sprintf($this->l('(Total tax: %s)'), '9%')), array('type' => 'text', 'label' => $this->l('Description:'), 'name' => 'description', 'size' => 40)), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
if (!($obj = $this->loadObject(true))) {
return;
}
$this->fields_value = array('action' => 'create_rule', 'id_tax_rules_group' => $obj->id, 'id_tax_rule' => '');
$this->getlanguages();
$helper = new HelperForm();
$helper->override_folder = $this->tpl_folder;
$helper->currentIndex = self::$currentIndex;
$helper->token = $this->token;
$helper->table = 'tax_rule';
$helper->identifier = 'id_tax_rule';
$helper->id = $obj->id;
$helper->toolbar_scroll = true;
$helper->show_toolbar = false;
$helper->languages = $this->_languages;
$helper->default_form_language = $this->default_form_language;
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
$helper->fields_value = $this->getFieldsValue($this->object);
$helper->toolbar_btn = null;
$helper->submit_action = 'create_rule';
return $helper->generateForm($this->fields_form);
}
示例15: renderTaxesSelect
public function renderTaxesSelect($id_lang, $default_value, $html_options)
{
$opt = '';
foreach (array('id', 'class', 'name', 'disabled') as $prop) {
if (array_key_exists($prop, $html_options) && !empty($html_options[$prop])) {
$opt .= $prop . '="' . $html_options[$prop] . '"';
}
}
$html = '<select ' . $opt . '>
<option value="0">' . $this->l('No Tax') . '</option>';
$taxes = Tax::getTaxes((int) $id_lang, true);
foreach ($taxes as $tax) {
$selected = $default_value == $tax['id_tax'] ? 'selected="selected"' : '';
$html .= '<option value="' . (int) $tax['id_tax'] . '" ' . $selected . '>' . Tools::htmlentitiesUTF8($tax['name']) . '</option>';
}
$html .= '</select>';
return $html;
}