RetentionScience_Waves - Version 2.3.0

Version Notes

Default using compression, visible items, and using our new product collection model

Download this release

Release Info

Developer Magento Core Team
Extension RetentionScience_Waves
Version 2.3.0
Comparing to
See all releases


Code changes from version 2.2.0 to 2.3.0

app/code/community/RetentionScience/Waves/.DS_Store DELETED
Binary file
app/code/community/RetentionScience/Waves/Block/.DS_Store DELETED
Binary file
app/code/community/RetentionScience/Waves/Model/Mysql4/Product/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Eav
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class RetentionScience_Waves_Model_Mysql4_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection
29
+ {
30
+ public function isEnabledFlat()
31
+ {
32
+ return false;
33
+ }
34
+ }
app/code/community/RetentionScience/Waves/Model/Observer.php CHANGED
@@ -95,6 +95,9 @@ class RetentionScience_Waves_Model_Observer
95
  $gzfiles = array();
96
  foreach ($types as $type) {
97
  $file = $tmp_base . '/rs_bulk_'. $type.'_'.$timestamp.'.log';
 
 
 
98
  if (file_exists($file)) {
99
  $files[$type] = $file;
100
  if ($this->useBulkCompression()) {
@@ -290,162 +293,173 @@ class RetentionScience_Waves_Model_Observer
290
  }
291
 
292
  public function orderCallback($args){
293
- $timestamp = $args['timestamp'];
294
- global $last_processed_order_record_id;
 
295
 
296
- $order = Mage::getModel('sales/order')->load($args['order_record_id']);
297
- $order_array = array();
298
- $order_record_id = $order->getEntityId();
299
- $orderAllItems = $order->getAllVisibleItems();
300
- $order_item_array = array();
301
- foreach($orderAllItems as $orderAllItem){
302
- $item_record_id = $orderAllItem->getProductId();
303
- $name = $orderAllItem->getName();
304
- $quantity = (int) $orderAllItem->getQtyOrdered();
305
- $price = $orderAllItem->getPrice();
306
- $price = number_format($price, 2, '.', '');
307
- $final_price = $price * $quantity;
308
- $sku = $orderAllItem->getSku();
309
- $productId = $orderAllItem->getProductId();
310
- $product = Mage::getModel('catalog/product')->load($productId);
311
- $categoryIds = $product->getCategoryIds();
312
- $order_item_array[] = array(
313
- 'item_record_id' => $item_record_id,
314
- 'name' => $name,
315
- 'quantity' => $quantity,
316
- 'price' => $price,
317
- 'final_price' => $final_price,
318
- 'attribute_1' => $sku,
319
- 'categories' => $categoryIds
320
- );
321
- // save memory - Note, $product->clearInstance(); doesnt work on older magento installs
322
- unset($product);
323
- }
324
- unset($orderAllItems);
325
 
326
- $user_record_id = md5(trim(strtolower($order->getCustomerEmail())));
327
- if($order->getCustomerIsGuest()){
328
- $email = $order->getCustomerEmail();
329
- $user_record_id = md5(trim(strtolower($email)));
330
 
331
- // get billing address
332
- $address = $order->getBillingAddress();
333
- $fullName = $order->getCustomerFirstname()." ".$order->getCustomerLastname();
334
 
335
- $address1 = $address->getStreetFull();
336
- $address1 = str_replace("\n"," ",$address1);
337
- $city = $address->getCity();
338
- $regionModel = Mage::getModel('directory/region')->load($address->getRegionId());
339
- $region = $regionModel->getName();
340
- $zip = $address->getPostcode();
341
- $country = $address->getCountryId();
342
- $phone = $address->getTelephone();
343
- $accountCreatedAt = $order->getCreatedAt();
344
- $accountUpdatedAt = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(strtotime($accountCreatedAt)));
345
- $accountCreatedAt = date("Y-m-d", Mage::getModel('core/date')->timestamp(strtotime($accountCreatedAt)));
346
 
347
- if (!$this->sendBulkUpload()){
348
- // only update some fields (like created_at) if this is a new user.
349
- $user_exists_already = $this->getRetentionScienceApiClient()->user_exists($user_record_id);
350
- $existing_user = ($user_exists_already) ? $this->getRetentionScienceApiClient()->show_user($user_record_id) : null;
351
- }
352
 
353
- // send this user to api as well
354
- $user_array = array();
355
- if($email){
356
- $user_array['email'] = $email;
357
- }
358
- if($fullName){
359
- $user_array['full_name'] = $fullName;
360
- }
361
- if($address1){
362
- $user_array['address1'] = $address1;
363
- }
364
- if($city){
365
- $user_array['city'] = $city;
366
- }
367
- if($region){
368
- $user_array['state'] = $region;
369
- }
370
- if($zip){
371
- $user_array['zip'] = $zip;
372
- }
373
- if($country){
374
- $user_array['country'] = $country;
375
- }
376
- if($phone){
377
- $user_array['phone'] = $phone;
378
- }
379
- if($accountCreatedAt){
380
- if ($this->sendBulkUpload()){
381
- $user_array['account_created_on'] = $accountCreatedAt;
382
 
383
- } else {
384
- if (!($user_exists_already)){
385
- $this->writeToLog("User does not exist yet ***** - creating with account_created_on as [" . $accountCreatedAt . ']', 'order_users');
386
- } else if ($existing_user) {
387
- $this->writeToLog(http_build_query($existing_user), 'existing_users');
388
- $themsg = "Existing user is PRESENT. His account_created_on is [" . $existing_user['account_created_on'] . "]. My accountCreatedAt is [" . $accountCreatedAt . "]";
389
- $this->writeToLog($themsg, 'order_users');
390
- }
391
 
392
- if (!($user_exists_already) || ($existing_user && (strtotime($existing_user['account_created_on']) > strtotime($accountCreatedAt))) ){
393
- $user_array['account_created_on'] = $accountCreatedAt;
394
- }
395
- }
396
- }
397
- if($accountUpdatedAt){
398
- $user_array['last_logon_at'] = $accountUpdatedAt;
399
- }
400
 
401
- if ($this->logToFile()){
402
- $this->writeToLog($user_record_id, 'order_users');
403
- $this->writeToLog(http_build_query($user_array), 'order_users');
404
- }
405
- try{
406
- if ($this->sendBulkUpload()){
407
- $this->writeBulkUploadFile(array($user_record_id => $user_array), 'orders_users', $timestamp);
408
- } else {
409
- $this->getRetentionScienceApiClient()->update_user($user_record_id, $user_array);
410
- }
411
- } catch (Exception $e){
412
- // do nothing
413
- }
414
- }
415
 
416
- $total_price = $order->getBaseSubtotal();
417
- $total_price = number_format($total_price, 2, '.', '');
418
- $discount_amount = $order->getBaseDiscountAmount();
419
- $shipping_amount = $order->getShippingAmount();
420
- $tax_amount = $order->getBaseTaxAmount();
421
- $date = $order->getCreatedAt();
422
- $ordered_at = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(strtotime($date)));
423
- $payment_method = $order->getPayment()->getMethodInstance()->getTitle();
424
- $order_array = array(
425
- 'user_record_id' => $user_record_id,
426
- 'total_price' => $total_price,
427
- 'discount_amount' => $discount_amount,
428
- 'shipping_amount' => $shipping_amount,
429
- 'tax_amount' => $tax_amount,
430
- 'ordered_at' => $ordered_at,
431
- 'payment_method' => $payment_method,
432
- 'order_items'=> $order_item_array
433
- );
434
- if ($this->sendBulkUpload()){
435
- $this->writeBulkUploadFile(array($order_record_id => $order_array), 'orders', $timestamp);
436
- } else {
437
- try {
438
- $this->getRetentionScienceApiClient()->update_order($order_record_id, $order_array);
439
- } catch (Exception $e){
440
- // do nothing
441
- }
442
- }
 
 
 
 
 
 
 
443
 
444
- // Update this as we iterate
445
- $last_processed_order_record_id = $order_record_id;
446
- // Release memory. Note: $order->clearInstance(); doesnt work on older magento ver
447
- unset($order_array);
448
- unset($order);
 
 
 
449
  }
