Jump to content
bos

Taxing the taxes

Recommended Posts

Posted (edited)

I started using Cubecart some years ago, but I never became good friend with the tax system so it applies to my shop exactly how I want it. Trial and error during long periods showed me that the system is really simple; all costs entered are without VAT. But what I want is that all costs entered should be including VAT, and that in the summary the VAT should be shown as a value /of/ the total, not adding to the tutorial.

Someone suggested to use a tax extension from Noodleman that would let me do what I want, but alas: that extension (as well as a lot of others) uses an apache extension called ionCube, which has been and is UNavailable on all the three web hostings I've tried, and it's not installable per user. So, I was at a loss.

The workaround for my problem was to let Cubecart ignore anything that had to do with taxes, make enter all costs as including VAT. Then, in the order summary, I manually calculated the tax (total value * 0.2) and entered in the tax field. That way everything was correct and exactly how I wanted it. Total sum including tax, and the tax value being the tax value /only/, without adding or substracting itself to anything.

The backside of this approach is that it's been tedious work as my shop has grown bigger. So after 1 year of manually adding the taxes I took a dive into the source code to see if I could make some patch (for my own use only).

 

I ended up changing this file:

admin/sources/orders.index.inc.php: (add near line 425)

$overview_summary['total_tax'] =  Tax::getInstance()->priceFormat($overview_summary['total'] * 0.2);

This made Cubecart automatically fill the taxes box in the summary page for the order, without touching anything else. However, this had a side effect: in the print out, the tax field was not in the same format as the other monetary values. Instead of "123.00kr" it would be "123". No decimals and no currency.

A quick and ugly "solution" to this was changing the template:

admin/sources/orders.index.inc.php: (near line 219)

<!-- div class="total">{$tax.name} <strong>{$tax.value}</strong></div -->
<div class="total">{$tax.name} <strong>{$order.total * 0.2}kr</strong></div > <!-- bos 2019-12-31, auto tax -->

This works, sort of, if the currency is SEK (kr, kronor). Rounding errors can occur, leading to "123.4567kr" and so forth, and it will be totally bogus when a customer uses another currency. I did however not find a way to make an inline PHP-call to number_format(), or to Cubecart's internal currency/number-function (which I do not remember the name of at this time), but all in all these small changes saves me tons of work by not having to enter the tax sum manually.

 

(NB: Should this post be in the wrong forum I will humbly apologize. I picked it since it was the one that best fit the description)

 

 

EDIT: Typo

Edited by bos
typo: available -> UNavailable

Share this post


Link to post
Share on other sites

"ionCube, which has been and is available on all the three web hostings I've tried, is not installable per user."

Can we explore this a bit more?

Share this post


Link to post
Share on other sites

That was a typo. It should have been UNavailable (I have edited the post).

 

The web hosters I've been using are One.com (current), Loopia (previous), and Crystone (former). None of them supports or allows ionCube.

Share this post


Link to post
Share on other sites

Note: initial research suggests that One.com is running PHP environments in a "safe" mode - which disallows user-loaded extensions, among other restrictions.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...