Skip to content

Commit

Permalink
Send customer data with order details.
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiagoebizmarts committed Jun 22, 2016
1 parent 5a06551 commit a1ae794
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/code/community/Ebizmarts/MailChimp/Model/Api/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ protected function GeneratePOSTPayload($order_from_collection)
"email_address" => $order->getCustomerEmail(),
"opt_in_status" => Ebizmarts_MailChimp_Model_Api_Customers::DEFAULT_OPT_IN
);
$billingAddress = $order->getBillingAddress();
$street = $billingAddress->getStreet();
$data["customer"]["first_name"] = $order->getCustomerFirstname();
$data["customer"]["last_name"] = $order->getCustomerLastname();
$data["customer"]["address"] = array(
"address1" => $street[0],
"address2" => count($street)>1 ? $street[1] : "",
"city" => $billingAddress->getCity(),
"province" => $billingAddress->getRegion() ? $billingAddress->getRegion() : "",
"province_code" => $billingAddress->getRegionCode() ? $billingAddress->getRegionCode() : "",
"postal_code" => $billingAddress->getPostcode(),
"country" => Mage::getModel('directory/country')->loadByCode($billingAddress->getCountry())->getName(),
"country_code" => $billingAddress->getCountry()
);
//company
if ($billingAddress->getCompany()) {
$data["customer"]["company"] = $billingAddress->getCompany();
}
}

$jsonData = "";
Expand Down

0 comments on commit a1ae794

Please sign in to comment.