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 +0 -0
- app/code/community/RetentionScience/Waves/Block/.DS_Store +0 -0
- app/code/community/RetentionScience/Waves/Model/Mysql4/Product/Collection.php +34 -0
- app/code/community/RetentionScience/Waves/Model/Observer.php +159 -145
- app/code/community/RetentionScience/Waves/Model/rs_send_products.php +4 -2
- app/code/community/RetentionScience/Waves/Model/rs_sync_data.php +6 -0
- app/code/community/RetentionScience/Waves/controllers/IndexController.php +1 -1
- app/code/community/RetentionScience/Waves/etc/config.xml +2 -1
- app/design/frontend/base/default/template/waves/waves.phtml +5 -3
- package.xml +5 -5
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 |
-
|
| 294 |
-
|
|
|
|
| 295 |
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 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()->
|
| 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.
|
| 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()->
|
| 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
|
| 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 |
-
|
|
|
|
|
|
|
| 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.
|
| 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-07-
|
| 22 |
-
<time>19:
|
| 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"
|
| 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. 
|
| 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>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>
|
