Mailchimp_Ecomm

The Mailchimp Subscription Form Mailchimp Ecomm class.

Defined (1)

The class is defined in the following location(s).

/classes/mailchimp/Mailchimp/Ecomm.php  
  1. class Mailchimp_Ecomm { 
  2. public function __construct(NM_Mailchimp $master) { 
  3. $this->master = $master; 
  4.  
  5. /** 
  6. * Import Ecommerce Order Information to be used for Segmentation. this will generally be used by ecommerce package plugins 
  7. <a href="http://connect.mailchimp.com/category/ecommerce" target="_blank">provided by us or by 3rd part system developers</a>. 
  8. * @param associative_array $order 
  9. * - id string the Order Id 
  10. * - campaign_id string optional the Campaign Id to track this order against (see the "mc_cid" query string variable a campaign passes) 
  11. * - email_id string optional (kind of) the Email Id of the subscriber we should attach this order to (see the "mc_eid" query string variable a campaign passes) - required if campaign_id is passed, otherwise either this or <strong>email</strong> is required. If both are provided, email_id takes precedence 
  12. * - email string optional (kind of) the Email Address we should attach this order to - either this or <strong>email_id</strong> is required. If both are provided, email_id takes precedence 
  13. * - total double The Order Total (ie, the full amount the customer ends up paying) 
  14. * - order_date string optional the date of the order - if this is not provided, we will default the date to now. Should be in the format of 2012-12-30 
  15. * - shipping double optional the total paid for Shipping Fees 
  16. * - tax double optional the total tax paid 
  17. * - store_id string a unique id for the store sending the order in (32 bytes max) 
  18. * - store_name string optional a "nice" name for the store - typically the base web address (ie, "store.mailchimp.com"). We will automatically update this if it changes (based on store_id) 
  19. * - items array structs for each individual line item including: 
  20. * - line_num int optional the line number of the item on the order. We will generate these if they are not passed 
  21. * - product_id int the store's internal Id for the product. Lines that do no contain this will be skipped 
  22. * - sku string optional the store's internal SKU for the product. (max 30 bytes) 
  23. * - product_name string the product name for the product_id associated with this item. We will auto update these as they change (based on product_id) (max 500 bytes) 
  24. * - category_id int (required) the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario 
  25. * - category_name string (required) the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc. 
  26. * - qty double optional the quantity of the item ordered - defaults to 1 
  27. * - cost double optional the cost of a single item (ie, not the extended cost of the line) - defaults to 0 
  28. * @return associative_array with a single entry: 
  29. * - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise. 
  30. */ 
  31. public function orderAdd($order) { 
  32. $_params = array("order" => $order); 
  33. return $this->master->call('ecomm/order-add', $_params); 
  34.  
  35. /** 
  36. * Delete Ecommerce Order Information used for segmentation. this will generally be used by ecommerce package plugins 
  37. <a href="/plugins/ecomm360.phtml">that we provide</a> or by 3rd part system developers. 
  38. * @param string $store_id 
  39. * @param string $order_id 
  40. * @return associative_array with a single entry: 
  41. * - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise. 
  42. */ 
  43. public function orderDel($store_id, $order_id) { 
  44. $_params = array("store_id" => $store_id, "order_id" => $order_id); 
  45. return $this->master->call('ecomm/order-del', $_params); 
  46.  
  47. /** 
  48. * Retrieve the Ecommerce Orders for an account 
  49. * @param string $cid 
  50. * @param int $start 
  51. * @param int $limit 
  52. * @param string $since 
  53. * @return associative_array the total matching orders and the specific orders for the requested page 
  54. * - total int the total matching orders 
  55. * - data array structs for each order being returned 
  56. * - store_id string the store id generated by the plugin used to uniquely identify a store 
  57. * - store_name string the store name collected by the plugin - often the domain name 
  58. * - order_id string the internal order id the store tracked this order by 
  59. * - email string the email address that received this campaign and is associated with this order 
  60. * - order_total double the order total 
  61. * - tax_total double the total tax for the order (if collected) 
  62. * - ship_total double the shipping total for the order (if collected) 
  63. * - order_date string the date the order was tracked - from the store if possible, otherwise the GMT time we received it 
  64. * - items array structs for each line item on this order.: 
  65. * - line_num int the line number 
  66. * - product_id int the product id 
  67. * - product_name string the product name 
  68. * - product_sku string the sku for the product 
  69. * - product_category_id int the category id for the product 
  70. * - product_category_name string the category name for the product 
  71. * - qty int the quantity ordered 
  72. * - cost double the cost of the item 
  73. */ 
  74. public function orders($cid=null, $start=0, $limit=100, $since=null) { 
  75. $_params = array("cid" => $cid, "start" => $start, "limit" => $limit, "since" => $since); 
  76. return $this->master->call('ecomm/orders', $_params); 
  77.