450
 
451
  public function coreBlockAbstractPrepareLayoutAfter(Varien_Event_Observer $observer)
95
  $gzfiles = array();
96
  foreach ($types as $type) {
97
  $file = $tmp_base . '/rs_bulk_'. $type.'_'.$timestamp.'.log';
98
+ if (($type == "orders_users") && !file_exists($file)) {
99
+ touch($file);
100
+ }
101
  if (file_exists($file)) {
102
  $files[$type] = $file;
103
  if ($this->useBulkCompression()) {
293
  }
294
 
295
  public function orderCallback($args){
296
+ try {
297
+ $timestamp = $args['timestamp'];
298
+ global $last_processed_order_record_id;
299
 
300
+ $order = Mage::getModel('sales/order')->load($args['order_record_id']);
301
+ $order_array = array();
302
+ $order_record_id = $order->getEntityId();
303
+ $orderAllItems = $order->getAllVisibleItems();
304
+ $order_item_array = array();
305
+ foreach($orderAllItems as $orderAllItem){
306
+ $item_record_id = $orderAllItem->getProductId();
307
+ $name = $orderAllItem->getName();
308
+ $quantity = (int) $orderAllItem->getQtyOrdered();
309
+ $price = $orderAllItem->getPrice();
310
+ $price = number_format($price, 2, '.', '');
311
+ $final_price = $price * $quantity;
312
+ $sku = $orderAllItem->getSku();
313
+ $productId = $orderAllItem->getProductId();
314
+ $product = Mage::getModel('catalog/product')->load($productId);
315
+ $categoryIds = $product->getCategoryIds();
316
+ $order_item_array[] = array(
317
+ 'item_record_id' => $item_record_id,
318
+ 'name' => $name,
319
+ 'quantity' => $quantity,
320
+ 'price' => $price,
321
+ 'final_price' => $final_price,
322
+ 'attribute_1' => $sku,
323
+ 'categories' => $categoryIds
324
+ );
325
+ // save memory - Note, $product->clearInstance(); doesnt work on older magento installs
326
+ unset($product);
327
+ }
328
+ unset($orderAllItems);
329
 
330
+ $user_record_id = md5(trim(strtolower($order->getCustomerEmail())));
331
+ if($order->getCustomerIsGuest()){
332
+ $email = $order->getCustomerEmail();
333
+ $user_record_id = md5(trim(strtolower($email)));
334
 
335
+ // get billing address
336
+ $address = $order->getBillingAddress();
337
+ $fullName = $order->getCustomerFirstname()." ".$order->getCustomerLastname();
338
 
339
+ $address1 = $address->getStreetFull();
340
+ $address1 = str_replace("\n"," ",$address1);
341
+ $city = $address->getCity();
342
+ $regionModel = Mage::getModel('directory/region')->load($address->getRegionId());
343
+ $region = $regionModel->getName();
344
+ $zip = $address->getPostcode();
345
+ $country = $address->getCountryId();
346
+ $phone = $address->getTelephone();
347
+ $accountCreatedAt = $order->getCreatedAt();
348
+ $accountUpdatedAt = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(strtotime($accountCreatedAt)));
349
+ $accountCreatedAt = date("Y-m-d", Mage::getModel('core/date')->timestamp(strtotime($accountCreatedAt)));
350
 
351
+ if (!$this->sendBulkUpload()){
352
+ // only update some fields (like created_at) if this is a new user.
353
+ $user_exists_already = $this->getRetentionScienceApiClient()->user_exists($user_record_id);
354
+ $existing_user = ($user_exists_already) ? $this->getRetentionScienceApiClient()->show_user($user_record_id) : null;
355
+ }
356
 
357
+ // send this user to api as well
358
+ $user_array = array();
359
+ if($email){
360
+ $user_array['email'] = $email;
361
+ }
362
+ if($fullName){
363
+ $user_array['full_name'] = $fullName;
364
+ }
365
+ if($address1){
366
+ $user_array['address1'] = $address1;
367
+ }
368
+ if($city){
369
+ $user_array['city'] = $city;
370
+ }
371
+ if($region){
372
+ $user_array['state'] = $region;
373
+ }
374
+ if($zip){
375
+ $user_array['zip'] = $zip;
376
+ }
377
+ if($country){
378
+ $user_array['country'] = $country;
379
+ }
380
+ if($phone){
381
+ $user_array['phone'] = $phone;
382
+ }
383
+ if($accountCreatedAt){
384
+ if ($this->sendBulkUpload()){
385
+ $user_array['account_created_on'] = $accountCreatedAt;
386
 
387
+ } else {
388
+ if (!($user_exists_already)){
389
+ $this->writeToLog("User does not exist yet ***** - creating with account_created_on as [" . $accountCreatedAt . ']', 'order_users');
390
+ } else if ($existing_user) {
391
+ $this->writeToLog(http_build_query($existing_user), 'existing_users');
392
+ $themsg = "Existing user is PRESENT. His account_created_on is [" . $existing_user['account_created_on'] . "]. My accountCreatedAt is [" . $accountCreatedAt . "]";
393
+ $this->writeToLog($themsg, 'order_users');
394
+ }
395
 
396
+ if (!($user_exists_already) || ($existing_user && (strtotime($existing_user['account_created_on']) > strtotime($accountCreatedAt))) ){
397
+ $user_array['account_created_on'] = $accountCreatedAt;
398
+ }
399
+ }
400
+ }
401
+ if($accountUpdatedAt){
402
+ $user_array['last_logon_at'] = $accountUpdatedAt;
403
+ }
404
 
405
+ if ($this->logToFile()){
406
+ $this->writeToLog($user_record_id, 'order_users');
407
+ $this->writeToLog(http_build_query($user_array), 'order_users');
408
+ }
409
+ try{
410
+ if ($this->sendBulkUpload()){
411
+ $this->writeBulkUploadFile(array($user_record_id => $user_array), 'orders_users', $timestamp);
412
+ } else {
413
+ $this->getRetentionScienceApiClient()->update_user($user_record_id, $user_array);
414
+ }
415
+ } catch (Exception $e){
416
+ // do nothing
417
+ }
418
+ }
419
 
420
+ $total_price = $order->getBaseSubtotal();
421
+ $total_price = number_format($total_price, 2, '.', '');
422
+ $discount_amount = $order->getBaseDiscountAmount();
423
+ $shipping_amount = $order->getShippingAmount();
424
+ $tax_amount = $order->getBaseTaxAmount();
425
+ $date = $order->getCreatedAt();
426
+ $ordered_at = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(strtotime($date)));
427
+ $payment = $order->getPayment();
428
+ if (!is_object($payment)) {
429
+ throw new Exception('Order ' . $order_record_id . 'does not have valid payment information');
430
+ }
431
+ $payment_method = $payment->getMethodInstance();
432
+ if (!is_object($payment_method)) {
433
+ throw new Exception('Order ' . $order_record_id . 'does not have a valid payment method');
434
+ }
435
+ $order_array = array(
436
+ 'user_record_id' => $user_record_id,
437
+ 'total_price' => $total_price,
438
+ 'discount_amount' => $discount_amount,
439
+ 'shipping_amount' => $shipping_amount,
440
+ 'tax_amount' => $tax_amount,
441
+ 'ordered_at' => $ordered_at,
442
+ 'payment_method' => $payment_method->getTitle(),
443
+ 'order_items'=> $order_item_array
444
+ );
445
+ if ($this->sendBulkUpload()){
446
+ $this->writeBulkUploadFile(array($order_record_id => $order_array), 'orders', $timestamp);
447
+ } else {
448
+ try {
449
+ $this->getRetentionScienceApiClient()->update_order($order_record_id, $order_array);
450
+ } catch (Exception $e){
451
+ // do nothing
452
+ }
453
+ }
454
 
455
+ // Update this as we iterate
456
+ $last_processed_order_record_id = $order_record_id;
457
+ // Release memory. Note: $order->clearInstance(); doesnt work on older magento ver
458
+ unset($order_array);
459
+ unset($order);
460
+ } catch (Exception $e) {
461
+ Mage::logException($e);
462
+ }
463
  }
