import finished

This commit is contained in:
minic studio
2013-04-10 11:27:21 +03:00
parent 809a31fc5e
commit a8a7ebd0dc
+16 -17
View File
@@ -176,18 +176,10 @@ class MinicMailchimp extends Module
return; return;
} }
// Get customer to import // Get customers type
$all_customers = (Tools::getValue('all_user')) ? true : false; $all_customers = (Tools::getValue('all-user')) ? true : false;
// if(!Tools::isSubmit('all-user')){ // Get mailchimp fields
// $this->message = array('text' => $this->l('The type of Customers to import is required.'), 'type' => 'error');
// return;
// }else{
// $all_customers = true;
// }
// Get all fields
$fields = Tools::getValue('fields'); $fields = Tools::getValue('fields');
// Get Customers list // Get Customers list
$customers = Customer::getCustomers(); $customers = Customer::getCustomers();
@@ -198,12 +190,19 @@ class MinicMailchimp extends Module
$customer_details = new Customer($customer['id_customer']); $customer_details = new Customer($customer['id_customer']);
// populate customer array // populate customer array
// @TODO - kell ide ellenorzes hogy ha nem az osszes usert akarja csak a feliratkozokat if($all_customers){
$list[$customer_key]['EMAIL'] = $customer_details->email; $list[$customer_key]['EMAIL'] = $customer_details->email;
foreach ($fields[$list_id] as $key => $field) { foreach ($fields[$list_id] as $key => $field) {
// mailchimp tag = customer field // mailchimp tag = customer field
$list[$customer_key][$key] = $customer_details->$field; $list[$customer_key][$key] = $customer_details->$field;
} }
}else if(!$all_customers && $customer_details->newsletter){
$list[$customer_key]['EMAIL'] = $customer_details->email;
foreach ($fields[$list_id] as $key => $field) {
// mailchimp tag = customer field
$list[$customer_key][$key] = $customer_details->$field;
}
}
} }
$optin = (Tools::getValue('optin')) ? true : false; //yes, send optin emails $optin = (Tools::getValue('optin')) ? true : false; //yes, send optin emails