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.

Archive

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

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

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


Reply

8 Posts   2808 Views

Avatar
Pixel

5 August 2008 at 10:12pm (Last edited: 5 August 2008 11:13pm), Community Member, 78 Posts

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

6 August 2008 at 12:57pm Forum Moderator, 5511 Posts

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

Avatar
Pixel

7 August 2008 at 10:34pm Community Member, 78 Posts

A daily build

Avatar
The Frenchy

8 August 2008 at 9:17am Core Development Team, 40 Posts

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

8 August 2008 at 9:37am (Last edited: 8 August 2008 9:39am), Forum Moderator, 921 Posts

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

14 August 2008 at 1:27am (Last edited: 14 August 2008 1:48am), Community Member, 78 Posts

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

17 September 2008 at 1:05pm Community Member, 39 Posts

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

17 September 2008 at 1:15pm (Last edited: 17 September 2008 1:15pm), Community Member, 39 Posts

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;
         }
      }