Version Notes
Added Retention Score
Download this release
Release Info
Developer | Magento Core Team |
Extension | RetentionScience_Waves |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.7 to 2.1.0
- app/code/community/RetentionScience/Waves/.DS_Store +0 -0
- app/code/community/RetentionScience/Waves/Block/.DS_Store +0 -0
- app/code/community/RetentionScience/Waves/Block/Adminhtml/Syncbutton.php +25 -29
- app/code/community/RetentionScience/Waves/Model/Observer.php +43 -290
- app/code/community/RetentionScience/Waves/Model/retention_science_api.php +12 -61
- app/code/community/RetentionScience/Waves/Model/rs_send_orders.php +1 -0
- app/code/community/RetentionScience/Waves/Model/rs_send_products.php +2 -6
- app/code/community/RetentionScience/Waves/Model/rs_send_users.php +2 -1
- app/code/community/RetentionScience/Waves/Model/rs_sync_data.php +162 -0
- app/code/community/RetentionScience/Waves/controllers/AdminController.php +15 -0
- app/code/community/RetentionScience/Waves/controllers/IndexController.php +30 -72
- app/code/community/RetentionScience/Waves/etc/config.xml +23 -27
- app/code/community/RetentionScience/Waves/etc/system.xml +13 -109
- package.xml +5 -5
app/code/community/RetentionScience/Waves/.DS_Store
ADDED
Binary file
|
app/code/community/RetentionScience/Waves/Block/.DS_Store
ADDED
Binary file
|
app/code/community/RetentionScience/Waves/Block/Adminhtml/Syncbutton.php
CHANGED
@@ -2,39 +2,35 @@
|
|
2 |
|
3 |
|
4 |
class RetentionScience_Waves_Block_Adminhtml_Syncbutton
|
5 |
-
|
6 |
{
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
return $this->_getAddRowButtonHtml($link_url);
|
17 |
-
}
|
18 |
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
|
40 |
}
|
2 |
|
3 |
|
4 |
class RetentionScience_Waves_Block_Adminhtml_Syncbutton
|
5 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
6 |
{
|
7 |
|
8 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
9 |
+
{
|
10 |
+
$this->setElement($element);
|
11 |
+
$originalData = $element->getOriginalData();
|
12 |
+
$action = $originalData['rs_button_url'];
|
13 |
+
$link_url = $this->_getLink($action);
|
14 |
+
return $this->_getAddRowButtonHtml($link_url);
|
15 |
+
}
|
|
|
|
|
16 |
|
17 |
|
18 |
+
protected function _getAddRowButtonHtml($link_url)
|
19 |
+
{
|
20 |
+
$title = "Run Now";
|
21 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
22 |
+
->setType('button')
|
23 |
+
->setClass('run_now_button')
|
24 |
+
->setLabel($title)
|
25 |
+
//$this->__('Add')
|
26 |
+
->setOnClick("location.href='$link_url';")
|
27 |
+
->setDisabled(false)
|
28 |
+
->toHtml();
|
29 |
+
}
|
|
|
30 |
|
31 |
+
protected function _getLink($action){
|
32 |
+
$baseurl = Mage::app()->getStore()->getBaseUrl();
|
33 |
+
return Mage::helper('adminhtml')->getUrl("waves/admin/$action");
|
34 |
+
}
|
|
|
35 |
|
36 |
}
|
app/code/community/RetentionScience/Waves/Model/Observer.php
CHANGED
@@ -18,269 +18,6 @@ class RetentionScience_Waves_Model_Observer
|
|
18 |
protected $logToFile = false;
|
19 |
protected $elementsPerPage = 2000;
|
20 |
protected $apiClient;
|
21 |
-
public function sendCategory(){
|
22 |
-
$categoryProcessStatus = Mage::getStoreConfig('waves/rs_sync_settings/category_process_status');
|
23 |
-
if(stristr($categoryProcessStatus, "running")){
|
24 |
-
return false;
|
25 |
-
}
|
26 |
-
try {
|
27 |
-
$timestamp = date("YmdHis");
|
28 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/category_process_status', '[running] started at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
29 |
-
$categorytree = Mage::getModel('waves/source_categorytree')->getAllOptions();
|
30 |
-
|
31 |
-
foreach($categorytree as $category){
|
32 |
-
$parentId = ($category->getParentId())?$category->getParentId():null;
|
33 |
-
$categoryId = $category->getEntityId();
|
34 |
-
$categoryName = $category->getName();
|
35 |
-
$categoryDescription = $category->getDescripton();
|
36 |
-
$category_array = array('name' => $categoryName, 'description' => $categoryDescription, 'parent_record_id' => $parentId);
|
37 |
-
if ($this->sendBulkUpload()){
|
38 |
-
$this->writeBulkUploadFile(array($categoryId => $category_array), 'categories', $timestamp);
|
39 |
-
} else {
|
40 |
-
$this->getRetentionScienceApiClient()->update_category($categoryId, $category_array);
|
41 |
-
}
|
42 |
-
}
|
43 |
-
if ($this->sendBulkUpload()){
|
44 |
-
$this->sendBulkUploadFile('categories', $timestamp);
|
45 |
-
}
|
46 |
-
} catch (Exception $e){
|
47 |
-
Mage::logException($e);
|
48 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/category_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
49 |
-
}
|
50 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/category_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
51 |
-
}
|
52 |
-
|
53 |
-
public function sendProduct(){
|
54 |
-
global $last_processed_product_entity_id;
|
55 |
-
$timestamp = date("YmdHis");
|
56 |
-
$productProcessStatus = Mage::getStoreConfig('waves/rs_sync_settings/product_process_status');
|
57 |
-
if(stristr($productProcessStatus, "running")){
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
try{
|
61 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/product_process_status', '[running] started at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
62 |
-
$productCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
63 |
-
|
64 |
-
# How many do we have to send? - Don't use count()
|
65 |
-
$num_products_to_send = $productCollection->getSize();
|
66 |
-
|
67 |
-
if ($this->sendBulkUpload()){
|
68 |
-
if ($this->useExec()){
|
69 |
-
$phpbin = $this->getPhpBin();
|
70 |
-
$store_id = Mage::app()->getStore()->getCode();
|
71 |
-
$send_products_script = dirname(__FILE__) . "/rs_send_products.php";
|
72 |
-
$send_products_script = escapeshellarg($send_products_script);
|
73 |
-
|
74 |
-
|
75 |
-
$pages = ceil($num_products_to_send / $this->elementsPerPage());
|
76 |
-
echo "Pages: $pages \n";
|
77 |
-
|
78 |
-
$page_counter = 1;
|
79 |
-
while($page_counter <= $pages){
|
80 |
-
$cmd = "$phpbin $send_products_script $store_id $timestamp $page_counter $last_processed_product_entity_id";
|
81 |
-
$output = array();
|
82 |
-
$return_val = null;
|
83 |
-
exec($cmd, $output, $return_val);
|
84 |
-
$last_processed_user_entity_id = $output[0];
|
85 |
-
|
86 |
-
if ($return_val != 0){
|
87 |
-
var_dump($output);
|
88 |
-
throw new Exception('Send products script returned with non-zero return code.');
|
89 |
-
}
|
90 |
-
$page_counter = $page_counter + 1;
|
91 |
-
}
|
92 |
-
} else {
|
93 |
-
// bulk upload but do not use exec
|
94 |
-
foreach($productCollection as $product){
|
95 |
-
$this->productCallback(array('product_id' => $product->getId(), 'timestamp' => $timestamp));
|
96 |
-
}
|
97 |
-
}
|
98 |
-
$this->sendBulkUploadFile('items', $timestamp);
|
99 |
-
// end if($this->sendBulkUpload())
|
100 |
-
|
101 |
-
} else {
|
102 |
-
// send one at a time - not using sendBulkUpload()
|
103 |
-
foreach($productCollection as $product){
|
104 |
-
$this->productCallback(array('product_id' => $product->getId(), 'timestamp' => $timestamp));
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
catch (Exception $e){
|
109 |
-
Mage::logException($e);
|
110 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/product_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
111 |
-
}
|
112 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/product_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
113 |
-
}
|
114 |
-
|
115 |
-
public function sendUser(){
|
116 |
-
$timestamp = date("YmdHis");
|
117 |
-
$phpbin = $this->getPhpBin();
|
118 |
-
|
119 |
-
$userProcessStatus = Mage::getStoreConfig('waves/rs_sync_settings/user_process_status');
|
120 |
-
if(stristr($userProcessStatus, "running") ){
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
try {
|
124 |
-
$last_user_record_id = Mage::getStoreConfig('waves/rs_sync_advanced/last_user_record_id');
|
125 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/user_process_status', '[running] started at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
126 |
-
$userCollection = Mage::getModel('customer/customer')
|
127 |
-
->getCollection()
|
128 |
-
->addAttributeToSelect('name')
|
129 |
-
->addAttributeToSelect('*')
|
130 |
-
|
131 |
-
;
|
132 |
-
$last_user_record_id = (int) $last_user_record_id;
|
133 |
-
global $last_processed_user_entity_id;
|
134 |
-
$last_processed_user_entity_id = $last_user_record_id;
|
135 |
-
|
136 |
-
if($last_user_record_id>0){
|
137 |
-
$userCollection->addFieldToFilter('entity_id', array('gt'=>$last_user_record_id));
|
138 |
-
}
|
139 |
-
|
140 |
-
# How many do we have to send? - Don't use count()
|
141 |
-
$num_users_to_send = $userCollection->getSize();
|
142 |
-
// echo "Number of users to send: $num_users_to_send \n";
|
143 |
-
|
144 |
-
if ($this->sendBulkUpload()){
|
145 |
-
if ($this->useExec()){
|
146 |
-
$store_id = Mage::app()->getStore()->getCode();
|
147 |
-
$pages = ceil($num_users_to_send / $this->elementsPerPage());
|
148 |
-
// echo "Pages: $pages \n";
|
149 |
-
|
150 |
-
$page_counter = 1;
|
151 |
-
while($page_counter <= $pages){
|
152 |
-
// CALL SCRIPT - saves memory
|
153 |
-
$send_users_script = dirname(__FILE__) . "/rs_send_users.php";
|
154 |
-
$send_users_script = escapeshellarg($send_users_script);
|
155 |
-
$cmd = "$phpbin $send_users_script $store_id $timestamp $page_counter $last_user_record_id";
|
156 |
-
$output = array();
|
157 |
-
$return_val = null;
|
158 |
-
exec($cmd, $output, $return_val);
|
159 |
-
$last_processed_user_entity_id = $output[0];
|
160 |
-
# Store back to config
|
161 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_user_record_id', $last_processed_user_entity_id);
|
162 |
-
if ($return_val != 0){
|
163 |
-
var_dump($output);
|
164 |
-
throw new Exception('Send users script returned with non-zero return code.');
|
165 |
-
}
|
166 |
-
$page_counter = $page_counter + 1;
|
167 |
-
}
|
168 |
-
} else {
|
169 |
-
// bulk upload but do not use exec
|
170 |
-
foreach($userCollection as $user){
|
171 |
-
$this->userCallback(array('user_record_id' => $user->getEntityId(), 'timestamp' => $timestamp));
|
172 |
-
$last_processed_user_entity_id = $this->get_last_processed_user_entity_id();
|
173 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_user_record_id', $last_processed_user_entity_id);
|
174 |
-
}
|
175 |
-
}
|
176 |
-
$this->sendBulkUploadFile('users', $timestamp);
|
177 |
-
|
178 |
-
} else {
|
179 |
-
// send one at a time - not using sendBulkUpload()
|
180 |
-
foreach($userCollection as $user){
|
181 |
-
$this->userCallback(array('user_record_id' => $user->getEntityId(), 'timestamp' => $timestamp));
|
182 |
-
$last_processed_user_entity_id = $this->get_last_processed_user_entity_id();
|
183 |
-
# Store back to config
|
184 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_user_record_id', $last_processed_user_entity_id);
|
185 |
-
}
|
186 |
-
}
|
187 |
-
} catch (Exception $e){
|
188 |
-
Mage::logException($e);
|
189 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/user_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
190 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_user_record_id', $last_processed_user_entity_id);
|
191 |
-
}
|
192 |
-
|
193 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/user_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
194 |
-
}
|
195 |
-
|
196 |
-
public function sendOrder(){
|
197 |
-
$timestamp = date("YmdHis");
|
198 |
-
$phpbin = $this->getPhpBin();
|
199 |
-
|
200 |
-
$orderProcessStatus = Mage::getStoreConfig('waves/rs_sync_settings/order_process_status');
|
201 |
-
if(stristr($orderProcessStatus, "running")){
|
202 |
-
return false;
|
203 |
-
}
|
204 |
-
try{
|
205 |
-
$last_order_record_id = Mage::getStoreConfig('waves/rs_sync_advanced/last_order_record_id');
|
206 |
-
|
207 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/order_process_status', '[running] started at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
208 |
-
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
209 |
-
|
210 |
-
$last_order_record_id = (int) $last_order_record_id;
|
211 |
-
if($last_order_record_id>0){
|
212 |
-
$orderCollection->addFieldToFilter('entity_id', array('gt'=>$last_order_record_id));
|
213 |
-
}
|
214 |
-
|
215 |
-
# this will be updated as we iterate
|
216 |
-
global $last_processed_order_record_id;
|
217 |
-
$last_processed_order_record_id = $last_order_record_id;
|
218 |
-
|
219 |
-
# How many do we have to send?
|
220 |
-
// Don't use count()
|
221 |
-
$num_orders_to_send = $orderCollection->getSize();
|
222 |
-
// echo "Number of orders to send: $num_orders_to_send \n";
|
223 |
-
|
224 |
-
if ($this->sendBulkUpload()){
|
225 |
-
if ($this->useExec()){
|
226 |
-
$store_id = Mage::app()->getStore()->getCode();
|
227 |
-
$pages = ceil($num_orders_to_send / $this->elementsPerPage());
|
228 |
-
echo "Pages: $pages \n";
|
229 |
-
$send_orders_script = dirname(__FILE__) . "/rs_send_orders.php";
|
230 |
-
$send_orders_script = escapeshellarg($send_orders_script);
|
231 |
-
|
232 |
-
##### SEND ORDER
|
233 |
-
$page_counter = 1;
|
234 |
-
while($page_counter <= $pages){
|
235 |
-
// $orderCollectionWalker = Mage::getSingleton('core/resource_iterator')->walk($orderCollection->getSelect(),
|
236 |
-
// array(array($this, 'orderCallback')),
|
237 |
-
// array('timestamp' => $timestamp));
|
238 |
-
|
239 |
-
// CALL SCRIPT - saves memory
|
240 |
-
|
241 |
-
$cmd = "$phpbin $send_orders_script $store_id $timestamp $page_counter $last_order_record_id";
|
242 |
-
$output = array();
|
243 |
-
$return_val = null;
|
244 |
-
exec($cmd, $output, $return_val);
|
245 |
-
$last_processed_order_record_id = $output[0];
|
246 |
-
# Store back to config
|
247 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_order_record_id', $last_processed_order_record_id);
|
248 |
-
if ($return_val != 0){
|
249 |
-
var_dump($output);
|
250 |
-
throw new Exception('Send orders script returned with non-zero return code.');
|
251 |
-
}
|
252 |
-
$page_counter = $page_counter + 1;
|
253 |
-
}
|
254 |
-
} else {
|
255 |
-
// bulk upload but do not use exec
|
256 |
-
foreach($orderCollection as $order){
|
257 |
-
$this->orderCallback(array('order_record_id' => $order->getEntityId(), 'timestamp' => $timestamp));
|
258 |
-
$last_processed_order_record_id = $this->get_last_processed_order_record_id();
|
259 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_order_record_id', $last_processed_order_record_id);
|
260 |
-
}
|
261 |
-
}
|
262 |
-
$this->sendBulkUploadFile('orders_users', $timestamp);
|
263 |
-
$this->sendBulkUploadFile('orders', $timestamp);
|
264 |
-
|
265 |
-
} else {
|
266 |
-
// send one at a time - not using sendBulkUpload()
|
267 |
-
foreach($orderCollection as $order){
|
268 |
-
$this->orderCallback(array('order_record_id' => $order->getEntityId(), 'timestamp' => $timestamp));
|
269 |
-
$last_processed_order_record_id = $this->get_last_processed_order_record_id();
|
270 |
-
# Store back to config
|
271 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_order_record_id', $last_processed_order_record_id);
|
272 |
-
}
|
273 |
-
}
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
} catch(Exception $e) {
|
278 |
-
Mage::logException($e);
|
279 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/order_process_status', '[stopped] last run at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
280 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_order_record_id', $last_processed_order_record_id);
|
281 |
-
}
|
282 |
-
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/order_process_status', '[stopped] last run at: '. date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
283 |
-
}
|
284 |
|
285 |
public function getRetentionScienceApiClient(){
|
286 |
if(!$this->apiClient){
|
@@ -292,6 +29,7 @@ class RetentionScience_Waves_Model_Observer
|
|
292 |
}
|
293 |
return $this->apiClient;
|
294 |
}
|
|
|
295 |
public function getPhpBin(){
|
296 |
$php_bin = Mage::getStoreConfig('waves/rs_sync_advanced/rs_php_bin');
|
297 |
if ($php_bin == NULL){
|
@@ -300,9 +38,11 @@ class RetentionScience_Waves_Model_Observer
|
|
300 |
// echo "PHP_BIN is [ $php_bin ] \n";
|
301 |
return $php_bin;
|
302 |
}
|
|
|
303 |
public function logToFile(){
|
304 |
return $this->logToFile;
|
305 |
}
|
|
|
306 |
public function sendBulkUpload(){
|
307 |
$send_bulk_upload = Mage::getStoreConfig('waves/rs_sync_advanced/rs_send_bulk_upload');
|
308 |
if ($send_bulk_upload == NULL){
|
@@ -311,6 +51,7 @@ class RetentionScience_Waves_Model_Observer
|
|
311 |
// echo "send_bulk_upload is [ $send_bulk_upload ] \n";
|
312 |
return $send_bulk_upload;
|
313 |
}
|
|
|
314 |
public function useBulkCompression(){
|
315 |
$use_bulk_compression = Mage::getStoreConfig('waves/rs_sync_advanced/rs_use_bulk_compression');
|
316 |
if ($use_bulk_compression == NULL){
|
@@ -318,9 +59,11 @@ class RetentionScience_Waves_Model_Observer
|
|
318 |
}
|
319 |
return $use_bulk_compression;
|
320 |
}
|
|
|
321 |
public function elementsPerPage(){
|
322 |
return $this->elementsPerPage;
|
323 |
}
|
|
|
324 |
public function useExec(){
|
325 |
$use_exec = Mage::getStoreConfig('waves/rs_sync_advanced/rs_bulk_use_exec');
|
326 |
if ($use_exec == NULL){
|
@@ -329,23 +72,28 @@ class RetentionScience_Waves_Model_Observer
|
|
329 |
//echo "use_exec is [ $use_exec ] \n";
|
330 |
return $use_exec;
|
331 |
}
|
|
|
332 |
public function writeToLog($msg, $category){
|
333 |
$msg = $msg . "\n";
|
334 |
$file = dirname(__FILE__) . '/retention_science_'. $category.'.log';
|
335 |
file_put_contents($file, $msg, FILE_APPEND);
|
336 |
}
|
|
|
337 |
public function get_last_processed_order_record_id(){
|
338 |
global $last_processed_order_record_id;
|
339 |
return $last_processed_order_record_id;
|
340 |
}
|
|
|
341 |
public function get_last_processed_user_entity_id(){
|
342 |
global $last_processed_user_entity_id;
|
343 |
return $last_processed_user_entity_id;
|
344 |
}
|
|
|
345 |
public function get_last_processed_product_entity_id(){
|
346 |
global $last_processed_product_entity_id;
|
347 |
return $last_processed_product_entity_id;
|
348 |
}
|
|
|
349 |
public function writeBulkUploadFile($entity_hash, $category, $timestamp){
|
350 |
$tmp_base = Mage::getBaseDir('tmp');
|
351 |
|
@@ -354,40 +102,39 @@ class RetentionScience_Waves_Model_Observer
|
|
354 |
$file = $tmp_base . '/rs_bulk_'. $category.'_'.$timestamp.'.log';
|
355 |
file_put_contents($file, $msg, FILE_APPEND);
|
356 |
}
|
357 |
-
|
|
|
358 |
$tmp_base = Mage::getBaseDir('tmp');
|
359 |
-
//$file = dirname(__FILE__) . '/rs_bulk_'. $category.'_'.$timestamp.'.log';
|
360 |
-
$file = $tmp_base . '/rs_bulk_'. $category.'_'.$timestamp.'.log';
|
361 |
|
362 |
-
|
363 |
-
$
|
364 |
-
|
365 |
-
|
366 |
-
$
|
367 |
-
|
368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
}
|
370 |
-
$file_to_send = ($gzfile == null) ? $file : $gzfile;
|
371 |
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
$this->getRetentionScienceApiClient()->upload_users_bulk_file($file_to_send);
|
381 |
-
}
|
382 |
-
// delete the file after sending
|
383 |
-
if($this->removeFileAfterSend){
|
384 |
-
unlink($file);
|
385 |
-
if ($gzfile != null){
|
386 |
-
unlink($gzfile);
|
387 |
-
}
|
388 |
}
|
389 |
}
|
390 |
}
|
|
|
391 |
public function productCallback($args){
|
392 |
|
393 |
global $last_processed_product_entity_id;
|
@@ -753,4 +500,10 @@ class RetentionScience_Waves_Model_Observer
|
|
753 |
Mage::getModel('core/config')->saveConfig('waves/calculated_rscore_json', $rscore_json);
|
754 |
return $rscore_json;
|
755 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
756 |
}
|
18 |
protected $logToFile = false;
|
19 |
protected $elementsPerPage = 2000;
|
20 |
protected $apiClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
public function getRetentionScienceApiClient(){
|
23 |
if(!$this->apiClient){
|
29 |
}
|
30 |
return $this->apiClient;
|
31 |
}
|
32 |
+
|
33 |
public function getPhpBin(){
|
34 |
$php_bin = Mage::getStoreConfig('waves/rs_sync_advanced/rs_php_bin');
|
35 |
if ($php_bin == NULL){
|
38 |
// echo "PHP_BIN is [ $php_bin ] \n";
|
39 |
return $php_bin;
|
40 |
}
|
41 |
+
|
42 |
public function logToFile(){
|
43 |
return $this->logToFile;
|
44 |
}
|
45 |
+
|
46 |
public function sendBulkUpload(){
|
47 |
$send_bulk_upload = Mage::getStoreConfig('waves/rs_sync_advanced/rs_send_bulk_upload');
|
48 |
if ($send_bulk_upload == NULL){
|
51 |
// echo "send_bulk_upload is [ $send_bulk_upload ] \n";
|
52 |
return $send_bulk_upload;
|
53 |
}
|
54 |
+
|
55 |
public function useBulkCompression(){
|
56 |
$use_bulk_compression = Mage::getStoreConfig('waves/rs_sync_advanced/rs_use_bulk_compression');
|
57 |
if ($use_bulk_compression == NULL){
|
59 |
}
|
60 |
return $use_bulk_compression;
|
61 |
}
|
62 |
+
|
63 |
public function elementsPerPage(){
|
64 |
return $this->elementsPerPage;
|
65 |
}
|
66 |
+
|
67 |
public function useExec(){
|
68 |
$use_exec = Mage::getStoreConfig('waves/rs_sync_advanced/rs_bulk_use_exec');
|
69 |
if ($use_exec == NULL){
|
72 |
//echo "use_exec is [ $use_exec ] \n";
|
73 |
return $use_exec;
|
74 |
}
|
75 |
+
|
76 |
public function writeToLog($msg, $category){
|
77 |
$msg = $msg . "\n";
|
78 |
$file = dirname(__FILE__) . '/retention_science_'. $category.'.log';
|
79 |
file_put_contents($file, $msg, FILE_APPEND);
|
80 |
}
|
81 |
+
|
82 |
public function get_last_processed_order_record_id(){
|
83 |
global $last_processed_order_record_id;
|
84 |
return $last_processed_order_record_id;
|
85 |
}
|
86 |
+
|
87 |
public function get_last_processed_user_entity_id(){
|
88 |
global $last_processed_user_entity_id;
|
89 |
return $last_processed_user_entity_id;
|
90 |
}
|
91 |
+
|
92 |
public function get_last_processed_product_entity_id(){
|
93 |
global $last_processed_product_entity_id;
|
94 |
return $last_processed_product_entity_id;
|
95 |
}
|
96 |
+
|
97 |
public function writeBulkUploadFile($entity_hash, $category, $timestamp){
|
98 |
$tmp_base = Mage::getBaseDir('tmp');
|
99 |
|
102 |
$file = $tmp_base . '/rs_bulk_'. $category.'_'.$timestamp.'.log';
|
103 |
file_put_contents($file, $msg, FILE_APPEND);
|
104 |
}
|
105 |
+
|
106 |
+
public function sendDataSyncFiles($timestamp) {
|
107 |
$tmp_base = Mage::getBaseDir('tmp');
|
|
|
|
|
108 |
|
109 |
+
$types = array("categories", "items", "users", "orders", "orders_users");
|
110 |
+
$files = array();
|
111 |
+
$gzfiles = array();
|
112 |
+
foreach ($types as $type) {
|
113 |
+
$file = $tmp_base . '/rs_bulk_'. $type.'_'.$timestamp.'.log';
|
114 |
+
if (file_exists($file)) {
|
115 |
+
$files[$type] = $file;
|
116 |
+
if ($this->useBulkCompression()) {
|
117 |
+
$gzfile = $file . ".gz";
|
118 |
+
$fp = gzopen($gzfile, 'wb');
|
119 |
+
gzwrite($fp, file_get_contents($file));
|
120 |
+
gzclose($fp);
|
121 |
+
$gzfiles[$type] = $gzfile;
|
122 |
+
}
|
123 |
+
}
|
124 |
}
|
|
|
125 |
|
126 |
+
$files_to_send = (count($gzfiles) > 0) ? $gzfiles : $files;
|
127 |
+
|
128 |
+
if (count($files_to_send) > 0) {
|
129 |
+
$this->getRetentionScienceApiClient()->sync_data($files_to_send);
|
130 |
+
|
131 |
+
if ($this->removeFileAfterSend) {
|
132 |
+
array_map("unlink", array_values($files));
|
133 |
+
array_map("unlink", array_values($gzfiles));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
}
|
136 |
}
|
137 |
+
|
138 |
public function productCallback($args){
|
139 |
|
140 |
global $last_processed_product_entity_id;
|
500 |
Mage::getModel('core/config')->saveConfig('waves/calculated_rscore_json', $rscore_json);
|
501 |
return $rscore_json;
|
502 |
}
|
503 |
+
|
504 |
+
public function syncData() {
|
505 |
+
$phpbin = $this->getPhpBin();
|
506 |
+
$send_products_script = escapeshellarg(dirname(__FILE__) . "/rs_sync_data.php");
|
507 |
+
exec("$phpbin $send_products_script > /dev/null &");
|
508 |
+
}
|
509 |
}
|
app/code/community/RetentionScience/Waves/Model/retention_science_api.php
CHANGED
@@ -153,23 +153,6 @@ class RetentionScienceApi {
|
|
153 |
return json_decode($this->handle_response($response), true);
|
154 |
}
|
155 |
|
156 |
-
// user_array is an assoc. array:
|
157 |
-
// email, full_name, address1, address2, city, state
|
158 |
-
// zip, country, phone, birth_year, gender, ip_address,
|
159 |
-
// number_logons, account_created_on, last_logon_at
|
160 |
-
public function update_user($record_id, $user_array) {
|
161 |
-
$url = 'users/update/' . urlencode($record_id);
|
162 |
-
$response = $this->perform_call($url, array('user' => json_encode($user_array)), true, true);
|
163 |
-
return $this->handle_response($response);
|
164 |
-
}
|
165 |
-
public function upload_users_bulk_file($filename){
|
166 |
-
$url = 'users/upload_bulk_file';
|
167 |
-
$response = $this->perform_call($url, array('file_name' => basename($filename),
|
168 |
-
'file' => "@".$filename), true, true);
|
169 |
-
return $this->handle_response($response);
|
170 |
-
}
|
171 |
-
|
172 |
-
|
173 |
/* Orders resource */
|
174 |
public function get_last_order_record_id() {
|
175 |
$url = 'orders/last_record_id';
|
@@ -182,20 +165,6 @@ class RetentionScienceApi {
|
|
182 |
$response = $this->perform_call($url, array(), true, false);
|
183 |
return json_decode($this->handle_response($response), true);
|
184 |
}
|
185 |
-
|
186 |
-
// order_array is an assoc. array:
|
187 |
-
// user_record_id, total_price, discount_amount, ordered_at, payment_method, order_items
|
188 |
-
public function update_order($record_id, $order_array) {
|
189 |
-
$url = 'orders/update/' . urlencode($record_id);
|
190 |
-
$response = $this->perform_call($url, array('order' => json_encode($order_array)), true, true);
|
191 |
-
return $this->handle_response($response);
|
192 |
-
}
|
193 |
-
public function upload_orders_bulk_file($filename){
|
194 |
-
$url = 'orders/upload_bulk_file';
|
195 |
-
$response = $this->perform_call($url, array('file_name' => basename($filename),
|
196 |
-
'file' => "@".$filename), true, true);
|
197 |
-
return $this->handle_response($response);
|
198 |
-
}
|
199 |
|
200 |
/* Items resource */
|
201 |
public function show_item($record_id) {
|
@@ -203,21 +172,6 @@ class RetentionScienceApi {
|
|
203 |
$response = $this->perform_call($url, array(), true, false);
|
204 |
return json_decode($this->handle_response($response), true);
|
205 |
}
|
206 |
-
// item_array is an assoc. array:
|
207 |
-
// name, manufacturer, model, quantity, price,
|
208 |
-
// active, image_list, categories
|
209 |
-
public function update_item($record_id, $item_array) {
|
210 |
-
$url = 'items/update/' . urlencode($record_id);
|
211 |
-
$response = $this->perform_call($url, array('item' => json_encode($item_array)), true, true);
|
212 |
-
return $this->handle_response($response);
|
213 |
-
}
|
214 |
-
public function upload_items_bulk_file($filename){
|
215 |
-
$url = 'items/upload_bulk_file';
|
216 |
-
$response = $this->perform_call($url, array('file_name' => basename($filename),
|
217 |
-
'file' => "@".$filename), true, true);
|
218 |
-
return $this->handle_response($response);
|
219 |
-
}
|
220 |
-
|
221 |
|
222 |
/* Categories resource */
|
223 |
public function show_category($record_id) {
|
@@ -225,20 +179,6 @@ class RetentionScienceApi {
|
|
225 |
$response = $this->perform_call($url, array(), true, false);
|
226 |
return json_decode($this->handle_response($response), true);
|
227 |
}
|
228 |
-
// category_array is an assoc. array:
|
229 |
-
// name, description, parent_record_id
|
230 |
-
public function update_category($record_id, $category_array) {
|
231 |
-
$url = 'categories/update/' . urlencode($record_id);
|
232 |
-
$response = $this->perform_call($url, array('category' => json_encode($category_array)), true, true);
|
233 |
-
return $this->handle_response($response);
|
234 |
-
}
|
235 |
-
public function upload_categories_bulk_file($filename){
|
236 |
-
$url = 'categories/upload_bulk_file';
|
237 |
-
$response = $this->perform_call($url, array('file_name' => basename($filename),
|
238 |
-
'file' => "@".$filename), true, true);
|
239 |
-
return $this->handle_response($response);
|
240 |
-
}
|
241 |
-
|
242 |
|
243 |
/* RScore resource */
|
244 |
public function calculate_rscore($rscore_data_array) {
|
@@ -247,7 +187,18 @@ class RetentionScienceApi {
|
|
247 |
return $this->handle_response($response);
|
248 |
}
|
249 |
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
|
253 |
|
153 |
return json_decode($this->handle_response($response), true);
|
154 |
}
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
/* Orders resource */
|
157 |
public function get_last_order_record_id() {
|
158 |
$url = 'orders/last_record_id';
|
165 |
$response = $this->perform_call($url, array(), true, false);
|
166 |
return json_decode($this->handle_response($response), true);
|
167 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
/* Items resource */
|
170 |
public function show_item($record_id) {
|
172 |
$response = $this->perform_call($url, array(), true, false);
|
173 |
return json_decode($this->handle_response($response), true);
|
174 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
/* Categories resource */
|
177 |
public function show_category($record_id) {
|
179 |
$response = $this->perform_call($url, array(), true, false);
|
180 |
return json_decode($this->handle_response($response), true);
|
181 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
/* RScore resource */
|
184 |
public function calculate_rscore($rscore_data_array) {
|
187 |
return $this->handle_response($response);
|
188 |
}
|
189 |
|
190 |
+
/* Data Sync */
|
191 |
+
public function sync_data($file_hash) {
|
192 |
+
$url = 'bulk_import/import';
|
193 |
+
|
194 |
+
$upload_files = array();
|
195 |
+
foreach ($file_hash as $type => $file) {
|
196 |
+
$upload_files[$type] = "@$file";
|
197 |
+
}
|
198 |
+
|
199 |
+
$response = $this->perform_call($url, $upload_files, true, true);
|
200 |
+
return $this->handle_response($response);
|
201 |
+
}
|
202 |
}
|
203 |
|
204 |
|
app/code/community/RetentionScience/Waves/Model/rs_send_orders.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
define('MAGENTO', realpath(dirname(__FILE__)));
|
4 |
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
|
|
6 |
|
7 |
|
8 |
//umask(0);
|
3 |
define('MAGENTO', realpath(dirname(__FILE__)));
|
4 |
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
6 |
+
// require_once '/Applications/MAMP/htdocs/magento/app/Mage.php';
|
7 |
|
8 |
|
9 |
//umask(0);
|
app/code/community/RetentionScience/Waves/Model/rs_send_products.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
define('MAGENTO', dirname(__FILE__));
|
4 |
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
|
|
6 |
|
7 |
//umask(0);
|
8 |
|
@@ -10,12 +11,11 @@ require_once MAGENTO . '/../../../../../../app/Mage.php';
|
|
10 |
$store_id = $argv[1];
|
11 |
$timestamp = $argv[2];
|
12 |
$page_counter = $argv[3];
|
13 |
-
$last_product_record_id = $argv[4];
|
14 |
|
15 |
// Mage_Core_Model_App::ADMIN_STORE_ID
|
16 |
Mage::app()->setCurrentStore($store_id);
|
17 |
|
18 |
-
$msg = "Running
|
19 |
|
20 |
$observer = new RetentionScience_Waves_Model_Observer();
|
21 |
$elements_per_page = $observer->elementsPerPage();
|
@@ -23,10 +23,6 @@ $elements_per_page = $observer->elementsPerPage();
|
|
23 |
$productCollection = Mage::getModel('catalog/product')->getCollection();
|
24 |
$productCollection->addAttributeToSelect('entity_id')->addAttributeToSelect('*');
|
25 |
|
26 |
-
if($last_product_record_id>0){
|
27 |
-
$productCollection->addFieldToFilter('entity_id', array('gt'=>$last_product_record_id));
|
28 |
-
}
|
29 |
-
|
30 |
$productCollection->setPage($page_counter, $elements_per_page);
|
31 |
|
32 |
try {
|
3 |
define('MAGENTO', dirname(__FILE__));
|
4 |
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
6 |
+
// require_once '/Applications/MAMP/htdocs/magento/app/Mage.php';
|
7 |
|
8 |
//umask(0);
|
9 |
|
11 |
$store_id = $argv[1];
|
12 |
$timestamp = $argv[2];
|
13 |
$page_counter = $argv[3];
|
|
|
14 |
|
15 |
// Mage_Core_Model_App::ADMIN_STORE_ID
|
16 |
Mage::app()->setCurrentStore($store_id);
|
17 |
|
18 |
+
// $msg = "Running rs_send_products.php with arguments $store_id $timestamp $page_counter \n";
|
19 |
|
20 |
$observer = new RetentionScience_Waves_Model_Observer();
|
21 |
$elements_per_page = $observer->elementsPerPage();
|
23 |
$productCollection = Mage::getModel('catalog/product')->getCollection();
|
24 |
$productCollection->addAttributeToSelect('entity_id')->addAttributeToSelect('*');
|
25 |
|
|
|
|
|
|
|
|
|
26 |
$productCollection->setPage($page_counter, $elements_per_page);
|
27 |
|
28 |
try {
|
app/code/community/RetentionScience/Waves/Model/rs_send_users.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
define('MAGENTO', realpath(dirname(__FILE__)));
|
4 |
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
|
|
6 |
|
7 |
|
8 |
//umask(0);
|
@@ -15,7 +16,7 @@ $last_user_record_id = $argv[4];
|
|
15 |
Mage::app()->setCurrentStore($store_id);
|
16 |
|
17 |
|
18 |
-
#echo "Running
|
19 |
|
20 |
$observer = new RetentionScience_Waves_Model_Observer();
|
21 |
$elements_per_page = $observer->elementsPerPage();
|
3 |
define('MAGENTO', realpath(dirname(__FILE__)));
|
4 |
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
6 |
+
// require_once '/Applications/MAMP/htdocs/magento/app/Mage.php';
|
7 |
|
8 |
|
9 |
//umask(0);
|
16 |
Mage::app()->setCurrentStore($store_id);
|
17 |
|
18 |
|
19 |
+
#echo "Running rs_send_users.php with arguments $store_id $timestamp $page_counter $last_user_record_id \n";
|
20 |
|
21 |
$observer = new RetentionScience_Waves_Model_Observer();
|
22 |
$elements_per_page = $observer->elementsPerPage();
|
app/code/community/RetentionScience/Waves/Model/rs_sync_data.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
define('MAGENTO', dirname(__FILE__));
|
4 |
+
require_once MAGENTO . '/../../../../../../app/Mage.php';
|
5 |
+
// require_once '/Applications/MAMP/htdocs/magento/app/Mage.php';
|
6 |
+
// require_once '/Users/--/Sites/magento/app/Mage.php';
|
7 |
+
|
8 |
+
$last_processed_order_record_id;
|
9 |
+
$last_processed_user_entity_id;
|
10 |
+
$last_processed_product_entity_id;
|
11 |
+
|
12 |
+
$phpBin = Mage::getStoreConfig('waves/rs_sync_advanced/rs_php_bin');
|
13 |
+
$sendBulkUpload = true;
|
14 |
+
$useBulkCompression = true;
|
15 |
+
$useExec = false;
|
16 |
+
$removeFileAfterSend = false;
|
17 |
+
$logToFile = false;
|
18 |
+
$elementsPerPage = 2000;
|
19 |
+
$apiClient;
|
20 |
+
$timestamp = date("YmdHis");
|
21 |
+
$store_id = Mage::app()->getStore()->getCode();
|
22 |
+
$observer = new RetentionScience_Waves_Model_Observer();
|
23 |
+
|
24 |
+
// Scripts
|
25 |
+
$send_orders_script = escapeshellarg(dirname(__FILE__) . "/rs_send_orders.php");
|
26 |
+
$send_products_script = escapeshellarg(dirname(__FILE__) . "/rs_send_products.php");
|
27 |
+
$send_users_script = escapeshellarg(dirname(__FILE__) . "/rs_send_users.php");
|
28 |
+
|
29 |
+
$syncDataStatus = Mage::getStoreConfig('waves/rs_sync_settings/sync_data_status');
|
30 |
+
if(stristr($syncDataStatus, "running")){
|
31 |
+
// Already running
|
32 |
+
die(1);
|
33 |
+
}
|
34 |
+
|
35 |
+
// Export Orders
|
36 |
+
try{
|
37 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[running] exporting orders - last updated at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
38 |
+
|
39 |
+
$last_order_record_id = (int) Mage::getStoreConfig('waves/rs_sync_advanced/last_order_record_id');
|
40 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
41 |
+
if($last_order_record_id>0){
|
42 |
+
$orderCollection->addFieldToFilter('entity_id', array('gt' => $last_order_record_id));
|
43 |
+
}
|
44 |
+
|
45 |
+
# this will be updated as we iterate
|
46 |
+
$last_processed_order_record_id = $last_order_record_id;
|
47 |
+
|
48 |
+
$num_orders_to_send = $orderCollection->getSize(); // Don't use count()
|
49 |
+
$pages = ceil($num_orders_to_send / $elementsPerPage);
|
50 |
+
$page_counter = 1;
|
51 |
+
|
52 |
+
while($page_counter <= $pages){
|
53 |
+
$cmd = "$phpBin $send_orders_script $store_id $timestamp $page_counter $last_order_record_id";
|
54 |
+
$output = array();
|
55 |
+
$return_val = null;
|
56 |
+
exec($cmd, $output, $return_val);
|
57 |
+
if ($return_val != 0){
|
58 |
+
var_dump($output);
|
59 |
+
throw new Exception('Send orders script returned with non-zero return code.');
|
60 |
+
} else {
|
61 |
+
$last_processed_order_record_id = $output[0];
|
62 |
+
}
|
63 |
+
$page_counter = $page_counter + 1;
|
64 |
+
}
|
65 |
+
|
66 |
+
} catch(Exception $e) {
|
67 |
+
Mage::logException($e);
|
68 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error on orders at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
69 |
+
}
|
70 |
+
|
71 |
+
// Export Users
|
72 |
+
try {
|
73 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[running] exporting users - last updated at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
74 |
+
|
75 |
+
$last_user_record_id = (int) Mage::getStoreConfig('waves/rs_sync_advanced/last_user_record_id');
|
76 |
+
$userCollection = Mage::getModel('customer/customer')
|
77 |
+
->getCollection()
|
78 |
+
->addAttributeToSelect('name')
|
79 |
+
->addAttributeToSelect('*');
|
80 |
+
if($last_user_record_id>0){
|
81 |
+
$userCollection->addFieldToFilter('entity_id', array('gt' => $last_user_record_id));
|
82 |
+
}
|
83 |
+
|
84 |
+
$num_users_to_send = $userCollection->getSize(); // Don't use count()
|
85 |
+
$pages = ceil($num_users_to_send / $elementsPerPage);
|
86 |
+
$page_counter = 1;
|
87 |
+
|
88 |
+
while($page_counter <= $pages){
|
89 |
+
$cmd = "$phpBin $send_users_script $store_id $timestamp $page_counter $last_user_record_id";
|
90 |
+
$output = array();
|
91 |
+
$return_val = null;
|
92 |
+
exec($cmd, $output, $return_val);
|
93 |
+
if ($return_val != 0){
|
94 |
+
var_dump($output);
|
95 |
+
throw new Exception('Send users script returned with non-zero return code.');
|
96 |
+
} else {
|
97 |
+
$last_processed_user_record_id = $output[0];
|
98 |
+
}
|
99 |
+
$page_counter = $page_counter + 1;
|
100 |
+
}
|
101 |
+
} catch (Exception $e){
|
102 |
+
Mage::logException($e);
|
103 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error on users at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
104 |
+
}
|
105 |
+
|
106 |
+
// Export Products
|
107 |
+
try{
|
108 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[running] exporting products - last updated at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
109 |
+
|
110 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
111 |
+
|
112 |
+
$num_products_to_send = $productCollection->getSize();
|
113 |
+
$pages = ceil($num_products_to_send / $elementsPerPage);
|
114 |
+
$page_counter = 1;
|
115 |
+
|
116 |
+
while($page_counter <= $pages){
|
117 |
+
$cmd = "$phpBin $send_products_script $store_id $timestamp $page_counter";
|
118 |
+
$output = array();
|
119 |
+
$return_val = null;
|
120 |
+
exec($cmd, $output, $return_val);
|
121 |
+
if ($return_val != 0){
|
122 |
+
var_dump($output);
|
123 |
+
throw new Exception('Send products script returned with non-zero return code.');
|
124 |
+
}
|
125 |
+
$page_counter = $page_counter + 1;
|
126 |
+
}
|
127 |
+
} catch (Exception $e){
|
128 |
+
Mage::logException($e);
|
129 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error on products at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
130 |
+
}
|
131 |
+
|
132 |
+
// Export Categories
|
133 |
+
try {
|
134 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[running] exporting categories - last updated at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
135 |
+
|
136 |
+
$categorytree = Mage::getModel('waves/source_categorytree')->getAllOptions();
|
137 |
+
|
138 |
+
foreach($categorytree as $category){
|
139 |
+
$parentId = ($category->getParentId())?$category->getParentId():null;
|
140 |
+
$categoryId = $category->getEntityId();
|
141 |
+
$categoryName = $category->getName();
|
142 |
+
$categoryDescription = $category->getDescripton();
|
143 |
+
$category_array = array('name' => $categoryName, 'description' => $categoryDescription, 'parent_record_id' => $parentId);
|
144 |
+
$observer->writeBulkUploadFile(array($categoryId => $category_array), 'categories', $timestamp);
|
145 |
+
}
|
146 |
+
} catch (Exception $e) {
|
147 |
+
Mage::logException($e);
|
148 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error on categories at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
149 |
+
}
|
150 |
+
|
151 |
+
// Send to rsapi
|
152 |
+
try {
|
153 |
+
$observer->sendDataSyncFiles($timestamp);
|
154 |
+
} catch (Exception $e) {
|
155 |
+
Mage::logException($e);
|
156 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error on upload at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())) );
|
157 |
+
}
|
158 |
+
|
159 |
+
// Update last exported IDs and status
|
160 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_order_record_id', $last_processed_order_record_id);
|
161 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_advanced/last_user_record_id', $last_processed_user_record_id);
|
162 |
+
Mage::getModel('core/config')->saveConfig('waves/rs_sync_settings/sync_data_status', '[stopped] last run at: '. date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
app/code/community/RetentionScience/Waves/controllers/AdminController.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RetentionScience_Waves_AdminController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function updateRScoreAction() {
|
5 |
+
$obj = new RetentionScience_Waves_Model_Observer();
|
6 |
+
$rscore_json = $obj->updateRScore();
|
7 |
+
die($rscore_json);
|
8 |
+
}
|
9 |
+
|
10 |
+
public function syncDataAction() {
|
11 |
+
$obj = new RetentionScience_Waves_Model_Observer();
|
12 |
+
$obj->syncData();
|
13 |
+
$this->_redirectUrl(Mage::helper('adminhtml')->getUrl("adminhtml/system_config/edit/section/waves/"));
|
14 |
+
}
|
15 |
+
}
|
app/code/community/RetentionScience/Waves/controllers/IndexController.php
CHANGED
@@ -1,73 +1,31 @@
|
|
1 |
-
<?php
|
2 |
-
class RetentionScience_Waves_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function scriptRunAction(){
|
5 |
-
$status = Mage::getStoreConfig('waves/retentionscience_settings/enable');
|
6 |
-
$siteID = Mage::getStoreConfig('waves/retentionscience_settings/site_id');
|
7 |
-
if($status && $siteID){
|
8 |
-
|
9 |
-
$result['siteID'] = $siteID;
|
10 |
-
$result['customerId'] = "";
|
11 |
-
if(Mage::getSingleton('customer/session')->isLoggedIn()){
|
12 |
-
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
13 |
-
$result['customerId'] = $customerId;
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
$allItems = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
|
18 |
-
$items = array();
|
19 |
-
$count = 0;
|
20 |
-
foreach ($allItems as $item){
|
21 |
-
$items[$count]['id'] = $item->getProductId();
|
22 |
-
$items[$count]['name'] = $item->getName();
|
23 |
-
$items[$count]['price'] = $item->getPrice();
|
24 |
-
$count++;
|
25 |
-
}
|
26 |
-
$result['items'] = json_encode($items);
|
27 |
-
echo json_encode($result);
|
28 |
-
die();
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function sendCategoryAction(){
|
33 |
-
$t1 = time();
|
34 |
-
$obj = new RetentionScience_Waves_Model_Observer();
|
35 |
-
$obj->sendCategory();
|
36 |
-
$length = time() - $t1;
|
37 |
-
echo "Finished in $length seconds";
|
38 |
-
//$parentId = Mage::app()->getStore('admin')->getRootCategoryId();
|
39 |
-
//echo "Parent id: " . $parentId . "<br>";
|
40 |
-
die();
|
41 |
-
}
|
42 |
-
|
43 |
-
public function sendProductAction(){
|
44 |
-
$t1 = time();
|
45 |
-
$obj = new RetentionScience_Waves_Model_Observer();
|
46 |
-
$obj->sendProduct();
|
47 |
-
$length = time() - $t1;
|
48 |
-
echo "Finished in $length seconds";
|
49 |
-
die();
|
50 |
-
}
|
51 |
-
public function sendUserAction(){
|
52 |
-
$t1 = time();
|
53 |
-
$obj = new RetentionScience_Waves_Model_Observer();
|
54 |
-
$obj->sendUser();
|
55 |
-
$length = time() - $t1;
|
56 |
-
echo "Finished in $length seconds";
|
57 |
-
die();
|
58 |
-
}
|
59 |
-
public function sendOrderAction(){
|
60 |
-
$t1 = time();
|
61 |
-
$obj = new RetentionScience_Waves_Model_Observer();
|
62 |
-
$obj->sendOrder();
|
63 |
-
$length = time() - $t1;
|
64 |
-
echo "Finished in $length seconds";
|
65 |
-
die();
|
66 |
-
}
|
67 |
-
|
68 |
-
public function updateRScoreAction() {
|
69 |
-
$obj = new RetentionScience_Waves_Model_Observer();
|
70 |
-
$rscore_json = $obj->updateRScore();
|
71 |
-
die($rscore_json);
|
72 |
-
}
|
73 |
}
|
1 |
+
<?php
|
2 |
+
class RetentionScience_Waves_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function scriptRunAction(){
|
5 |
+
$status = Mage::getStoreConfig('waves/retentionscience_settings/enable');
|
6 |
+
$siteID = Mage::getStoreConfig('waves/retentionscience_settings/site_id');
|
7 |
+
if($status && $siteID){
|
8 |
+
|
9 |
+
$result['siteID'] = $siteID;
|
10 |
+
$result['customerId'] = "";
|
11 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()){
|
12 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
13 |
+
$result['customerId'] = $customerId;
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
$allItems = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
|
18 |
+
$items = array();
|
19 |
+
$count = 0;
|
20 |
+
foreach ($allItems as $item){
|
21 |
+
$items[$count]['id'] = $item->getProductId();
|
22 |
+
$items[$count]['name'] = $item->getName();
|
23 |
+
$items[$count]['price'] = $item->getPrice();
|
24 |
+
$count++;
|
25 |
+
}
|
26 |
+
$result['items'] = json_encode($items);
|
27 |
+
echo json_encode($result);
|
28 |
+
die();
|
29 |
+
}
|
30 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
app/code/community/RetentionScience/Waves/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<RetentionScience_Waves>
|
5 |
-
<version>2.0
|
6 |
</RetentionScience_Waves>
|
7 |
</modules>
|
8 |
<global>
|
@@ -34,48 +34,44 @@
|
|
34 |
</updates>
|
35 |
</layout>
|
36 |
</frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
<crontab>
|
39 |
<jobs>
|
40 |
-
<
|
41 |
-
<run>
|
42 |
-
<model>waves/observer::sendCategory</model>
|
43 |
-
</run>
|
44 |
-
</retentionscience_waves_sendcategory>
|
45 |
-
|
46 |
-
<retentionscience_waves_sendproduct>
|
47 |
-
<run>
|
48 |
-
<model>waves/observer::sendProduct</model>
|
49 |
-
</run>
|
50 |
-
</retentionscience_waves_sendproduct>
|
51 |
-
|
52 |
-
<retentionscience_waves_senduser>
|
53 |
-
<run>
|
54 |
-
<model>waves/observer::sendUser</model>
|
55 |
-
</run>
|
56 |
-
</retentionscience_waves_senduser>
|
57 |
-
|
58 |
-
<retentionscience_waves_sendorder>
|
59 |
<run>
|
60 |
-
<model>waves/observer::
|
61 |
</run>
|
62 |
-
</
|
63 |
</jobs>
|
64 |
</crontab>
|
65 |
|
66 |
<default>
|
67 |
<waves>
|
68 |
<rs_sync_settings>
|
69 |
-
<
|
70 |
-
<product_process_cron>0 2 * * *</product_process_cron>
|
71 |
-
<user_process_cron>0 3 * * *</user_process_cron>
|
72 |
-
<order_process_cron>0 4 * * *</order_process_cron>
|
73 |
</rs_sync_settings>
|
74 |
|
75 |
<rs_sync_advanced>
|
76 |
<rs_php_bin>php</rs_php_bin>
|
77 |
<rs_send_bulk_upload>1</rs_send_bulk_upload>
|
78 |
-
<rs_use_bulk_compression>1</rs_use_bulk_compression>
|
79 |
<rs_bulk_use_exec>1</rs_bulk_use_exec>
|
80 |
<last_user_record_id>0</last_user_record_id>
|
81 |
<last_order_record_id>0</last_order_record_id>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<RetentionScience_Waves>
|
5 |
+
<version>2.1.0</version>
|
6 |
</RetentionScience_Waves>
|
7 |
</modules>
|
8 |
<global>
|
34 |
</updates>
|
35 |
</layout>
|
36 |
</frontend>
|
37 |
+
<admin>
|
38 |
+
<routers>
|
39 |
+
<waves>
|
40 |
+
<use>admin</use>
|
41 |
+
<args>
|
42 |
+
<module>RetentionScience_Waves</module>
|
43 |
+
<frontName>waves</frontName>
|
44 |
+
</args>
|
45 |
+
</waves>
|
46 |
+
</routers>
|
47 |
+
<layout>
|
48 |
+
<updates>
|
49 |
+
<waves>
|
50 |
+
<file>waves.xml</file>
|
51 |
+
</waves>
|
52 |
+
</updates>
|
53 |
+
</layout>
|
54 |
+
</admin>
|
55 |
|
56 |
<crontab>
|
57 |
<jobs>
|
58 |
+
<retentionscience_waves_syncdata>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
<run>
|
60 |
+
<model>waves/observer::syncData</model>
|
61 |
</run>
|
62 |
+
</retentionscience_waves_syncdata>
|
63 |
</jobs>
|
64 |
</crontab>
|
65 |
|
66 |
<default>
|
67 |
<waves>
|
68 |
<rs_sync_settings>
|
69 |
+
<sync_data_cron>0 2 * * *</sync_data_cron>
|
|
|
|
|
|
|
70 |
</rs_sync_settings>
|
71 |
|
72 |
<rs_sync_advanced>
|
73 |
<rs_php_bin>php</rs_php_bin>
|
74 |
<rs_send_bulk_upload>1</rs_send_bulk_upload>
|
|
|
75 |
<rs_bulk_use_exec>1</rs_bulk_use_exec>
|
76 |
<last_user_record_id>0</last_user_record_id>
|
77 |
<last_order_record_id>0</last_order_record_id>
|
app/code/community/RetentionScience/Waves/etc/system.xml
CHANGED
@@ -101,133 +101,37 @@
|
|
101 |
<show_in_store>1</show_in_store>
|
102 |
<fields>
|
103 |
|
104 |
-
<
|
105 |
-
<label>
|
106 |
<frontend_type>text</frontend_type>
|
107 |
-
<sort_order>
|
108 |
<show_in_default>1</show_in_default>
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>1</show_in_store>
|
111 |
-
</
|
112 |
|
113 |
-
<
|
114 |
-
<label>
|
115 |
-
<rs_cron_job>
|
116 |
<frontend_type>text</frontend_type>
|
117 |
-
<sort_order>
|
118 |
<backend_model>waves/source_cronconfig</backend_model>
|
119 |
<comment>Use Crontab Format (Eg. "0 10 * * *" for 10AM)</comment>
|
120 |
<show_in_default>1</show_in_default>
|
121 |
<show_in_website>1</show_in_website>
|
122 |
<show_in_store>1</show_in_store>
|
123 |
-
</
|
124 |
|
125 |
-
<
|
126 |
<label></label>
|
127 |
-
<rs_button_url>
|
128 |
<frontend_type>button</frontend_type>
|
129 |
<frontend_model>waves/adminhtml_syncbutton</frontend_model>
|
130 |
-
<sort_order>
|
131 |
<show_in_default>1</show_in_default>
|
132 |
<show_in_website>1</show_in_website>
|
133 |
<show_in_store>1</show_in_store>
|
134 |
-
</
|
135 |
-
|
136 |
-
<product_process_status translate="label">
|
137 |
-
<label>Products Sync Status</label>
|
138 |
-
<frontend_type>text</frontend_type>
|
139 |
-
<sort_order>50</sort_order>
|
140 |
-
<show_in_default>1</show_in_default>
|
141 |
-
<show_in_website>1</show_in_website>
|
142 |
-
<show_in_store>1</show_in_store>
|
143 |
-
</product_process_status>
|
144 |
-
|
145 |
-
<product_process_cron translate="label">
|
146 |
-
<label>Products Sync Cron Entry</label>
|
147 |
-
<rs_cron_job>retentionscience_waves_sendproduct</rs_cron_job>
|
148 |
-
<frontend_type>text</frontend_type>
|
149 |
-
<backend_model>waves/source_cronconfig</backend_model>
|
150 |
-
<comment>Use Crontab Format (Eg. "0 10 * * *" for 10AM)</comment>
|
151 |
-
<sort_order>51</sort_order>
|
152 |
-
<show_in_default>1</show_in_default>
|
153 |
-
<show_in_website>1</show_in_website>
|
154 |
-
<show_in_store>1</show_in_store>
|
155 |
-
</product_process_cron>
|
156 |
-
|
157 |
-
<product_process_run translate="label">
|
158 |
-
<label></label>
|
159 |
-
<rs_button_url>sendproduct</rs_button_url>
|
160 |
-
<frontend_type>button</frontend_type>
|
161 |
-
<frontend_model>waves/adminhtml_syncbutton</frontend_model>
|
162 |
-
<sort_order>52</sort_order>
|
163 |
-
<show_in_default>1</show_in_default>
|
164 |
-
<show_in_website>1</show_in_website>
|
165 |
-
<show_in_store>1</show_in_store>
|
166 |
-
</product_process_run>
|
167 |
-
|
168 |
-
<user_process_status translate="label">
|
169 |
-
<label>Users Sync Status</label>
|
170 |
-
<frontend_type>text</frontend_type>
|
171 |
-
<sort_order>60</sort_order>
|
172 |
-
<show_in_default>1</show_in_default>
|
173 |
-
<show_in_website>1</show_in_website>
|
174 |
-
<show_in_store>1</show_in_store>
|
175 |
-
</user_process_status>
|
176 |
-
|
177 |
-
<user_process_cron translate="label">
|
178 |
-
<label>Users Sync Cron Entry</label>
|
179 |
-
<rs_cron_job>retentionscience_waves_senduser</rs_cron_job>
|
180 |
-
<frontend_type>text</frontend_type>
|
181 |
-
<backend_model>waves/source_cronconfig</backend_model>
|
182 |
-
<comment>Use Crontab Format (Eg. "0 10 * * *" for 10AM)</comment>
|
183 |
-
<sort_order>61</sort_order>
|
184 |
-
<show_in_default>1</show_in_default>
|
185 |
-
<show_in_website>1</show_in_website>
|
186 |
-
<show_in_store>1</show_in_store>
|
187 |
-
</user_process_cron>
|
188 |
-
|
189 |
-
<user_process_run translate="label">
|
190 |
-
<label></label>
|
191 |
-
<rs_button_url>senduser</rs_button_url>
|
192 |
-
<frontend_type>button</frontend_type>
|
193 |
-
<frontend_model>waves/adminhtml_syncbutton</frontend_model>
|
194 |
-
<sort_order>62</sort_order>
|
195 |
-
<show_in_default>1</show_in_default>
|
196 |
-
<show_in_website>1</show_in_website>
|
197 |
-
<show_in_store>1</show_in_store>
|
198 |
-
</user_process_run>
|
199 |
-
|
200 |
-
<order_process_status translate="label">
|
201 |
-
<label>Orders Sync Status</label>
|
202 |
-
<frontend_type>text</frontend_type>
|
203 |
-
<sort_order>70</sort_order>
|
204 |
-
<show_in_default>1</show_in_default>
|
205 |
-
<show_in_website>1</show_in_website>
|
206 |
-
<show_in_store>1</show_in_store>
|
207 |
-
</order_process_status>
|
208 |
-
|
209 |
-
<order_process_cron translate="label">
|
210 |
-
<label>Orders Sync Cron Entry</label>
|
211 |
-
<rs_cron_job>retentionscience_waves_sendorder</rs_cron_job>
|
212 |
-
<frontend_type>text</frontend_type>
|
213 |
-
<backend_model>waves/source_cronconfig</backend_model>
|
214 |
-
<comment>Use Crontab Format (Eg. "0 10 * * *" for 10AM)</comment>
|
215 |
-
<sort_order>71</sort_order>
|
216 |
-
<show_in_default>1</show_in_default>
|
217 |
-
<show_in_website>1</show_in_website>
|
218 |
-
<show_in_store>1</show_in_store>
|
219 |
-
</order_process_cron>
|
220 |
-
|
221 |
-
<order_process_run translate="label">
|
222 |
-
<label></label>
|
223 |
-
<rs_button_url>sendorder</rs_button_url>
|
224 |
-
<frontend_type>button</frontend_type>
|
225 |
-
<frontend_model>waves/adminhtml_syncbutton</frontend_model>
|
226 |
-
<sort_order>72</sort_order>
|
227 |
-
<show_in_default>1</show_in_default>
|
228 |
-
<show_in_website>1</show_in_website>
|
229 |
-
<show_in_store>1</show_in_store>
|
230 |
-
</order_process_run>
|
231 |
</fields>
|
232 |
</rs_sync_settings>
|
233 |
|
101 |
<show_in_store>1</show_in_store>
|
102 |
<fields>
|
103 |
|
104 |
+
<sync_data_status translate="label">
|
105 |
+
<label>Data Sync Status</label>
|
106 |
<frontend_type>text</frontend_type>
|
107 |
+
<sort_order>37</sort_order>
|
108 |
<show_in_default>1</show_in_default>
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>1</show_in_store>
|
111 |
+
</sync_data_status>
|
112 |
|
113 |
+
<sync_data_cron translate="label">
|
114 |
+
<label>Data Sync Cron Entry</label>
|
115 |
+
<rs_cron_job>retentionscience_waves_syncdata</rs_cron_job>
|
116 |
<frontend_type>text</frontend_type>
|
117 |
+
<sort_order>38</sort_order>
|
118 |
<backend_model>waves/source_cronconfig</backend_model>
|
119 |
<comment>Use Crontab Format (Eg. "0 10 * * *" for 10AM)</comment>
|
120 |
<show_in_default>1</show_in_default>
|
121 |
<show_in_website>1</show_in_website>
|
122 |
<show_in_store>1</show_in_store>
|
123 |
+
</sync_data_cron>
|
124 |
|
125 |
+
<sync_data_run translate="label">
|
126 |
<label></label>
|
127 |
+
<rs_button_url>syncdata</rs_button_url>
|
128 |
<frontend_type>button</frontend_type>
|
129 |
<frontend_model>waves/adminhtml_syncbutton</frontend_model>
|
130 |
+
<sort_order>39</sort_order>
|
131 |
<show_in_default>1</show_in_default>
|
132 |
<show_in_website>1</show_in_website>
|
133 |
<show_in_store>1</show_in_store>
|
134 |
+
</sync_data_run>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
</fields>
|
136 |
</rs_sync_settings>
|
137 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>RetentionScience_Waves</name>
|
4 |
-
<version>2.0
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</license>
|
7 |
<channel>community</channel>
|
@@ -16,11 +16,11 @@ We leverage big data analytics and machine learning to optimize retention strate
|
|
16 |
Our technology enables your store to leverage massive social media, demographic, and behavioral datasets - powerful information sources to help you drive sales. 
|
17 |

|
18 |
Notes: This extension interfaces with Retention Science, and communicates through the Retention Science API. For more information, and to sign up for API access, please see http://retentionscience.com.</description>
|
19 |
-
<notes>
|
20 |
<authors><author><name>Retention Science</name><user>auto-converted</user><email>support@retentionscience.com</email></author></authors>
|
21 |
-
<date>2013-01-
|
22 |
-
<time>
|
23 |
-
<contents><target name="magecommunity"><dir name="RetentionScience"><dir name="Waves"><dir name="Block"><dir name="Adminhtml"><file name="Rscore.php" hash="93919181411e46af838c6cfb872d3f31"/><file name="Syncbutton.php" hash="
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>RetentionScience_Waves</name>
|
4 |
+
<version>2.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</license>
|
7 |
<channel>community</channel>
|
16 |
Our technology enables your store to leverage massive social media, demographic, and behavioral datasets - powerful information sources to help you drive sales. 
|
17 |

|
18 |
Notes: This extension interfaces with Retention Science, and communicates through the Retention Science API. For more information, and to sign up for API access, please see http://retentionscience.com.</description>
|
19 |
+
<notes>Added Retention Score</notes>
|
20 |
<authors><author><name>Retention Science</name><user>auto-converted</user><email>support@retentionscience.com</email></author></authors>
|
21 |
+
<date>2013-01-29</date>
|
22 |
+
<time>23:31:25</time>
|
23 |
+
<contents><target name="magecommunity"><dir name="RetentionScience"><dir name="Waves"><dir name="Block"><dir name="Adminhtml"><file name="Rscore.php" hash="93919181411e46af838c6cfb872d3f31"/><file name="Syncbutton.php" hash="7cd56fdacd5c9da7e126ab059f568ab2"/></dir><file name="Waves.php" hash="a2c0c64d0dbbb9d458f6d0a8ec854f75"/><file name=".DS_Store" hash="9d0f8114c9a54f73944ba316a2c47467"/></dir><dir name="Helper"><file name="Data.php" hash="90490af254a670d4795b744c1ef4319e"/></dir><dir name="Model"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="027feb7796f79b7cf811c4236ad7b87a"/><file name="Hours.php" hash="0ab9157003d5e7efed402ed401a46134"/></dir><file name="Categorytree.php" hash="58ca152ea2a34c7992460ece01b12bd8"/><file name="Cronconfig.php" hash="d8ae966b08bad48e68618343f7a27569"/><file name="Rscoredata.php" hash="a60f52a76b6097cdc0fb64e7218939dc"/></dir><file name="Observer.php" hash="be84f67347aa4f43b6279dda9251c078"/><file name="retention_science_api.php" hash="37f1fecd276c1e5290e94c2fa50e0931"/><file name="rs_send_orders.php" hash="fbae6d568f010733bb086a8c4632c5f8"/><file name="rs_send_products.php" hash="365385b0245e30b50020c0810caa8f08"/><file name="rs_send_users.php" hash="ad25e0e8102e9399d7a15fd43bbd84e8"/><file name="rs_sync_data.php" hash="76c8578e2368e1d6da9007d026bddd1b"/></dir><dir name="controllers"><file name="AdminController.php" hash="69a9da4bcd7e607569bb73429dfc500a"/><file name="IndexController.php" hash="e59004d457861772704554903b90566f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1378650fdb7ecc596f9881d7eefca868"/><file name="config.xml" hash="ae8fd52a775da4342211d4cefb60a9c5"/><file name="system.xml" hash="05cb4a30064730fa982fbe8307e7926b"/></dir><file name=".DS_Store" hash="a6f34ab378b9fd006734d37a270e82f1"/></dir><file name=".DS_Store" hash="128e595394427daa0503e6d824d6b4ef"/></dir></target><target name="mageweb"><dir name="js"><dir name="RetentionScience"><dir name="RetentionScience"><file name="retention_science_wave.js" hash="2a2584125f96c48c061a6fed5d1e0653"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="waves.xml" hash="7f62bec7d87da48c0e554fc1cf3a9802"/></dir><dir name="template"><dir name="waves"><file name="waves.phtml" hash="04828984bbd986cbe098bca2a6d30bb1"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="waves"><file name="rscore.phtml" hash="bec902beb86d449dceef39bddf179943"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RetentionScience_Waves.xml" hash="9dc27ff12e5834f576b22a72a60d02e7"/></dir></target></contents>
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|