close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Tax Value Problem

Thread begun 11/11/2009 5:13 am by dnys04173367569 | Last modified 11/12/2009 12:15 pm by Dani Chankhour | 1848 views | 3 replies |

dnys04173367569

Tax Value Problem

I am new to web design and I am having a problem with tax rules.

The cart has to calculate the tax value, but since it is already included on the price item, I need the cart to state the figures as follows:

The catalogue shows: 115.00 and the cart must show this as follows:-


Sub Total £100.00
Tax £ 15.00
Total Incl Tax £115.00

I have tried adding the following rule to my cart object as previously mentioned in another successful solution.

([Price] - ([Price] * $_SESSION['tax'])) * [Quantity]

but i keep getting the error

Notice: Undefined index: Tax in d:\wamp\www\AB\WA_eCart\AngelBeeStore_PHP.php on line 368

I have included copies of the ecart images and a copy of the relevant AngelBeeStore_PHP.php code

I would appreciate any help with this matter.

Sign in to reply to this post

Dani Chankhour

The reason for that error is that the session['tax'] is not yet set. Please change your rule in eCart to be:

([Price] - ([Price] * (isset($_SESSION['tax'])?$_SESSION['tax']:"1")) ) * [Quantity]

Sign in to reply to this post

dnys04173367569

I thank you for the quick responce in respect of this problem, but the answer have brough up a few more issues.

The formula stated as stated above:-

([Price] - ([Price] * (isset($_SESSION['Tax'])?$_SESSION['Tax']:"1"))) * [Quantity]

actually reduced the product by 100%.

I have included the following change for those looking at this query.

I have since altered the "1" and tried "0.130434" which is based on a product valued at £100 which already includes VAT/TAX of 15%

i.e. 100% for the Product + 15% for the VAT/TAX = 115%

therefore 100 / 115 = 0.869565.......
then take 1 and subtract the 0.869565
1 - 0869565 = 0.130434 <=== Suggest that this amount is stored at more than 4 decimal places as noticed that I can have a small error of 1p at 4 decimal places ===

([Price] - ([Price] * (isset($_SESSION['Tax'])?$_SESSION['Tax']:"0.130434"))) * [Quantity]

This gives the correct answer of £86.96 net price + VAT/TAX of £13.04 = £100.00

However, my problem is that the formula seems only helpful if I am dealing with one tax rate, i.e. "0.130434" unless I am missing something.

How can I set the $_SESSION['Tax'] so that I can get the relevant tax rate from a database, the tax amount can then change on which country is selected and/or state.

And so that I will not get the error due to the $_SESSION['Tax'] not being set.

Notice: Undefined index: Tax in d:\wamp\www\AB\WA_eCart\AngelBeeStore_PHP.php on line 368

From what you have said earlier I have not set the $_SESSION['Tax'] I guess that the $_SESSION['Tax'] should be setup, not within the calulations but elsewhere normally.

How do I get the TAX from a Database based on a country selected in the purchases profile, which would be far better or if not logged in no tax.

I do appreciate your time and hope that someone can help me in these matters and thanks to DANI for your earlier responce.

Sign in to reply to this post

Dani Chankhour

If the Tax Rates are stored in your database, then on your confirm page, you will need to create a record set that returns out the tax rate based on the country which is sent from your check out page. and then you will set the tax session based on the result from your record set.

If you have questions in regard to creating the record set or the session, please let me know.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...