本文整理汇总了PHP中TaxRulesGroup::getTaxRulesGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP TaxRulesGroup::getTaxRulesGroups方法的具体用法?PHP TaxRulesGroup::getTaxRulesGroups怎么用?PHP TaxRulesGroup::getTaxRulesGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaxRulesGroup
的用法示例。
在下文中一共展示了TaxRulesGroup::getTaxRulesGroups方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
$this->fields_form = array('legend' => array('title' => $this->l('Carriers'), 'icon' => 'icon-truck'), 'input' => array(array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'name', 'required' => true, 'hint' => array(sprintf($this->l('Allowed characters: letters, spaces and %s'), '().-'), $this->l('Carrier name displayed during checkout'), $this->l('For in-store pickup, enter 0 to replace the carrier name with your shop name.'))), array('type' => 'file', 'label' => $this->l('Logo'), 'name' => 'logo', 'hint' => $this->l('Upload a logo from your computer.') . ' (.gif, .jpg, .jpeg ' . $this->l('or') . ' .png)'), array('type' => 'text', 'label' => $this->l('Transit time'), 'name' => 'delay', 'lang' => true, 'required' => true, 'maxlength' => 128, 'hint' => $this->l('Estimated delivery time will be displayed during checkout.')), array('type' => 'text', 'label' => $this->l('Speed grade'), 'name' => 'grade', 'required' => false, 'hint' => $this->l('Enter "0" for a longest shipping delay, or "9" for the shortest shipping delay.')), array('type' => 'text', 'label' => $this->l('URL'), 'name' => 'url', 'hint' => $this->l('Delivery tracking URL: Type \'@\' where the tracking number should appear. It will then be automatically replaced by the tracking number.')), array('type' => 'checkbox', 'label' => $this->l('Zone'), 'name' => 'zone', 'values' => array('query' => Zone::getZones(false), 'id' => 'id_zone', 'name' => 'name'), 'hint' => $this->l('The zones in which this carrier will be used.')), array('type' => 'group', 'label' => $this->l('Group access'), 'name' => 'groupBox', 'values' => Group::getGroups(Context::getContext()->language->id), 'hint' => $this->l('Mark the groups that are allowed access to this carrier.')), array('type' => 'switch', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'hint' => $this->l('Enable the carrier in the Front Office.')), array('type' => 'switch', 'label' => $this->l('Apply shipping cost'), 'name' => 'is_free', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'is_free_on', 'value' => 0, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />'), array('id' => 'is_free_off', 'value' => 1, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />')), 'hint' => $this->l('Apply both regular shipping cost and product-specific shipping costs.')), array('type' => 'select', 'label' => $this->l('Tax'), 'name' => 'id_tax_rules_group', 'options' => array('query' => TaxRulesGroup::getTaxRulesGroups(true), 'id' => 'id_tax_rules_group', 'name' => 'name', 'default' => array('label' => $this->l('No Tax'), 'value' => 0))), array('type' => 'switch', 'label' => $this->l('Shipping and handling'), 'name' => 'shipping_handling', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'shipping_handling_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'shipping_handling_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'hint' => $this->l('Include the shipping and handling costs in the carrier price.')), array('type' => 'radio', 'label' => $this->l('Billing'), 'name' => 'shipping_method', 'required' => false, 'class' => 't', 'br' => true, 'values' => array(array('id' => 'billing_default', 'value' => Carrier::SHIPPING_METHOD_DEFAULT, 'label' => $this->l('Default behavior')), array('id' => 'billing_price', 'value' => Carrier::SHIPPING_METHOD_PRICE, 'label' => $this->l('According to total price')), array('id' => 'billing_weight', 'value' => Carrier::SHIPPING_METHOD_WEIGHT, 'label' => $this->l('According to total weight')))), array('type' => 'select', 'label' => $this->l('Out-of-range behavior'), 'name' => 'range_behavior', 'options' => array('query' => array(array('id' => 0, 'name' => $this->l('Apply the cost of the highest defined range')), array('id' => 1, 'name' => $this->l('Disable carrier'))), 'id' => 'id', 'name' => 'name'), 'hint' => $this->l('Out-of-range behavior occurs when none is defined (e.g. when a customer\'s cart weight is greater than the highest range limit).')), array('type' => 'text', 'label' => $this->l('Maximum package height'), 'name' => 'max_height', 'required' => false, 'hint' => $this->l('Maximum height managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'text', 'label' => $this->l('Maximum package width'), 'name' => 'max_width', 'required' => false, 'hint' => $this->l('Maximum width managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'text', 'label' => $this->l('Maximum package depth'), 'name' => 'max_depth', 'required' => false, 'hint' => $this->l('Maximum depth managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'text', 'label' => $this->l('Maximum package weight'), 'name' => 'max_weight', 'required' => false, 'hint' => $this->l('Maximum weight managed by this carrier. Set the value to "0," or leave this field blank to ignore.')), array('type' => 'hidden', 'name' => 'is_module'), array('type' => 'hidden', 'name' => 'external_module_name'), array('type' => 'hidden', 'name' => 'shipping_external'), array('type' => 'hidden', 'name' => 'need_range')));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
}
$this->fields_form['submit'] = array('title' => $this->l('Save'));
if (!($obj = $this->loadObject(true))) {
return;
}
$this->getFieldsValues($obj);
return parent::renderForm();
}
示例2: __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')));
$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_RULES_GROUP' => array('title' => $this->l('Gift-wrapping tax'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), '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')));
}
示例3: __construct
public function __construct()
{
$this->bootstrap = true;
$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 (Five steps)')), array('value' => PS_ORDER_PROCESS_OPC, 'name' => $this->l('One-page checkout')));
$this->fields_options = array('general' => array('title' => $this->l('General'), 'icon' => 'icon-cogs', 'fields' => array('PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'hint' => $this->l('Please choose either the five-step or one-page checkout process.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'hint' => $this->l('Allow guest visitors to place an order without registering.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISALLOW_HISTORY_REORDERING' => array('title' => $this->l('Disable Reordering Option'), 'hint' => $this->l('Disable the option to allow customers to reorder in one click from the order history page (required in some European countries).'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->l('Minimum purchase total required in order to validate the order'), 'hint' => $this->l('Set to 0 to disable this feature.'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->l('Allow multishipping'), 'hint' => $this->l('Allow the customer to ship orders 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'), 'hint' => $this->l('Allows you to delay shipping at your customers\' request. '), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'hint' => $this->l('Require customers to accept or decline terms of service before processing an order.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('CMS page for the Conditions of use'), 'hint' => $this->l('Choose the CMS page which contains your store\'s conditions of use.'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval')), 'submit' => array('title' => $this->l('Save'))), 'gift' => array('title' => $this->l('Gift options'), 'icon' => 'icon-gift', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift wrapping'), 'hint' => $this->l('Suggest gift-wrapping to customers.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price'), 'hint' => $this->l('Set a price for gift wrapping.'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->l('Gift-wrapping tax'), 'hint' => $this->l('Set a tax for gift wrapping.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging'), 'hint' => $this->l('Suggest recycled packaging to customer.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))));
if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) {
unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']);
}
}
开发者ID:NathanGiesbrecht,项目名称:PrestaShopAutomationFramework,代码行数:18,代码来源:AdminOrderPreferencesController.php
示例4: __construct
public function __construct()
{
$this->bootstrap = true;
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
// List of CMS tabs
$cms_tab = array(0 => array('id' => 0, 'name' => $this->trans('None', array(), 'Admin.Global')));
foreach (CMS::listCms($this->context->language->id) as $cms_file) {
$cms_tab[] = array('id' => $cms_file['id_cms'], 'name' => $cms_file['meta_title']);
}
$this->fields_options = array('general' => array('title' => $this->trans('General', array(), 'Admin.Global'), 'icon' => 'icon-cogs', 'fields' => array('PS_FINAL_SUMMARY_ENABLED' => array('title' => $this->trans('Enable final summary', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Display an overview of the addresses, shipping method and cart just before the order button (required in some European countries).', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->trans('Enable guest checkout', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allow guest visitors to place an order without registering.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_DISALLOW_HISTORY_REORDERING' => array('title' => $this->trans('Disable Reordering Option', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Disable the option to allow customers to reorder in one click from the order history page (required in some European countries).', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_PURCHASE_MINIMUM' => array('title' => $this->trans('Minimum purchase total required in order to validate the order', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set to 0 to disable this feature.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isFloat', 'cast' => 'floatval', 'type' => 'price'), 'PS_ORDER_RECALCULATE_SHIPPING' => array('title' => $this->trans('Recalculate shipping cost after order edition', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Automatically updates the shipping costs when you edit an order.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_ALLOW_MULTISHIPPING' => array('title' => $this->trans('Allow multishipping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allow the customer to ship orders to multiple addresses. This option will convert the customer\'s cart into one or more orders.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_SHIP_WHEN_AVAILABLE' => array('title' => $this->trans('Delayed shipping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Allows you to delay shipping at your customers\' request.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->trans('Terms of service', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Require customers to accept or decline terms of service before processing an order.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->trans('Page for the Terms and conditions', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Choose the page which contains your store\'s terms and conditions of use.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))), 'gift' => array('title' => $this->trans('Gift options', array(), 'Admin.ShopParameters.Feature'), 'icon' => 'icon-gift', 'fields' => array('PS_GIFT_WRAPPING' => array('title' => $this->trans('Offer gift wrapping', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Suggest gift-wrapping to customers.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->trans('Gift-wrapping price', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set a price for gift wrapping.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array('title' => $this->trans('Gift-wrapping tax', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Set a tax for gift wrapping.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->trans('None'))), TaxRulesGroup::getTaxRulesGroups(true)), 'identifier' => 'id_tax_rules_group'), 'PS_RECYCLABLE_PACK' => array('title' => $this->trans('Offer recycled packaging', array(), 'Admin.ShopParameters.Feature'), 'hint' => $this->trans('Suggest recycled packaging to customer.', array(), 'Admin.ShopParameters.Help'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))));
if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) {
unset($this->fields_options['general']['fields']['PS_ALLOW_MULTISHIPPING']);
}
if (Configuration::get('PS_ATCP_SHIPWRAP')) {
unset($this->fields_options['gift']['fields']['PS_GIFT_WRAPPING_TAX_RULES_GROUP']);
}
}
示例5: getTaxRulesGroupsForOptions
/**
* @return array an array of tax rules group formatted as $id => $name
*/
public static function getTaxRulesGroupsForOptions()
{
$tax_rules[] = array('id_tax_rules_group' => 0, 'name' => Tools::displayError('No tax'));
return array_merge($tax_rules, TaxRulesGroup::getTaxRulesGroups());
}
示例6: displayForm
//.........这里部分代码省略.........
$groups = Group::getGroups((int) $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=' . (int) $obj->id . ' AND id_group=' . (int) $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('Apply shipping cost:') . ' </label>
<div class="margin-form">
<input type="radio" name="is_free" id="is_free_on" value="0" ' . (!$this->getFieldValue($obj, 'is_free') ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label>
<input type="radio" name="is_free" id="is_free_off" value="1" ' . ($this->getFieldValue($obj, 'is_free') ? 'checked="checked" ' : '') . '/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" /></label>
<p>' . $this->l('Apply shipping costs and additional shipping costs by products in carrier price') . '</p>
</div>
<div id="shipping_costs_div">
<label>' . $this->l('Tax') . '</label>
<div class="margin-form">
<select name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '>
<option value="0">' . $this->l('No Tax') . '</option>';
foreach (TaxRulesGroup::getTaxRulesGroups(true) as $tax_rules_group) {
echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . $tax_rules_group['name'] . '</option>';
}
echo '</select>
</div>
<label>' . $this->l('Shipping & handling:') . ' </label>
<div class="margin-form">
<input type="radio" name="shipping_handling" id="shipping_handling_on" value="1" ' . ($this->getFieldValue($obj, 'shipping_handling') ? 'checked="checked" ' : '') . '/>
<label class="t" for="shipping_handling_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
<input type="radio" name="shipping_handling" id="shipping_handling_off" value="0" ' . (!$this->getFieldValue($obj, 'shipping_handling') ? 'checked="checked" ' : '') . '/>
<label class="t" for="shipping_handling_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
<p>' . $this->l('Include the shipping & handling costs in carrier price') . '</p>
</div>
<label>' . $this->l('Billing:') . ' </label>
<div class="margin-form">
<input type="radio" name="shipping_method" id="billing_default" value="' . Carrier::SHIPPING_METHOD_DEFAULT . '" ' . ($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_DEFAULT ? 'checked="checked" ' : '') . '/>
<label class="t" for="billing_default">' . $this->l('Default behavior') . '</label><br />
<input type="radio" name="shipping_method" id="billing_price" value="' . Carrier::SHIPPING_METHOD_PRICE . '" ' . ($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_PRICE ? 'checked="checked" ' : '') . '/>
<label class="t" for="billing_price">' . $this->l('According to total price') . '</label><br />
<input type="radio" name="shipping_method" id="billing_weight" value="' . Carrier::SHIPPING_METHOD_WEIGHT . '" ' . ($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_WEIGHT ? 'checked="checked" ' : '') . '/>
<label class="t" for="billing_weight">' . $this->l('According to total weight') . '</label><br />
</div>
<label>' . $this->l('Out-of-range behavior:') . ' </label>
<div class="margin-form">
<select name="range_behavior">
<option value="0"' . (!$this->getFieldValue($obj, 'range_behavior') ? ' selected="selected"' : '') . '>' . $this->l('Apply the cost of the highest defined range') . '</option>
<option value="1"' . ($this->getFieldValue($obj, 'range_behavior') ? ' selected="selected"' : '') . '>' . $this->l('Disable carrier') . '</option>
</select>
<p>' . $this->l('Out-of-range behavior when none is defined (e.g., when a customer\'s cart weight is greater than the highest range limit)') . '</p>
</div>';
if ($this->getFieldValue($obj, 'is_module')) {
echo '<label>' . $this->l('Module:') . ' </label>
<div class="margin-form"><p> - ' . $this->l('This carrier is bound to this module ') . ' => ' . $this->getFieldValue($obj, 'external_module_name') . '</p>
<input type="hidden" name="is_module" value="1">
<input type="hidden" name="external_module_name" value="' . $this->getFieldValue($obj, 'external_module_name') . '">';
if ($this->getFieldValue($obj, 'shipping_external')) {
echo '<p> - ' . $this->l('The shipping costs are calculated outside of your shop') . '</p>
<input type="hidden" name="shipping_external" value="1">';
}
if ($this->getFieldValue($obj, 'need_range')) {
echo '<p> - ' . $this->l('This carrier uses PrestaShop range to calculate shipping costs') . '</p>
<input type="hidden" name="need_range" value="1">';
}
echo '</div>';
}
echo '</div>
<div class="margin-form">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>';
}
示例7: renderStepThree
public function renderStepThree($carrier)
{
$this->fields_form = array('form' => array('id_form' => 'step_carrier_ranges', 'input' => array('shipping_handling' => array('type' => 'switch', 'label' => $this->trans('Add handling costs', array(), 'Admin.Shipping.Feature'), 'name' => 'shipping_handling', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'shipping_handling_on', 'value' => 1, 'label' => $this->trans('Enabled', array(), 'Admin.Global')), array('id' => 'shipping_handling_off', 'value' => 0, 'label' => $this->trans('Disabled', array(), 'Admin.Global'))), 'hint' => $this->trans('Include the handling costs (as set in Shipping > Preferences) in the final carrier price.', array(), 'Admin.Shipping.Help')), 'is_free' => array('type' => 'switch', 'label' => $this->trans('Free shipping', array(), 'Admin.Shipping.Feature'), 'name' => 'is_free', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'is_free_on', 'value' => 1, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->trans('No', array(), 'Admin.Global') . '" title="' . $this->trans('No', array(), 'Admin.Global') . '" />'), array('id' => 'is_free_off', 'value' => 0, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->trans('Yes', array(), 'Admin.Global') . '" title="' . $this->trans('Yes', array(), 'Admin.Global') . '" />'))), 'shipping_method' => array('type' => 'radio', 'label' => $this->trans('Billing', array(), 'Admin.Shipping.Feature'), 'name' => 'shipping_method', 'required' => false, 'class' => 't', 'br' => true, 'values' => array(array('id' => 'billing_price', 'value' => Carrier::SHIPPING_METHOD_PRICE, 'label' => $this->trans('According to total price.', array(), 'Admin.Shipping.Feature')), array('id' => 'billing_weight', 'value' => Carrier::SHIPPING_METHOD_WEIGHT, 'label' => $this->trans('According to total weight.', array(), 'Admin.Shipping.Feature')))), 'id_tax_rules_group' => array('type' => 'select', 'label' => $this->trans('Tax', array(), 'Admin.Global'), 'name' => 'id_tax_rules_group', 'options' => array('query' => TaxRulesGroup::getTaxRulesGroups(true), 'id' => 'id_tax_rules_group', 'name' => 'name', 'default' => array('label' => $this->trans('No tax', array(), 'Admin.Global'), 'value' => 0))), 'range_behavior' => array('type' => 'select', 'label' => $this->trans('Out-of-range behavior', array(), 'Admin.Shipping.Feature'), 'name' => 'range_behavior', 'options' => array('query' => array(array('id' => 0, 'name' => $this->trans('Apply the cost of the highest defined range', array(), 'Admin.Shipping.Feature')), array('id' => 1, 'name' => $this->trans('Disable carrier', array(), 'Admin.Shipping.Feature'))), 'id' => 'id', 'name' => 'name'), 'hint' => $this->trans('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges).', array(), 'Admin.Shipping.Help')), 'zones' => array('type' => 'zone', 'name' => 'zones'))));
if (Configuration::get('PS_ATCP_SHIPWRAP')) {
unset($this->fields_form['form']['input']['id_tax_rules_group']);
}
$tpl_vars = array();
$tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
$currency = $this->getActualCurrency();
$tpl_vars['currency_sign'] = $currency->sign;
$fields_value = $this->getStepThreeFieldsValues($carrier);
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
}
示例8: displayFormInformations
//.........这里部分代码省略.........
<?php
}
// check if download directory is writable
?>
</div>
</td>
</tr>
<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
<script type="text/javascript">
if ($('#is_virtual_good').attr('checked'))
{
$('#virtual_good').show('slow');
$('#virtual_good_more').show('slow');
}
</script>
<?php
echo '
<tr>
<td class="col-left">' . $this->l('Pre-tax wholesale price:') . '</td>
<td style="padding-bottom:5px;">
' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" name="wholesale_price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'wholesale_price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
<span style="margin-left:10px">' . $this->l('The wholesale price at which you bought this product') . '</span>
</td>
</tr>';
echo '
<tr>
<td class="col-left">' . $this->l('Pre-tax retail price:') . '</td>
<td style="padding-bottom:5px;">
' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<sup> *</sup>
<span style="margin-left:2px">' . $this->l('The pre-tax retail price to sell this product') . '</span>
</td>
</tr>';
$tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
$taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getDefaultCountryId());
$ecotaxTaxRate = Tax::getProductEcotaxRate();
echo '<script type="text/javascript">';
echo 'noTax = ' . (Tax::excludeTaxeOption() ? 'true' : 'false'), ";\n";
echo 'taxesArray = new Array ();' . "\n";
echo 'taxesArray[0] = 0', ";\n";
foreach ($tax_rules_groups as $tax_rules_group) {
$tax_rate = array_key_exists($tax_rules_group['id_tax_rules_group'], $taxesRatesByGroup) ? $taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']] : 0;
echo 'taxesArray[' . $tax_rules_group['id_tax_rules_group'] . ']=' . $tax_rate . "\n";
}
echo '
ecotaxTaxRate = ' . $ecotaxTaxRate / 100 . ';
</script>';
echo '
<tr>
<td class="col-left">' . $this->l('Tax rule:') . '</td>
<td style="padding-bottom:5px;">
<span ' . (Tax::excludeTaxeOption() ? 'style="display:none;"' : '') . '>
<select onChange="javascript:calcPriceTI(); unitPriceWithTax(\'unit\');" name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '>
<option value="0">' . $this->l('No Tax') . '</option>';
foreach ($tax_rules_groups as $tax_rules_group) {
echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($tax_rules_group['name']) . '</option>';
}
echo '</select>
<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token=' . Tools::getAdminToken('AdminTaxRulesGroup' . (int) Tab::getIdFromClassName('AdminTaxRulesGroup') . (int) $cookie->id_employee) . '&id_product=' . (int) $obj->id . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a></span>
';
if (Tax::excludeTaxeOption()) {
echo '<span style="margin-left:10px; color:red;">' . $this->l('Taxes are currently disabled') . '</span> (<b><a href="index.php?tab=AdminTaxes&token=' . Tools::getAdminToken('AdminTaxes' . (int) Tab::getIdFromClassName('AdminTaxes') . (int) $cookie->id_employee) . '">' . $this->l('Tax options') . '</a></b>)';
echo '<input type="hidden" value="' . (int) $this->getFieldValue($obj, 'id_tax_rules_group') . '" name="id_tax_rules_group" />';
}
echo '</td>
示例9: generateTaxRuleGroupData
protected function generateTaxRuleGroupData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/tax_rule_groups.vsc', 'w');
foreach ($this->tax_rule_group_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$tax_rule_groups = TaxRulesGroup::getTaxRulesGroups();
if ($tax_rule_groups) {
foreach ($tax_rule_groups as $tax_rule_group) {
$trg = new TaxRulesGroup($tax_rule_group['id_tax_rules_group']);
foreach ($this->tax_rule_group_fields as $field => $array) {
$line[$field] = property_exists('TaxRulesGroup', $field) && !is_array($trg->{$field}) && !Tools::isEmpty($trg->{$field}) ? $trg->{$field} : '';
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
fclose($f);
}
示例10: initContentForCombinations
public function initContentForCombinations()
{
${${"GLOBALS"}["vmqqtmkyw"]} = $this->object;
if (!Combination::isFeatureActive()) {
$this->displayWarning($this->getMessage("This feature has been disabled, you can activate this feature at this page:") . $this->getMessage("link to Performances"));
return;
}
${"GLOBALS"}["weevwwkl"] = "product";
if (Validate::isLoadedObject(${${"GLOBALS"}["weevwwkl"]})) {
self::$smarty->assign("country_display_tax_label", $this->context->country->display_tax_label);
$zsahvowoo = "lang";
self::$smarty->assign("tax_exclude_taxe_option", Tax::excludeTaxeOption());
self::$smarty->assign("id_tax_rules_group", $product->id_tax_rules_group);
self::$smarty->assign("tax_rules_groups", TaxRulesGroup::getTaxRulesGroups(true));
${$zsahvowoo} = new Language($this->id_language);
self::$smarty->assign("iso_code", $lang->iso_code);
self::$smarty->assign("combinationImagesJs", $this->getCombinationImagesJs());
if ($product->is_virtual) {
$tpkpvyor = "product";
self::$smarty->assign("product", ${$tpkpvyor});
$this->displayWarning($this->getMessage("A virtual product cannot have combinations."));
} else {
${"GLOBALS"}["qqjbnscylsi"] = "attribute_js";
${"GLOBALS"}["nqxaoftbn"] = "attribute";
$bcesaxqdqqq = "images";
${"GLOBALS"}["zcxmuajd"] = "ps_stock_mvt_reason_default";
$vmytjghdfi = "attribute_js";
$nrkrfhirkx = "attributes";
${${"GLOBALS"}["qqjbnscylsi"]} = array();
$cappytc = "k";
${"GLOBALS"}["jyaoxpe"] = "attribute";
${$nrkrfhirkx} = Attribute::getAttributes($this->context->language->id, true);
foreach (${${"GLOBALS"}["ecblflvypvt"]} as ${$cappytc} => ${${"GLOBALS"}["jyaoxpe"]}) {
${$vmytjghdfi}[${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute_group"]][${${"GLOBALS"}["iixdipeiyldv"]}["id_attribute"]] = ${${"GLOBALS"}["nqxaoftbn"]}["name"];
}
${"GLOBALS"}["higiwiyuxd"] = "k";
${${"GLOBALS"}["sxexnhlq"]} = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT"));
self::$smarty->assign("attributeJs", ${${"GLOBALS"}["xenfvrjowsy"]});
self::$smarty->assign("attributes_groups", AttributeGroup::getAttributesGroups($this->context->language->id));
self::$smarty->assign("currency", ${${"GLOBALS"}["sxexnhlq"]});
${"GLOBALS"}["xzqtsdnlkv"] = "images";
${$bcesaxqdqqq} = Image::getImages($this->context->language->id, $product->id);
self::$smarty->assign("tax_exclude_option", Tax::excludeTaxeOption());
$rbxbrbxg = "product";
self::$smarty->assign("ps_weight_unit", Configuration::get("PS_WEIGHT_UNIT"));
self::$smarty->assign("ps_use_ecotax", Configuration::get("PS_USE_ECOTAX"));
self::$smarty->assign("field_value_unity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "unity"));
${"GLOBALS"}["vpcuib"] = "image_type";
self::$smarty->assign("reasons", ${${"GLOBALS"}["nqegxbae"]} = StockMvtReason::getStockMvtReasons($this->context->language->id));
self::$smarty->assign("ps_stock_mvt_reason_default", ${${"GLOBALS"}["zcxmuajd"]} = Configuration::get("PS_STOCK_MVT_REASON_DEFAULT"));
self::$smarty->assign("minimal_quantity", $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") ? $this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "minimal_quantity") : 1);
self::$smarty->assign("available_date", $this->getFieldValue(${$rbxbrbxg}, "available_date") != 0 ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "available_date"), version_compare(_PS_VERSION_, "1.5.5", ">=") ? null : $this->context->language->id))) : "0000-00-00");
${${"GLOBALS"}["tqkkuicfgax"]} = 0;
${"GLOBALS"}["ucamhp"] = "product";
self::$smarty->assign("imageType", ImageType::getByNameNType("small_default", "products"));
self::$smarty->assign("imageWidth", (isset(${${"GLOBALS"}["rvkjjxqs"]}["width"]) ? (int) ${${"GLOBALS"}["vpcuib"]}["width"] : 64) + 25);
foreach (${${"GLOBALS"}["xzqtsdnlkv"]} as ${${"GLOBALS"}["higiwiyuxd"]} => ${${"GLOBALS"}["inpuwydsyk"]}) {
$cshrlmyryz = "image";
${${"GLOBALS"}["dhvuermstcbs"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["obj"] = new Image(${$cshrlmyryz}["id_image"]);
$kcvbkys = "i";
++${$kcvbkys};
}
self::$smarty->assign("images", ${${"GLOBALS"}["dhvuermstcbs"]});
self::$smarty->assign(array("combinationArray" => $this->getCombinations(${${"GLOBALS"}["ucamhp"]}, ${${"GLOBALS"}["sxexnhlq"]}), "product" => ${${"GLOBALS"}["vmqqtmkyw"]}, "id_category" => $product->getDefaultCategory(), "token_generator" => "tokengenerator", "combination_exists" => Shop::isFeatureActive() && Shop::getContextShopGroup()->share_stock && count(AttributeGroup::getAttributesGroups($this->context->language->id)) > 0));
}
} else {
self::$smarty->assign("product", ${${"GLOBALS"}["vmqqtmkyw"]});
$this->displayWarning($this->getMessage("You must save this product before adding combinations."));
}
}
示例11: getTaxRules
/**
* @param $module
* @return mixed
*/
protected static function getTaxRules($module)
{
$taxRules = array();
$taxRuleGroups = TaxRulesGroup::getTaxRulesGroups(true);
foreach ($taxRuleGroups as $taxRuleGroup) {
/** @var TaxCore $taxItem */
$taxItem = ShopgateSettings::getTaxItemByTaxRuleGroupId($taxRuleGroup['id_tax_rules_group']);
$rule = array('id' => $taxRuleGroup['id_tax_rules_group'], 'name' => $taxRuleGroup['name'], 'priority' => 0);
$rule['product_tax_classes'] = array(array('id' => $taxItem->id, 'key' => is_array($taxItem->name) ? reset($taxItem->name) : ''));
$rule['customer_tax_classes'] = array(array('key' => 'default', 'is_default' => true));
$rule['tax_rates'] = array();
if (version_compare(_PS_VERSION_, '1.5.0.1', '<')) {
$taxRulesPrestashop = TaxRule::getTaxRulesByGroupId($taxRuleGroup['id_tax_rules_group']);
} else {
$taxRulesPrestashop = TaxRule::getTaxRulesByGroupId($module->context->language->id, $taxRuleGroup['id_tax_rules_group']);
}
foreach ($taxRulesPrestashop as $idCountry => $taxRuleItem) {
if (version_compare(_PS_VERSION_, '1.5.0.1', '>=')) {
$taxRuleItem = new TaxRule($taxRuleItem['id_tax_rule']);
$idTax = $taxRuleItem->id_tax;
$idCountry = $taxRuleItem->id_country;
$idState = $taxRuleItem->id_state;
} else {
$idTax = self::getTaxIdFromTaxRule($taxRuleItem);
$idState = key($taxRuleItem);
}
/** @var TaxCore $taxItem */
$taxItem = new Tax($idTax, $module->context->language->id);
$country = Country::getIsoById($idCountry);
$stateModel = new State($idState);
$state = $stateModel->iso_code;
$resultTaxRate = array();
$resultTaxRate['key'] = self::getTaxRateKey($taxItem, $country, $state);
//Fix for 1.4.x.x the taxes were exported multiple
if (self::arrayValueExists('key', $resultTaxRate['key'], $rule['tax_rates'])) {
continue;
}
$rule['tax_rates'][] = $resultTaxRate;
}
if ($taxItem->active && Configuration::get('PS_TAX') == 1) {
$taxRules[] = $rule;
}
}
return $taxRules;
}
示例12: renderStepThree
public function renderStepThree($carrier)
{
$this->fields_form = array('form' => array('id_form' => 'step_carrier_ranges', 'input' => array(array('type' => 'radio', 'label' => $this->l('Shipping and handling:'), 'name' => 'shipping_handling', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'shipping_handling_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'shipping_handling_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Include the shipping and handling costs in the carrier price.')), array('type' => 'radio', 'label' => $this->l('Apply shipping cost:'), 'name' => 'is_free', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'is_free_off', 'value' => 0, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />'), array('id' => 'is_free_on', 'value' => 1, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />')), 'desc' => $this->l('Apply both regular shipping cost and product-specific shipping costs.')), array('type' => 'radio', 'label' => $this->l('Billing:'), 'name' => 'shipping_method', 'required' => false, 'class' => 't', 'br' => true, 'values' => array(array('id' => 'billing_price', 'value' => Carrier::SHIPPING_METHOD_PRICE, 'label' => $this->l('According to total price')), array('id' => 'billing_weight', 'value' => Carrier::SHIPPING_METHOD_WEIGHT, 'label' => $this->l('According to total weight')))), array('type' => 'select', 'label' => $this->l('Tax:'), 'name' => 'id_tax_rules_group', 'options' => array('query' => TaxRulesGroup::getTaxRulesGroups(true), 'id' => 'id_tax_rules_group', 'name' => 'name', 'default' => array('label' => $this->l('No Tax'), 'value' => 0))), array('type' => 'select', 'label' => $this->l('Out-of-range behavior:'), 'name' => 'range_behavior', 'options' => array('query' => array(array('id' => 0, 'name' => $this->l('Apply the cost of the highest defined range')), array('id' => 1, 'name' => $this->l('Disable carrier'))), 'id' => 'id', 'name' => 'name'), 'desc' => $this->l('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges)')), array('type' => 'zone', 'name' => 'zones'))));
$tpl_vars = array();
$tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$tpl_vars['currency_sign'] = $currency->sign;
$fields_value = $this->getStepThreeFieldsValues($carrier);
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
}
示例13: _displayForm
private function _displayForm($updated, $debug_mode = false, &$debug_info = array())
{
$forsikring = Configuration::get('FRAKTGUIDE_FORSIKRING');
$edi = Configuration::get('FRAKTGUIDE_EDI');
$frapostnr = Configuration::get('FRAKTGUIDE_FRA_POSTNUMMER');
$products_str = Configuration::get('FRAKTGUIDE_PRODUCTS');
$selected_products = $products_str ? explode(';', $products_str) : array();
$max_price = Configuration::get('FRAKTGUIDE_A_POST_MAX_PRIS');
$id_tax_rules_group = Configuration::get('FRAKTGUIDE_ID_TAX_RULES_GROUP');
$products = array();
$product_descriptions = array();
$error = null;
if ($debug_mode) {
array_push($debug_info, "Starting display of configuration");
}
if ($frapostnr) {
$url = 'http://fraktguide.bring.no/fraktguide/products/all.json?from=' . $frapostnr . '&to=0185&weightInGrams=1000&edi=' . ($edi ? 'true' : 'false');
if ($debug_mode) {
array_push($debug_info, "Requesting url: " . $url);
}
$json_products = $this->getJson($url, $debug_mode, $debug_info);
if ($debug_mode) {
array_push($debug_info, "JSON response: " . print_r($json_products, true));
}
if ($json_products) {
foreach ($json_products["Product"] as $json_product) {
$id = $json_product["ProductId"];
$name = $json_product["GuiInformation"]["ProductName"];
$desc = $json_product["GuiInformation"]["HelpText"];
$products[$id] = $name;
$product_descriptions[$id] = $desc;
}
if ($debug_mode) {
array_push($debug_info, "Products: " . print_r($products, true));
array_push($debug_info, "Product descriptions: " . print_r($product_descriptions, true));
}
} else {
$error = $this->l("Feil ved uthenting av produkter");
}
}
$tax_rules_groups = array();
foreach (TaxRulesGroup::getTaxRulesGroups(true) as $tax_rule) {
$tax_rules_groups[$tax_rule['id_tax_rules_group']] = $tax_rule['name'];
}
$this->context->smarty->assign(array('error' => $error, 'updated' => $updated, 'fraktguide_edi' => $edi, 'fraktguide_a_post_max_price' => $max_price, 'fraktguide_insurance' => $forsikring, 'fraktguide_postal_code' => $frapostnr, 'fraktguide_products' => $products, 'fraktguide_product_descriptions' => $product_descriptions, 'fraktguide_selected_products' => $selected_products, 'fraktguide_debug_mode' => $debug_mode, 'fraktguide_debug_info' => $debug_info, 'fraktguide_id_tax_rules_group' => $id_tax_rules_group, 'fraktguide_tax_groups' => $tax_rules_groups));
$this->_html = $this->display(__FILE__, "templates/config.tpl");
}