464
 
465
  public function coreBlockAbstractPrepareLayoutAfter(Varien_Event_Observer $observer)
app/code/community/RetentionScience/Waves/Model/rs_send_products.php CHANGED
@@ -13,8 +13,10 @@ $observer = new RetentionScience_Waves_Model_Observer();
13
  $elements_per_page = $observer->elementsPerPage();
14
 
15
  // Retrieve products collection
16
- $productCollection = Mage::getModel('catalog/product')->getCollection();
17
- $productCollection->addAttributeToSelect('entity_id')->addAttributeToSelect('*');
 
 
18
  $productCollection->setPage($page_counter, $elements_per_page);
19
 
20
  try {
13
  $elements_per_page = $observer->elementsPerPage();
14
 
15
  // Retrieve products collection
16
+ // Note: we use our own model for ProductCollection because this selects all rows from the catalog_product_entity
17
+ // table rather than only selecting those values in the catalog_product_flat_1 (flattened) table.
18
+ // There were some products that were not being captured because they were not enabled or not simple products
19
+ $productCollection = new RetentionScience_Waves_Model_Mysql4_Product_Collection();
20
  $productCollection->setPage($page_counter, $elements_per_page);
21
 
22
  try {
app/code/community/RetentionScience/Waves/Model/rs_sync_data.php CHANGED
@@ -83,6 +83,7 @@ try {
83
  } catch(Exception $e) {
84
  Mage::logException($e);
85
  saveStoreConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error performing counts at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
 
86
  }
87
 
88
  // Export Orders
@@ -112,6 +113,7 @@ try{
112
  } catch(Exception $e) {
113
  Mage::logException($e);
114
  saveStoreConfig('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())));
 
115
  }
116
 
117
  // Export Users
@@ -138,6 +140,7 @@ try {
138
  } catch (Exception $e){
139
  Mage::logException($e);
140
  saveStoreConfig('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())));
 
141
  }
142
 
143
  // Export Products
@@ -161,6 +164,7 @@ try{
161
  } catch (Exception $e){
162
  Mage::logException($e);
163
  saveStoreConfig('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())));
 
164
  }
165
 
166
  // Export Categories
@@ -179,6 +183,7 @@ try {
179
  } catch (Exception $e) {
180
  Mage::logException($e);
181
  saveStoreConfig('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())) );
 
182
  }
183
 
184
  // Send to rs api
@@ -187,6 +192,7 @@ try {
187
  } catch (Exception $e) {
188
  Mage::logException($e);
189
  saveStoreConfig('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())) );
 
190
  }
191
 
192
  // Update last exported IDs and status
83
  } catch(Exception $e) {
84
  Mage::logException($e);
85
  saveStoreConfig('waves/rs_sync_settings/sync_data_status', '[stopped] error performing counts at: ' . date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
86
+ die(1);
87
  }
88
 
89
  // Export Orders
113
  } catch(Exception $e) {
114
  Mage::logException($e);
115
  saveStoreConfig('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())));
116
+ die(1);
117
  }
118
 
119
  // Export Users
140
  } catch (Exception $e){
141
  Mage::logException($e);
142
  saveStoreConfig('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())));
143
+ die(1);
144
  }
145
 
146
  // Export Products
164
  } catch (Exception $e){
165
  Mage::logException($e);
166
  saveStoreConfig('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())));
167
+ die(1);
168
  }
169
 
170
  // Export Categories
183
  } catch (Exception $e) {
184
  Mage::logException($e);
185
  saveStoreConfig('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())) );
186
+ die(1);
187
  }
188
 
189
  // Send to rs api
192
  } catch (Exception $e) {
193
  Mage::logException($e);
194
  saveStoreConfig('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())) );
195
+ die(1);
196
  }
197
 
198
  // Update last exported IDs and status
app/code/community/RetentionScience/Waves/controllers/IndexController.php CHANGED
@@ -14,7 +14,7 @@ class RetentionScience_Waves_IndexController extends Mage_Core_Controller_Front_
14
  }
15
 
16
 
17
- $allItems = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
18
  $items = array();
19
  $count = 0;
20
  foreach ($allItems as $item){
14
  }
15
 
16
 
17
+ $allItems = Mage::getModel('checkout/cart')->getQuote()->getAllVisibleItems();
18
  $items = array();
19
  $count = 0;
20
  foreach ($allItems as $item){
app/code/community/RetentionScience/Waves/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <RetentionScience_Waves>
5
- <version>2.2.0</version>
6
  </RetentionScience_Waves>
7
  </modules>
8
  <global>
@@ -72,6 +72,7 @@
72
  <rs_sync_advanced>
73
  <rs_php_bin>php</rs_php_bin>
74
  <rs_send_bulk_upload>1</rs_send_bulk_upload>
 
75
  <last_user_record_id>0</last_user_record_id>
76
  <last_order_record_id>0</last_order_record_id>
77
  </rs_sync_advanced>
2
  <config>
3
  <modules>
4
  <RetentionScience_Waves>
5
+ <version>2.3.0</version>
6
  </RetentionScience_Waves>
7
  </modules>
8
  <global>
72
  <rs_sync_advanced>
73
  <rs_php_bin>php</rs_php_bin>
74
  <rs_send_bulk_upload>1</rs_send_bulk_upload>
75
+ <rs_use_bulk_compression>1</rs_use_bulk_compression>
76
  <last_user_record_id>0</last_user_record_id>
77
  <last_order_record_id>0</last_order_record_id>
78
  </rs_sync_advanced>
app/design/frontend/base/default/template/waves/waves.phtml CHANGED
@@ -24,7 +24,7 @@ if ($status && $this->getSiteid()) {
24
  <?php }
25
 
26
  if (($moduleName == "checkout" && $controllerName == "cart" && $actionName == "index") || ($moduleName == "rangepricing" && $controllerName == "checkout_cart" && $actionName == "index")) {
27
- $allItems = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
28
  foreach ($allItems as $item) {
29
  $itemArr['id'] = $item->getProductId();
30
  $itemArr['name'] = $item->getName();
@@ -34,7 +34,7 @@ if ($status && $this->getSiteid()) {
34
  _rsq.push(['_setAction', 'shopping_cart']);
35
  <?php }
36
 
37
- if (($moduleName == "checkout" && $controllerName == "onepage" && $actionName == "success") || ($moduleName == "onestepcheckout" && $controllerName == "index" && $actionName == "success")) {
38
  $order = $this->getOrder();
39
  if (empty($user_id_set)) {
40
  $user_record_id = md5(trim(strtolower($order->getCustomerEmail()))); ?>
@@ -42,7 +42,9 @@ if ($status && $this->getSiteid()) {
42
  _rsq.push(['_setUserId', '<?php echo $user_record_id; ?>']);
43
  <?php }
44
 
45
- $allitems = $order->getAllItems();
 
 
46
  foreach($allitems as $item){
47
  $itemArr['id'] = $item->getProductId();
48
  $itemArr['name'] = $item->getName();
24
  <?php }
25
 
26
  if (($moduleName == "checkout" && $controllerName == "cart" && $actionName == "index") || ($moduleName == "rangepricing" && $controllerName == "checkout_cart" && $actionName == "index")) {
27
+ $allItems = Mage::getModel('checkout/cart')->getQuote()->getAllVisibleItems();
28
  foreach ($allItems as $item) {
29
  $itemArr['id'] = $item->getProductId();
30
  $itemArr['name'] = $item->getName();
34
  _rsq.push(['_setAction', 'shopping_cart']);
35
  <?php }
36
 
37
+ if(($moduleName=="checkout" && $controllerName=="onepage" && $actionName=="success") || ($moduleName=="onestepcheckout" && $controllerName=="index" && $actionName=="success") || ($moduleName=="solecheckout" && $controllerName=="success" && $actionName=="index")){
38
  $order = $this->getOrder();
39
  if (empty($user_id_set)) {
40
  $user_record_id = md5(trim(strtolower($order->getCustomerEmail()))); ?>
42
  _rsq.push(['_setUserId', '<?php echo $user_record_id; ?>']);
43
  <?php }
44
 
45
+ // Use getAllVisibleItems for parent products
46
+ // - getAllItems() will have all child products too
47
+ $allitems = $order->getAllVisibleItems();
48
  foreach($allitems as $item){
49
  $itemArr['id'] = $item->getProductId();
50
  $itemArr['name'] = $item->getName();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>RetentionScience_Waves</name>
4
- <version>2.2.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,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. &#xD;
17
  &#xD;
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>Upgraded waves JS</notes>
20
  <authors><author><name>Retention Science</name><user>auto-converted</user><email>support@retentionscience.com</email></author></authors>
21
- <date>2013-07-15</date>
22
- <time>19:19:54</time>
23
- <contents><target name="magecommunity"><dir name="RetentionScience"><dir name="Waves"><dir name="Block"><dir name="Adminhtml"><file name="Rscore.php" hash="ddaa6fcc9b7c7448ca4546e28ded58f3"/><file name="Syncbutton.php" hash="f0e364d31e12bffd40a13e88bce3bc97"/></dir><file name="Waves.php" hash="e40dffc0ab52847e560182196a252291"/><file name=".DS_Store" hash="9d0f8114c9a54f73944ba316a2c47467"/></dir><dir name="Helper"><file name="Data.php" hash="90490af254a670d4795b744c1ef4319e"/><file name="Storeselect.php" hash="dbfeb7a4e9e1f5c52fdbc2eac9370fcf"/></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="8911fb34a76fed31b9e20a6a9fea0712"/><file name="Cronconfig.php" hash="f2dd3dcd572bd7407663576e250f9d23"/><file name="Rscoredata.php" hash="178f70a1f05415c86b6c5e959fb2fe50"/></dir><file name="Observer.php" hash="bdf08ae6ff20ba85878ca8e368cd9c1a"/><file name="retention_science_api.php" hash="d9d5197492408502cf6084f19def5aa0"/><file name="rs_get_save_config.php" hash="9ff13acecc3cc89066e1476ee48459fb"/><file name="rs_send_categories.php" hash="1633b1c1b01a9c3666c0687586693102"/><file name="rs_send_orders.php" hash="1b4f0260e74fbe11436af16238ecd61b"/><file name="rs_send_products.php" hash="c54656d728ad1c91185be35dd27f86d2"/><file name="rs_send_users.php" hash="0e27f4293d666c35e90ebb852ae83fb7"/><file name="rs_sync_data.php" hash="5b7ed9f5e50e26b343cae9578bf053bd"/></dir><dir name="controllers"><file name="AdminController.php" hash="25905c7233adde08763a74d8792e722f"/><file name="IndexController.php" hash="281b3223e4b71858ec0b43739bcdf97d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1378650fdb7ecc596f9881d7eefca868"/><file name="config.xml" hash="5aa9dd1c7cbb187089dc4a971ec35621"/><file name="system.xml" hash="b2d00b02e576c1ee4049951577d74610"/></dir><file name=".DS_Store" hash="23698de108708cadf80a5a90b7b2b05a"/></dir><file name=".DS_Store" hash="128e595394427daa0503e6d824d6b4ef"/></dir></target><target name="mageweb"><dir name="js"><dir name="RetentionScience"><file name="retention_science_wave.js" hash="bbb32a179f6b6f7f8a19ee3e200b8178"/></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="d41683122fc4b8704d9bd1bda7e371ab"/></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="4f6af3dd918b23a009bb559e12f23c05"/></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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>RetentionScience_Waves</name>
4
+ <version>2.3.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. &#xD;
17
  &#xD;
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>Default using compression, visible items, and using our new product collection model</notes>
20
  <authors><author><name>Retention Science</name><user>auto-converted</user><email>support@retentionscience.com</email></author></authors>
21
+ <date>2013-07-30</date>
22
+ <time>19:50:24</time>
23
+ <contents><target name="magecommunity"><dir name="RetentionScience"><dir name="Waves"><dir name="Block"><dir name="Adminhtml"><file name="Rscore.php" hash="ddaa6fcc9b7c7448ca4546e28ded58f3"/><file name="Syncbutton.php" hash="f0e364d31e12bffd40a13e88bce3bc97"/></dir><file name="Waves.php" hash="e40dffc0ab52847e560182196a252291"/></dir><dir name="Helper"><file name="Data.php" hash="90490af254a670d4795b744c1ef4319e"/><file name="Storeselect.php" hash="dbfeb7a4e9e1f5c52fdbc2eac9370fcf"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="8015a634da59c97e797355abc44b8268"/></dir></dir><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="027feb7796f79b7cf811c4236ad7b87a"/><file name="Hours.php" hash="0ab9157003d5e7efed402ed401a46134"/></dir><file name="Categorytree.php" hash="8911fb34a76fed31b9e20a6a9fea0712"/><file name="Cronconfig.php" hash="f2dd3dcd572bd7407663576e250f9d23"/><file name="Rscoredata.php" hash="178f70a1f05415c86b6c5e959fb2fe50"/></dir><file name="Observer.php" hash="38539aafe8d9f52c55a9c4f65ed3ef38"/><file name="retention_science_api.php" hash="d9d5197492408502cf6084f19def5aa0"/><file name="rs_get_save_config.php" hash="9ff13acecc3cc89066e1476ee48459fb"/><file name="rs_send_categories.php" hash="1633b1c1b01a9c3666c0687586693102"/><file name="rs_send_orders.php" hash="1b4f0260e74fbe11436af16238ecd61b"/><file name="rs_send_products.php" hash="4430ecc6000698fc2fcd0c469ab97847"/><file name="rs_send_users.php" hash="0e27f4293d666c35e90ebb852ae83fb7"/><file name="rs_sync_data.php" hash="09185eab133aadf1142892372f698dfa"/></dir><dir name="controllers"><file name="AdminController.php" hash="25905c7233adde08763a74d8792e722f"/><file name="IndexController.php" hash="70e254ab63b9ea8c9d0cae2fe96d1f8b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1378650fdb7ecc596f9881d7eefca868"/><file name="config.xml" hash="0030d762fbe54dfa0558b952599ea273"/><file name="system.xml" hash="b2d00b02e576c1ee4049951577d74610"/></dir></dir><file name=".DS_Store" hash="128e595394427daa0503e6d824d6b4ef"/></dir></target><target name="mageweb"><dir name="js"><dir name="RetentionScience"><file name="retention_science_wave.js" hash="bbb32a179f6b6f7f8a19ee3e200b8178"/></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="0b9f206668a56c8da4cb7da6dc94850c"/></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="4f6af3dd918b23a009bb559e12f23c05"/></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>