|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -require_once('fs_cleverreach_interface_rest_client.php'); |
4 |
| -require("../includes/application_top_export.php"); |
5 |
| -require("../inc/xtc_not_null.inc.php"); |
6 |
| -require("../inc/xtc_get_country_name.inc.php"); |
| 3 | +require_once 'fs_cleverreach_interface_rest_client.php'; |
| 4 | +require '../includes/application_top_export.php'; |
| 5 | +require '../inc/xtc_not_null.inc.php'; |
| 6 | +require '../inc/xtc_get_country_name.inc.php'; |
7 | 7 |
|
8 |
| -if(!defined('MODULE_FS_CLEVERREACH_INTERFACE_STATUS') || MODULE_FS_CLEVERREACH_INTERFACE_STATUS != 'true') |
| 8 | +if(!defined('MODULE_FS_CLEVERREACH_INTERFACE_STATUS') || MODULE_FS_CLEVERREACH_INTERFACE_STATUS != 'true') |
9 | 9 | {
|
10 | 10 | header('Location: ' . preg_replace("/[\r\n]+(.*)$/i", "", html_entity_decode($_SERVER['HTTP_REFERER'])));
|
11 | 11 | exit();
|
12 | 12 | }
|
13 | 13 |
|
14 |
| -if(!defined('MODULE_FS_CLEVERREACH_INTERFACE_CLIENT_ID') || !defined('MODULE_FS_CLEVERREACH_INTERFACE_USERNAME') || !defined('MODULE_FS_CLEVERREACH_INTERFACE_PASSWORD')) |
| 14 | +if(!defined('MODULE_FS_CLEVERREACH_INTERFACE_CLIENT_ID') || !defined('MODULE_FS_CLEVERREACH_INTERFACE_USERNAME') || !defined('MODULE_FS_CLEVERREACH_INTERFACE_PASSWORD')) |
15 | 15 | {
|
16 | 16 | header('Location: ' . preg_replace("/[\r\n]+(.*)$/i", "", html_entity_decode($_SERVER['HTTP_REFERER'])));
|
17 | 17 | exit();
|
|
51 | 51 |
|
52 | 52 | $manual_registered_customers = xtc_db_query("SELECT
|
53 | 53 | customers_id,
|
54 |
| - customers_email_address as email, |
| 54 | + customers_email_address as email, |
55 | 55 | date_added as registered,
|
56 |
| - customers_firstname as firstname, |
| 56 | + customers_firstname as firstname, |
57 | 57 | customers_lastname as lastname
|
58 | 58 | FROM " . TABLE_NEWSLETTER_RECIPIENTS . " WHERE mail_status = '1' ");
|
59 | 59 |
|
|
113 | 113 | }
|
114 | 114 | $order_rows = xtc_db_query("SELECT DISTINCT o.orders_id, o.customers_id, o.customers_email_address as email, o.customers_firstname as firstname, o.customers_lastname as lastname, o.customers_gender as gender, o.customers_street_address as street, o.customers_city as city, o.customers_postcode as zip, o.customers_country as country, o.date_purchased, op.products_id, op.products_name, op.products_price, op.products_quantity from " . TABLE_ORDERS . " o JOIN " . TABLE_ORDERS_PRODUCTS . " op ON o.orders_id = op.orders_id GROUP BY o.customers_id ORDER BY o.date_purchased ");
|
115 | 115 | while ($order_row = xtc_db_fetch_array($order_rows)) {
|
116 |
| - |
| 116 | + |
117 | 117 | $orders = array();
|
118 |
| - |
| 118 | + |
119 | 119 | $orders[] = array(
|
120 | 120 | "order_id" => $order_row["orders_id"], //required
|
121 | 121 | "product_id" => $order_row["products_id"], //optional
|
|
125 | 125 | "amount" => $order_row["products_quantity"], //optional
|
126 | 126 | "source" => STORE_NAME //optional
|
127 | 127 | );
|
128 |
| - |
| 128 | + |
129 | 129 | $flagged_customers = xtc_db_query(" SELECT c.customers_date_added as registered, c.customers_gender as gender, c.customers_dob as dob FROM " . TABLE_CUSTOMERS . " c WHERE c.customers_id = '" . $order_row["customers_id"] . "' " . $where_clause);
|
130 | 130 | $receivers = array('postdata' => array());
|
131 | 131 |
|
|
153 | 153 | if ($update_receivers) {
|
154 | 154 | $rest->delete("/groups.json/".$group_id."/receivers/".$order_row["email"]);
|
155 | 155 | }
|
156 |
| - |
| 156 | + |
157 | 157 | if (count($receivers) > 1000) {
|
158 | 158 | $rest->post("/groups.json/".$group_id."/receivers", $receivers);
|
159 | 159 | $receivers = array();
|
|
0 commit comments