This topic can no longer be replied to because it has been locked.

Log Errors - Invalid Country Code, JSON batch failing
Gravatar
Joined: 2016-09-09
Posts: 11
Hi,

We're trying to get reporting for ecommerce to work again for Mailchimp after upgrading from MageMonkey to the Mailchimp4Magento extension. We've been chasing down bugs in the log files, and after we bypass one there always seems to be another.

First we were having problems due to duplicate SKU numbers. That was resolved. We also tried bypassing the batch JSON creation for products to see what would go through after this error:

2016-12-03T00:30:04+00:00 DEBUG (7): Resource Not Found : The requested resource could not be found.

But we were then met with this error when the code attempts to create batch JSON for carts, it throws this error message many times:

2016-12-05T08:45:06+00:00 DEBUG (7): Invalid country code:

Any advice on what to do here?

Thanks
Gravatar
Joined: 2012-03-08
Posts: 843
Hi Ian,

thanks for your contact.
Do you know what is the country code who fail?

Best
Gravatar
Joined: 2016-09-09
Posts: 11
Hello,

The only country code in use on the site is the US. Is there a way to see which one is being submitted? (perhaps if it is blank)

Ian
Gravatar
Joined: 2012-03-08
Posts: 843
Check if you have billing address without country code.
Gravatar
Joined: 2016-09-09
Posts: 11
Hello,

Below are two samples- we have some with a correct country code, some without. All operation IDs beginning with QUO_ are wrong, all starting with ORD_ are correct. Is this a result of the extension?

Bad Example
"operations": [ { "method": "POST", "path": "\/ecommerce\/stores\/nextadventure.net_2016-11-30-215420\/carts", "operation_id": "QUO_2016-12-05-04-50-02_13099", "body": "{\"id\":\"13099\",\"customer\":{\"id\":\"GUEST-2016-12-05-04-50-03\",\"email_address\":\"jacconevs@icloud.com\",\"opt_in_status\":false,\"first_name\":\"Jacqueline \",\"last_name\":\"Evans\",\"address\":{\"address1\":\"Tan y Graig Road\",\"city\":\"Llysfaen\",\"province\":\"Conwy\",\"province_code\":\"Conwy\",\"postal_code\":\"LL29 8UE\",\"country\":\"GB\",\"country_code\":\"United Kingdom\"}},\"checkout_url\":\"http:\\\/\\\/nextadventure.net\\\/mailchimp\\\/cart\\\/loadquote?id=13099&token=1da7976bb39c4e283d32ba763a7de958\",\"currency_code\":\"USD\",\"order_total\":\"56.9900\",\"tax_total\":0,\"lines\":[{\"id\":\"0\",\"product_id\":\"4590\",\"product_variant_id\":\"19008\",\"quantity\":0,\"price\":\"56.9900\"}]}" },

Good Example:
{ "method": "POST", "path": "\/ecommerce\/stores\/nextadventure.net_2016-11-30-215420\/orders", "operation_id": "ORD_2016-12-05-04-50-31_79", "body": "{\"id\":\"79\",\"currency_code\":\"USD\",\"order_total\":\"12.5800\",\"tax_total\":\"0.0000\",\"shipping_total\":\"0.0000\",\"processed_at_foreign\":\"2016-04-04 03:33:29\",\"lines\":[{\"id\":\"1\",\"product_id\":\"1643\",\"product_variant_id\":\"1643\",\"quantity\":1,\"price\":\"10.0000\"}],\"customer\":{\"FNAME\":\"Michael\",\"LNAME\":\"Selep\",\"EMAIL\":\"mikeselep@gmail.com\",\"id\":\"60\",\"address\":{\"address1\":\"3010 SW 10th Ave\",\"address2\":\"Apt 65\",\"city\":\"Portland\",\"province\":\"Oregon\",\"province_code\":\"OR\",\"postal_code\":\"97239\",\"country\":\"United States\",\"country_code\":\"US\"},\"orders_count\":1,\"total_spent\":12}}" }

Gravatar
Joined: 2016-09-09
Posts: 11
Hi, any chance of an update regarding this issue?

Thanks
Gravatar
Joined: 2012-03-08
Posts: 843
You are wright, the country and country code are swapped in the carts!!!
Thanks for your feedback, really appreciate it
Replace this file https://github.com/mailchimp/mc-magento/blob/dev_santisp/app/code/community/Ebizmarts/MailChimp/Model/Api/Carts.php

Best
Gravatar
Joined: 2016-09-09
Posts: 11
Great, thank you for the update. We'll put this in place.
Gravatar
Joined: 2012-03-08
Posts: 843
Sorry for the issue, and again thanks for your feedback

NEWSLETTER

Subscribe to our newsletter to receive emails and useful news articles