View Single Post
  #1  
Old 11-15-2014, 08:42 AM
 
notgrass notgrass is offline
 

Advanced Member
  
Join Date: Dec 2011
Location: Tennessee
Posts: 33
 

Default 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!
__________________
X-Cart v4.6.5
www.notgrass.com/notgrass/
Reply With Quote