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

TaxModifier? TaxCalculator? Which one? How do you add tax? What actually happens if Tax works? Has anyone actually implemented Tax - ever?


Go to End


8 Posts   4096 Views

Avatar
Pixel

Community Member, 78 Posts

5 August 2008 at 10:12pm

Edited: 05/08/2008 11:13pm

Please answer above questions because it just does not seem to work!

In the ecommerce documentation it says to add:

TaxCalculator::set_for_country("UK",0.175,"VAT","exclusive");

to the config file but when accessing the site it throws:

Fatal error: Class 'TaxCalculator' not found in /var/www/vhosts/xxxxx.co.uk/httpdocs/mysite/_config.php on line 48

In the ecommerce folders under modifiers there is no TaxCalculator but there is a TaxModifier and the site does not throw a funny if I put:

TaxModifier::set_for_country("UK",0.175,"VAT","exclusive");

but nothing seems to happen?

Thanks

Avatar
Willr

Forum Moderator, 5523 Posts

6 August 2008 at 12:57pm

you using the stable or the trunk version of the module?

Avatar
Pixel

Community Member, 78 Posts

7 August 2008 at 10:34pm

A daily build

Avatar
The Frenchy

Core Development Team, 40 Posts

8 August 2008 at 9:17am

Hi,

In the new Ecommerce system, we have removed the code for Tax And Shipping and put them in what we have called "OrderModifier" structure.

To add a modifier to your order structure, you need to execute this code in your _config.php file :

Order::set_modifiers(array('TaxModifier'));

Avatar
Sean

Forum Moderator, 922 Posts

8 August 2008 at 9:37am

Edited: 08/08/2008 9:39am

You'll probably want to update the documention on these new features somewhere, Romain.

Perhaps a new ecommerce wiki page, for the new upcoming version?

Avatar
Pixel

Community Member, 78 Posts

14 August 2008 at 1:27am

Edited: 14/08/2008 1:48am

Help. I just added to config:

Order::set_modifiers(array('TaxModifier'));

and on returning to the shopping cart I get this fatal error.

Fatal error: Call to undefined function IsExclusive() in /var/www/vhosts/mysite.co.uk/httpdocs/ecommerce/code/modifiers/TaxModifier.php on line 64

What is wrong?

Should I still have

TaxModifier::set_for_country("UK", 0.175, "VAT", "exclusive");

in the config file?

Avatar
a-tech

Community Member, 39 Posts

17 September 2008 at 1:05pm

Its because you havent defined the function IsExclusive() - check your code.

I got this working, but sending the order to paypalpayment doesnt include the modifier items, how do i acheive this?

Avatar
a-tech

Community Member, 39 Posts

17 September 2008 at 1:15pm

Edited: 17/09/2008 1:15pm

hey dont worry, figured it out myself, add this below the foreach for items (this is for PayPalPayment.php)

// 3) Items Informations
...

// 3.1) Modifiers
		if($modifiers = $order->Modifiers()) {
			foreach($modifiers as $modifier)
			{
				$inputs['item_name_' . ++$cpt] = $modifier->TableTitle();
				// item_number is unnecessary
				$inputs['amount_' . $cpt] = $modifier->LiveAmount();
				$inputs['quantity_' . $cpt] = 1;
			}
		}