Post by neochap » Tue Jun 23, 2009 3:45 am

Canada has cumulative taxes in some states.
Structure of tax is

Quebec GST= 5%
PST = 7.5%



IMPORTANT>>* in Québec, PST is calculated on the total price including GST


that means for Quebec:
TaxwithGST = price +GST

Total tax = TaxwithGST + PST of TaxwithGST
How to implement taxes in Quebec where taxes are cumulative?

Is it possible to do in Open cart.
Because I have been trying it for past 2 days.

Newbie

Posts

Joined
Fri May 22, 2009 9:22 am

Post by neochap » Wed Jun 24, 2009 9:56 pm

Need help guys.

I have changed the entire View layer to suit my website.
Invested a lot of time in it.

But now I can't configure taxes.

Any help would be appreciated.

Thanks...

Newbie

Posts

Joined
Fri May 22, 2009 9:22 am

Post by Daniel » Wed Jun 24, 2009 11:37 pm

setup the geo zones first then add the tax rates.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by novacom » Wed Oct 07, 2009 11:10 am

Hi Daniel !

I also have to do this cummulative tax things. The way opencart calculate taxes is :

Code: Select all

base price 
+
base price * tax1 (5%)
+
base price * tax2 (7.5%)
So a 100$ item would end up as 112.50 $ which is wrong here in quebec, we should do cummulative tax :

Code: Select all

base price 
+
base price * tax1 (5%)
+
(base price + (base price * tax1 (5%))) * tax2 (7.5%)
The correct amount would be 112.88 $


Any way to do it simply or hard coding is the only way ?

Thanks for your time ;)

User avatar
Newbie

Posts

Joined
Wed Oct 07, 2009 10:58 am
Location - Montreal / Canada

Post by Qphoria » Wed Oct 07, 2009 11:35 am

is 33 cents that major? just mark it up a bit and call the extra "handling" :)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by novacom » Thu Oct 08, 2009 8:40 am

I understand 33 cents is no big deal on a 100 $ item. But as your raise the base price (or the quantity), it becomes bigger and bigger. And for the sake of doing things correctly, it is just not an option to leave it this way.

Maybe if someone could just point up what file/module is doing the tax calculation, I will gladly change it and repost the modification I made in my site.

Thanks

User avatar
Newbie

Posts

Joined
Wed Oct 07, 2009 10:58 am
Location - Montreal / Canada

Post by novacom » Thu Oct 08, 2009 12:03 pm

Allright, I managed to get this done the "correct way" I guess. I finally crafted an Extension for Orders Total. I simply disabled the default Taxes module. The new one recalculates taxes cumulatively. The only part where it does not work is for prices when browsing for items. I just configured "Display Prices With Tax: NO" and all seems fine.

I will be posting the contribution in a few days with appropriate docs.for fellow Canadians that would need this handy add-on. This gave me a good challenge and made me learn more about the internal structure of opencart, a very nice piece of software. Thumbs up to the developpers. ;)

User avatar
Newbie

Posts

Joined
Wed Oct 07, 2009 10:58 am
Location - Montreal / Canada

Post by tester_montreal » Fri Nov 20, 2009 4:23 am

Hi. Please, can you help me with that module. I will appreciate a lot :)


Posts

Joined
Fri Nov 20, 2009 4:21 am

Post by sol » Fri Nov 20, 2009 7:46 am

Hi,

need cumulative taxe module too.

thx

sol
Newbie

Posts

Joined
Fri Nov 20, 2009 7:42 am

Post by Daniel » Fri Nov 20, 2009 8:45 am

hold on you want to add tax on a price that already has another tax already added to.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by sol » Fri Nov 20, 2009 9:44 am

Hi Daniel,

I know is weird. ;)

base price
+
base price * tax1(priority1) (5%)
+
(base price + (base price * tax1(priority1) (5%))) * tax2(priority2) (7.5%)

Prestashop dont offert this possibility. It's hard to find a web 2.0 shopping cart with cumulative tax.

Thx

Sol

Attachments

tax.png

tax.png (9.97 KiB) Viewed 8549 times

Last edited by sol on Fri Nov 20, 2009 10:03 am, edited 1 time in total.

