Welcome Guest, Not a member yet? Register   Sign In
flexi cart - A comprehensive shopping cart library for CodeIgniter
#75

[eluser]koichirose[/eluser]
Hi,

Thank you for your answer.

I'm leaving the discount codes aside for a moment, as updating the model brought up a new bug about shipping tax rates (I see there's a commit in May about this), either on your or my side.

Here's what I'm doing:
Code:
$total_shipping = $this->m_mkt_cart->calculate_shipping($cart_items);
$shipping_data = array(
'value' => $total_shipping['shipping'] //value has no tax here
);

//get tax rate based on current country
$tax_data = $this->m_mkt_misc->get_tax_rate_by_country_id($this->settings->mkt_country_id);
/* tax data is:
array
  'rate' => int 21
  'name' => string 'VAT' (length=3)
*/
$this->flexi_cart->set_tax($tax_data);
$this->flexi_cart->set_shipping($shipping_data);
var_dump($this->flexi_cart->cart_summary());
/* output:
array
  'item_summary_total' => string '€ 82.64' (length=9)
  'item_summary_savings_total' => string '€ 0.00' (length=8)
  'shipping_total' => string '€ 14.74' (length=9)
  'item_shipping_total' => string '€ 97.38' (length=9)
  'summary_savings_total' => string '€ 0.00' (length=8)
  'savings_total' => string '€ 0.00' (length=8)
  'reward_voucher_total' => string '€ 0.00' (length=8)
  'surcharge_total' => string '€ 0.00' (length=8)
  'tax_total' => string '€ 17.35' (length=9)
  'total' => string '€ 114.73' (length=10)
  'total_rows' => string '1' (length=1)
  'total_items' => string '1' (length=1)
  'total_weight' => string '0g' (length=2)
  'total_reward_points' => string '826' (length=3)
*/
As you can see, 'total' is (item_summary_total + tax) + shipping. No tax is applied to shipping.

According to the documentation of the 'set_shipping()' function, it should apply the cart tax rate:
Quote:'tax_rate' - Tax rate applied to the shipping rate, the carts tax value is used if no value is submitted. Submitted values must be numeric.


I could fairly easily add a 'tax_rate' field to the $shipping_data array, but I wanted to point out a possible bug.

Could you verify this?

Thanks again

p.s. anchors on the doc site still don't work on firefox (verified both on osx and windows). they are fine on chrome. I guess you can't do anything about it Smile


EDIT: I see I have this in my config file:
Code:
$config['defaults']['shipping']['tax_rate'] = 0;

I guess this is the value it uses, instead of the cart one. Is this by design?

EDIT2: it doesn't use that. I solved for now by manually setting a 'tax_rate' value for $shipping_data.


Messages In This Thread
flexi cart - A comprehensive shopping cart library for CodeIgniter - by El Forum - 11-14-2012, 03:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB