X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Avalara AvaTax Module Error Fix (https://forum.x-cart.com/showthread.php?t=70536)

notgrass 11-15-2014 08:42 AM

Avalara AvaTax Module Error Fix
 
I created an account with Avalara and activated the module in X-Cart 4.6.5. When I tried to get a tax calculation in the cart, nothing showed up. The log showed this error:

RequiredError: CustomerCode is required.

I poked around in this file:

modules/AvaTax/func.php

Each transaction submitted to Avalara must have a unique Customer Code attached to it. The default programming for the routine uses X-Cart's Customer ID, which does not exist for unregistered customers.

So I modified the code to use the customer's email address instead.

In function func_avatax_get_taxes, I added the line with 'email':

'id' => 1,
'email' => 1,
));

In function func_avatax_get_taxes_internal I changed this line:

$request->setCustomerCode(!empty($customerInfo['id']) ? $customerInfo['id'] : '');

to this:

$request->setCustomerCode(!empty($customerInfo['email']) ? $customerInfo['email'] : '');

It's working for me, but do your own testing!

cflsystems 11-15-2014 12:14 PM

Re: Avalara AvaTax Module Error Fix
 
you should report this in the bug tracker

notgrass 11-17-2014 03:31 AM

Re: Avalara AvaTax Module Error Fix
 
Okay. I reported it. I also edited the last line of code in my original post.


All times are GMT -8. The time now is 09:02 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.