March 19, 2010 at 10:59 pm #952
Hi, I spoke with another support member (Ivy) and he told me to bring this to Amin’s attention.
I’ve been doing a metric ton of research on the MailChimp API and wrapping my mind around how to achieve a certain specific goal that my client is looking for.
Basically, MailChimp allows AutoResponders that happen on the basis of list segmentation. My goal is to send a MailChimp campaign that is specific to the product that is purchased by the customer of the WP eStore. My initial plan was to embed a hidden ‘form’ field in the WP eStore plugin that would pass the data relating to item_name / item_id to MailChimp as a custom field. After discussing it with the MailChimp API support team they have told me that this is a limited approach because MailChimp only allows for up to 30 merge fields and if my product database grew too large then this option would not scale.
So, I learned about the ecommAddOrder MailChimp API function http://www.mailchimp.com/api/1.2/ecommaddorder.func.php. This function is specifically for processing product / e-commerce related data to the MailChimp database.
What I need to know is if you can show me where in the WP eStore plugin I can find the various functions that pass data to MailChimp via the API. We need to get in there and add a call to the ecommAddOrder function and insert the product name & id from WP eStore as the arrays ‘items($product_id,$product_name)’ so that this can be passed to the MailChimp list. Their MCAPI.class.php automatically integrates with MailChimp’s eCommerce 360 which extends the functionality of MailChimp to do product-specific (and many other variables) list segmentation.
So far I’ve found pieces of the relevant code in ‘eStore_auto_responder_handler.php’, ‘paypal.php’, ‘eStore_post_payment_processing_helper.php’,
Also, why was this code commented out in the current version? Isn’t a MailChimp API key required to make the API Calls?
<tr valign=”top”><td width=”25%” align=”left”>
MailChimp API Key:
<input name=”eStore_chimp_api_key” type=”text” size=”50″ value=”<?php echo get_option(‘eStore_chimp_api_key’); ?>”/>
<i>The API Key of your MailChimp account (can be found under the “Account” tab). If you do not have the API Key then you can use the username and password option below.</i>
<tr valign=”top”><td width=”25%” align=”left”>
Right now, the other MailChimp integration solutions are very limited, so if we can get this working it will add a VERY desirable functionality to the WP eStore plugin that should allow it to be listed as a “MailChimp Reccomended” plugin which I think would drive sales up!
Let me know… Thanks!
BrianMarch 20, 2010 at 12:56 am #18994
“why was this code commented out in the current version? Isn’t a MailChimp API key required to make the API Calls?”
You need a handle to the MailChimp API to make API calls. WP eStore gives two ways to do this… using the API Key or using the login details.
I have commented out the API Key option as some customers with older version of PHP was having issues with this option and it was becoming a support nightmare for me.
With that said, you will see the following line in “paypal.php” file:
$api = eStore_get_chimp_api();
The $api is your handle here.. just know that the “eStore_get_chimp_api” function will create this handle for you and you can start making api calls here.March 20, 2010 at 1:30 am #18995
Thanks so much Amin! Two things that I’m not clear on:
1) Since the API credentials were deprecated does that mean that you found a way to make API calls without an API key or do I need to remove the comment out and enable the pieces of code that were commented out?
2) What is the WP eStore specific function that returns the data for product_name. I think if I can get that from you the rest is on the MailChimp end as long as line 519 in ‘paypal.php’ is the only place I need to go in the WP eStore plugin to modify the MailChimp API call… is that right?March 20, 2010 at 1:39 am #18996March 20, 2010 at 8:04 am #18997
“using the API Key or using the login details.” – I meant you can uncomment the API part and use the API key path but at the moment eStore uses the “MailChimp” Login details to get hold of the API handle. This is why in the eStore’s settings menu you had to enter your “MailChimp” login details not API Key.
Modify around line 483 of “paypal.php” to add the product details to mailchimp. you can get the product name and id using the following:
$item_number = $current_cart_item['item_number'];
$item_name = $current_cart_item['item_name'];March 20, 2010 at 7:18 pm #18998
Thanks so much… I think I just figured out the correct way to do this, the way that you intended the plugin to work
Does the per-product auto-responder panel that is found under each item add them to a specific MailChimp list? Can I create a MailChimp list for each product and then do all of this without having to hack the back end of the code?March 21, 2010 at 1:09 am #18999
Yeah, if you want to sign up customers to different list on a per product basis then you need to specify the list name in the “Autoresponder” Section of the product and it will be accessible in the loop that I pointed to you earlier.
- You must be logged in to reply to this topic.