[-] Core: the gift wrapping taxes is now handled by tax rules group

This commit is contained in:
Rémi Gaillard
2012-12-21 18:01:43 +01:00
parent 66dcbed995
commit b4217046ae
9 changed files with 59 additions and 38 deletions
@@ -53,11 +53,6 @@ class AdminOrderPreferencesControllerCore extends AdminController
)
);
// 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'),
@@ -140,14 +135,14 @@ class AdminOrderPreferencesControllerCore extends AdminController
'cast' => 'floatval',
'type' => 'price'
),
'PS_GIFT_WRAPPING_TAX' => array(
'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' => $taxes,
'identifier' => 'id'
'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'),
@@ -98,7 +98,7 @@ class AdminShippingControllerCore extends AdminController
else
$array_carrier[] = $carrier['id_carrier'];
$id_carrier = Tools::getValue('id_carrier');
$id_carrier = (int)Tools::getValue('id_carrier');
if (count($carriers) && isset($array_carrier[0]))
{
+9 -10
View File
@@ -141,9 +141,8 @@ class OrderOpcControllerCore extends ParentOrderController
$this->_processAddressFormat();
$this->_assignAddress();
// Wrapping fees
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
$return = array_merge(array(
'order_opc_adress' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-address.tpl'),
'block_user_info' => (isset($blockUserInfo) ? $blockUserInfo->hookTop(array()) : ''),
@@ -203,9 +202,8 @@ class OrderOpcControllerCore extends ParentOrderController
{
$result = $this->_getCarrierList();
// Wrapping fees
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
$result = array_merge($result, array(
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
@@ -493,9 +491,10 @@ class OrderOpcControllerCore extends ParentOrderController
$carriers = $this->context->cart->simulateCarriersOutput();
$delivery_option = $this->context->cart->getDeliveryOption(null, false, false);
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
$vars = array(
'free_shipping' => $free_shipping,
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
@@ -505,7 +504,7 @@ class OrderOpcControllerCore extends ParentOrderController
'conditions' => (int)(Configuration::get('PS_CONDITIONS')),
'link_conditions' => $link_conditions,
'recyclable' => (int)($this->context->cart->recyclable),
'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
'gift_wrapping_price' => (float)$wrapping_fees,
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency),
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
+3 -4
View File
@@ -470,9 +470,8 @@ class ParentOrderControllerCore extends FrontController
protected function _assignWrappingAndTOS()
{
// Wrapping fees
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
$wrapping_fees_tax = new Tax(Configuration::get('PS_GIFT_WRAPPING_TAX'));
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
// TOS
$cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id);
@@ -495,7 +494,7 @@ class ParentOrderControllerCore extends FrontController
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
'address_collection' => $this->context->cart->getAddressCollection(),
'delivery_option' => $this->context->cart->getDeliveryOption(null, false),
'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
'gift_wrapping_price' => (float)$wrapping_fees,
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency)));
}