Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Avalara AvaTax Module Error Fix

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
  #2  
Old 11-15-2014, 12:14 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Avalara AvaTax Module Error Fix

you should report this in the bug tracker
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 11-17-2014, 03:31 AM
 
notgrass notgrass is offline
 

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

Default Re: Avalara AvaTax Module Error Fix

Okay. I reported it. I also edited the last line of code in my original post.
__________________
X-Cart v4.6.5
www.notgrass.com/notgrass/
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:45 PM.

   

 
X-Cart forums © 2001-2020