Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Tax Calculator on Ecommerce module


Go to End


7 Posts   67946 Views

Avatar
bubaphex

Community Member, 12 Posts

31 October 2008 at 3:27pm

Hey all,

Unsure if i should post this here.

When i enable the tax calculator for the e commerce module i get the following error

XML Parsing Error: junk after document element
Location: http://www.mysite.co.nz/ecommerce/
Line Number 2, Column 1:<b>Notice</b>: Undefined offset: 0 in <b>/var/www/html/am/ss/ecommerce/code/TaxCalculator.php</b> on line <b>53</b><br />
^

All is what ive done is added this to mysite/_config.php:

// Set the tax calculation to be for NZ customers at 12.5% exclusive
// on the order price.
TaxCalculator::set_for_country("NZ", 0.125, "GST", "exclusive");

if i remove it the price goes away.

can any one shed some light on why this is happening?

Avatar
Josh

SilverStripe Developer, 65 Posts

31 October 2008 at 3:59pm

Hi bubaphex,

It looks like this is the Content Negotiator trying to be helpful.

Go to your mysite/_config.php file and add the following:

ContentNegotiator::disable();

Cheers,
Josh

Avatar
bubaphex

Community Member, 12 Posts

31 October 2008 at 4:03pm

Thanks for the speedy reply Josh,

The XML error has gone now but has been replaced with

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 53

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 54

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 55

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 53

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 54

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 55

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 53

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 54

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 55

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 53

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 54

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 55

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 53

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 54

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 55

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 53

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 54

Notice: Undefined offset: 0 in /var/www/html/am/ss/ecommerce/code/TaxCalculator.php on line 55

Avatar
Josh

SilverStripe Developer, 65 Posts

31 October 2008 at 4:12pm

No worries,

Try turning off PHP error reporting at the NOTICE level.

again in mysite/_config.php write the following

error_reporting(E_ALL ^ E_NOTICE);

(THANKS WILL)

Avatar
bubaphex

Community Member, 12 Posts

31 October 2008 at 4:44pm

thanks josh,

errors have all gone away but the gst isnt working any more. its not displaying at all.

Avatar
Sigurd

Forum Moderator, 628 Posts

2 November 2008 at 7:36pm

All along you've been saying that there is an error at ecommerce/code/TaxCalculator.php on line 55

Have you looked at that line of code to see what the problem is?

The messages above are simply supressing the error message, not actually resolving any cause.

Avatar
bubaphex

Community Member, 12 Posts

3 November 2008 at 9:47am

this is what is found on those three lines

53 $this->rate = self::$rates_by_country[$country];
54 $this->name = self::$names_by_country[$country];
55 $this->excl = self::$excl_by_country[$country];