sol
Newbie

Posts

Joined
Fri Nov 20, 2009 7:42 am

Post by tester_montreal » Fri Nov 20, 2009 9:56 am

Is not weird.....this is the way to calculate TAXES in Quebec. I think is not hard to change the code. Lets go to work together in this. Thanks.


Posts

Joined
Fri Nov 20, 2009 4:21 am

Post by Daniel » Fri Nov 20, 2009 5:08 pm

i'll see what I can do.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by sol » Mon Nov 23, 2009 9:44 pm

Ok ,

Thanks !

sol
Newbie

Posts

Joined
Fri Nov 20, 2009 7:42 am

Post by sol » Mon Dec 21, 2009 3:41 am

Hi,

Anyone have a solution for cumulative tax in Canada ?

sol
Newbie

Posts

Joined
Fri Nov 20, 2009 7:42 am

Post by princess09 » Wed Dec 30, 2009 11:12 am

My uncle live in Canada told me that there are really cumulative tax in some state of Canada including their state. Honestly speaking, I don't know what is that cumulative tax for? Maybe that tax has a great advantages on us especially the poor ones. I hope you and ax Attorney could help me.

Newbie

Posts

Joined
Wed Dec 30, 2009 11:03 am

Post by wadih » Mon Jan 04, 2010 7:24 am

Hi Daniel / open cart developers / module developers,

I've done an analysis of the source code and noted that the "cumulative taxes" requirement could be implemented by amending the getRate() and calculate() functions in system/library/tax.php file.

Currently, the system sums up all tax rates of a particular tax class with getRate(), and does the multiplication with the product price with calculate() and divides by 100 to find the product after-tax total as shown below:

For reference, here's the code responsible for computing the after-tax total (in system/library/tax.php):

Code: Select all

    public function calculate($value, $tax_class_id, $calculate = TRUE) { 
    if (($calculate) && (isset($this->taxes[$tax_class_id])))  {
      $rate = $this->getRate($tax_class_id);

          return $value + ($value * $rate / 100);
      } else {
          return $value;
      }
    }

    public function getRate($tax_class_id) {
    if (isset($this->taxes[$tax_class_id])) {
      $rate = 0;

      foreach ($this->taxes[$tax_class_id] as $tax_rate) {
        $rate += $tax_rate['rate'];
      }

      return $rate;
    } else {
        return 0;
    }
  }
My problem is that I suspect files in the system/library/ folder are core files that shouldn't be modified directly.

Does opencart provide a way to override the getRate() and calculate() functions with custom ones through a module/extension, thus keeping the core files intact as well as the possibility of reverting back?

If not, what would be the best way to implement this cumulative taxes requirement into opencart, knowing that functionality must change at the system/library/tax.php level.

Thank you,
Wadih

Newbie

Posts

Joined
Mon Jan 04, 2010 5:23 am
Location - Canada

Post by reilly » Fri Jun 25, 2010 12:53 am

Why not just use the effective tax rate for the Quebec QST? Thus Under the Tax Class for Quebec, the Description would read QST (7.5%) but the Tax Rate would be 7.875% (rounds to 7.88%).

Newbie

Posts

Joined
Fri Jun 25, 2010 12:38 am

Post by nCube » Wed Apr 27, 2011 4:44 am

This is actually called a "Compound" tax. IMO this should be a property that admins should be able to activate on a tax, most other shopping carts already support this. Using the effective tax rate is a temporary solution, but is sure to increase cart abandonment rates and support costs for high-volume stores.

Newbie

Posts

Joined
Wed Apr 27, 2011 4:37 am

Post by novacom » Tue Nov 22, 2011 1:24 pm

I have managed to extract the php files I created/modified/hacked to get these cumulative taxes to work.

Edit : Back in oct 2009... open cart 1.3.2 at that time

I do have those files handy if needed... You might have to make them fit in the new versions but at least they have done the job. PM me if you need those.

Regards

Francis

User avatar
Newbie

Posts

Joined
Wed Oct 07, 2009 10:58 am
Location - Montreal / Canada
Who is online

Users browsing this forum: Bing [Bot] and 44 guests