Cue - Version 3.0.20

Version Notes

- Improvements and bugfixes

Download this release

Release Info

Developer Développeurs EnvoiMoinsCher.com
Extension Cue
Version 3.0.20
Comparing to
See all releases


Code changes from version 3.0.19 to 3.0.20

app/code/community/CueConnect/Cue/Block/Adminhtml/System/Config/.DS_Store DELETED
Binary file
app/code/community/CueConnect/Cue/Block/Adminhtml/System/Config/._.DS_Store DELETED
Binary file
app/code/community/CueConnect/Cue/Block/Checkout/Success/Share.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Block_Checkout_Success_Share extends CueConnect_Cue_Block_BaseCueBlock
13
+ {
14
+ const CUE_CART_TRACK_URL = 'https://api.cueconnect.com/imi/cart_track/json';
15
+ protected $_firstProductSku = null;
16
+ protected $_order = null;
17
+ protected $_itemsData = null;
18
+
19
+ /**
20
+ * Internal constructor
21
+ */
22
+ protected function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_getOrderItemsData();
26
+ }
27
+
28
+ /**
29
+ * Get product SKU from the first order item
30
+ *
31
+ * @return string|bool
32
+ */
33
+ public function getFirstProductSku()
34
+ {
35
+ return $this->_firstProductSku;
36
+ }
37
+
38
+ /**
39
+ * Get items data
40
+ *
41
+ * @return null
42
+ */
43
+ public function getItemsData()
44
+ {
45
+ return $this->_getOrderItemsData();
46
+ }
47
+
48
+ /**
49
+ * Get tracking source
50
+ *
51
+ * @return string
52
+ */
53
+ public function getTrackingSource()
54
+ {
55
+ $str = self::CUE_CART_TRACK_URL .
56
+ '?api_key=' . $this->getApiKey() .
57
+ '&place_id=' . $this->getRetailerId() .
58
+ '&email=' . $this->_getOrder()->getCustomerEmail() .
59
+ '&cart=' . json_encode($this->getItemsData()) .
60
+ '&order_id=' . $this->_getOrder()->getId();
61
+
62
+ return $this->escapeUrl($str);
63
+ }
64
+
65
+ /**
66
+ * Get order (onepage|multishipping)
67
+ *
68
+ * @return Mage_Sales_Model_Order
69
+ */
70
+ protected function _getOrder()
71
+ {
72
+ if (is_null($this->_order)) {
73
+ $session = Mage::getSingleton('checkout/session');
74
+ $order = $session->getLastRealOrder();
75
+ if (!$order->getId()) {
76
+ $orderId = $session->getFirstOrderId(true);
77
+ if ($orderId) {
78
+ $order = Mage::getModel('sales/order')->load($orderId);
79
+ }
80
+ }
81
+ $this->_order = $order ? $order : false;
82
+ }
83
+
84
+ return $this->_order;
85
+ }
86
+
87
+ /**
88
+ * Get and prepare order item data (get product sku's)
89
+ *
90
+ * @return array
91
+ */
92
+ protected function _getOrderItemsData()
93
+ {
94
+ if (is_null($this->_itemsData)) {
95
+ $productIds = array();
96
+ $itemData = array();
97
+ $order = $this->_getOrder();
98
+ if ($order->getId()) {
99
+ foreach ($order->getAllItems() as $item) {
100
+ $productIds[] = $item->getProductId();
101
+ }
102
+ if (count($productIds)) {
103
+ $productSkus = Mage::helper('cueconnect/product')->getProductSkusByIds($productIds);
104
+ }
105
+ foreach ($order->getAllItems() as $item) {
106
+ $productId = $item->getProductId();
107
+ $productSku = array_key_exists($productId, $productSkus) ? $productSkus[$productId] : false;
108
+ if (is_null($this->_firstProductSku)) {
109
+ $this->_firstProductSku = $productSku;
110
+ }
111
+ if ($productSku) {
112
+ $itemData[$productSku] = $item->getQtyOrdered() * 1;
113
+ }
114
+ }
115
+ }
116
+ $this->_itemsData = $itemData;
117
+ }
118
+
119
+ return $this->_itemsData;
120
+ }
121
+
122
+ /**
123
+ * Checks if Tracking is enabled
124
+ *
125
+ * @return bool
126
+ */
127
+ public function isTrackingEnabled()
128
+ {
129
+ return Mage::helper('cueconnect')->isTrackingEnabled();
130
+ }
131
+ }
app/code/community/CueConnect/Cue/Block/System/Config/Customerresync.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Block_System_Config_Customerresync extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+ /**
15
+ * Set template to itself
16
+ *
17
+ * @return CueConnect_Cue_Block_System_Config_Customerresync
18
+ */
19
+ protected function _prepareLayout()
20
+ {
21
+ parent::_prepareLayout();
22
+ if (!$this->getTemplate()) {
23
+ $this->setTemplate('cueconnect/customerresync.phtml');
24
+ }
25
+
26
+ return $this;
27
+ }
28
+
29
+ /**
30
+ * Unset some non-related element parameters
31
+ *
32
+ * @param Varien_Data_Form_Element_Abstract $element
33
+ * @return string
34
+ */
35
+ public function render(Varien_Data_Form_Element_Abstract $element)
36
+ {
37
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
38
+ return parent::render($element);
39
+ }
40
+
41
+ /**
42
+ * Get the button and scripts contents if needed
43
+ *
44
+ * @param Varien_Data_Form_Element_Abstract $element
45
+ * @return string
46
+ */
47
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
48
+ {
49
+ $showButton = Mage::getModel('cueconnect/observer')->isCustomerReSyncNeeded();
50
+ if (!$showButton) {
51
+
52
+ return '';
53
+ }
54
+ $originalData = $element->getOriginalData();
55
+ $this->addData(array(
56
+ 'button_label' => Mage::helper('cueconnect')->__($originalData['button_label']),
57
+ 'html_id' => $element->getHtmlId(),
58
+ 'ajax_url' => $this->getUrl('cueconnect/adminhtml_system_config_customersync/index')
59
+ ));
60
+
61
+ return $this->_toHtml();
62
+ }
63
+ }
app/code/community/CueConnect/Cue/Block/System/Config/Productresync.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Block_System_Config_Productresync extends Mage_Adminhtml_Block_System_Config_Form_Field
13
+ {
14
+ /**
15
+ * Set template to itself
16
+ *
17
+ * @return CueConnect_Cue_Block_System_Config_Productresync
18
+ */
19
+ protected function _prepareLayout()
20
+ {
21
+ parent::_prepareLayout();
22
+ if (!$this->getTemplate()) {
23
+ $this->setTemplate('cueconnect/productresync.phtml');
24
+ }
25
+
26
+ return $this;
27
+ }
28
+
29
+ /**
30
+ * Unset some non-related element parameters
31
+ *
32
+ * @param Varien_Data_Form_Element_Abstract $element
33
+ * @return string
34
+ */
35
+ public function render(Varien_Data_Form_Element_Abstract $element)
36
+ {
37
+ $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
38
+ return parent::render($element);
39
+ }
40
+
41
+ /**
42
+ * Get the button and scripts contents if needed
43
+ *
44
+ * @param Varien_Data_Form_Element_Abstract $element
45
+ * @return string
46
+ */
47
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
48
+ {
49
+ $showButton = Mage::getModel('cueconnect/cueconnect')->isProductReSyncNeeded();
50
+ if (!$showButton) {
51
+
52
+ return '';
53
+ }
54
+ $originalData = $element->getOriginalData();
55
+ $this->addData(array(
56
+ 'button_label' => Mage::helper('cueconnect')->__($originalData['button_label']),
57
+ 'html_id' => $element->getHtmlId(),
58
+ 'ajax_url' => $this->getUrl('cueconnect/adminhtml_system_config_productsync/index')
59
+ ));
60
+
61
+ return $this->_toHtml();
62
+ }
63
+ }
app/code/community/CueConnect/Cue/Helper/Data.php CHANGED
@@ -11,6 +11,29 @@
11
 
12
  class CueConnect_Cue_Helper_Data extends Mage_Core_Helper_Abstract
13
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * Get webhook URL for adding customers to Cue
16
  *
11
 
12
  class CueConnect_Cue_Helper_Data extends Mage_Core_Helper_Abstract
13
  {
14
+ const XML_PATH_MYLIST_ENABLED = 'cueconnect/collection/enabled';
15
+ const XML_PATH_TRACKING_ENABLED = 'cueconnect/tracking/enabled';
16
+
17
+ /**
18
+ * Checks if My List is enabled
19
+ *
20
+ * @return bool
21
+ */
22
+ public function isMyListEnabled()
23
+ {
24
+ return Mage::getStoreConfigFlag(self::XML_PATH_MYLIST_ENABLED);
25
+ }
26
+
27
+ /**
28
+ * Checks if Tracking is enabled
29
+ *
30
+ * @return bool
31
+ */
32
+ public function isTrackingEnabled()
33
+ {
34
+ return Mage::getStoreConfigFlag(self::XML_PATH_TRACKING_ENABLED);
35
+ }
36
+
37
  /**
38
  * Get webhook URL for adding customers to Cue
39
  *
app/code/community/CueConnect/Cue/Helper/Product.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Helper_Product extends Mage_Core_Helper_Abstract
13
+ {
14
+ /**
15
+ * Get product SKU's by ID's
16
+ *
17
+ * @param string $productIds
18
+ * @return string
19
+ */
20
+ public function getProductSkusByIds($productIds)
21
+ {
22
+ $adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
23
+ $productTableName = Mage::getSingleton('core/resource')->getTableName('catalog/product');
24
+ $select = $adapter->select()
25
+ ->from($productTableName, array('entity_id', 'sku'))
26
+ ->where('entity_id IN (?)', $productIds);
27
+
28
+ return $adapter->fetchPairs($select);
29
+ }
30
+ }
app/code/community/CueConnect/Cue/Model/CueConnect.php DELETED
@@ -1,297 +0,0 @@
1
- <?php
2
- /**
3
- * CueConnect_Cue
4
- *
5
- * @category CueConnect
6
- * @package CueConnect_Cue
7
- * @copyright Copyright (c) 2015 Cue Connect
8
- * @author Cue Connect (http://www.cueconnect.com)
9
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
- */
11
-
12
- class CueConnect_Cue_Model_CueConnect extends Mage_Core_Model_Abstract
13
- {
14
- /**
15
- * Construct
16
- */
17
- public function _construct() {
18
- $this->_init('cueconnect/cueconnect');
19
- }
20
-
21
- /**
22
- * Execute export and put result in message box
23
- */
24
- public static function dailyExport() {
25
- if (Mage::getStoreConfig('cueconnect/cron/enabled')) {
26
- // Execute export() for each stores
27
- foreach (Mage::app()->getStores() as $store) {
28
- if ($store->getConfig('cueconnect/enabled/enabled')) {
29
- // Export
30
- $result = self::export($store);
31
-
32
- // Notification
33
- $inbox = Mage::getModel('adminnotification/inbox');
34
- if ($result['success']) {
35
- $inbox->addNotice(sprintf("%s products has been successfully synced with Cue.", $store->getName()), $result['message']);
36
- }
37
- else {
38
- $inbox->addCritical(sprintf("%s products has not been successfully synced with Cue.", $store->getName()), $result['message']);
39
- }
40
- }
41
- }
42
- }
43
- }
44
-
45
- /**
46
- * Execute export if manually asked and put result in message box
47
- */
48
- public static function manualExport() {
49
- // Check for demands
50
- $demand = Mage::getModel('cueconnect/demand');
51
- $awaiting_demands = Mage::getModel('cueconnect/demand')
52
- ->getCollection()
53
- ->addFilter('status', $demand::STATUS_WAITING);
54
-
55
- if (count($awaiting_demands)) {
56
- // Update demands
57
- foreach ($awaiting_demands as $awaiting_demand) {
58
- $awaiting_demand->setStatus($demand::STATUS_PROGRESSING);
59
- $awaiting_demand->setUpdatedAt(date('Y-m-d H:i:s'));
60
- $awaiting_demand->save();
61
- }
62
-
63
- // Execute export() for each stores
64
- foreach (Mage::app()->getStores() as $store) {
65
- if ($store->getConfig('cueconnect/enabled/enabled')) {
66
- // Export
67
- $result = self::export($store);
68
-
69
- // Log
70
- $log = $result['log'];
71
- $log['end_at'] = date('Y-m-d H:i:s');
72
-
73
- // Notification
74
- $inbox = Mage::getModel('adminnotification/inbox');
75
- if ($result['success']) {
76
- $inbox->addNotice(sprintf("%s products has been successfully synced with Cue.", $store->getName()), $result['message']);
77
- }
78
- else {
79
- $inbox->addCritical(sprintf("%s products has not been successfully synced with Cue.", $store->getName()), $result['message']);
80
- $log['status'] = 'error';
81
- }
82
-
83
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
84
- }
85
- }
86
-
87
- // Update demands
88
- foreach ($awaiting_demands as $awaiting_demand) {
89
- $awaiting_demand->setStatus($demand::STATUS_DONE);
90
- $awaiting_demand->setUpdatedAt(date('Y-m-d H:i:s'));
91
- $awaiting_demand->save();
92
- }
93
- }
94
- }
95
-
96
- /**
97
- * Export catalog products to Cue
98
- */
99
- public static function export($store) {
100
- // Log
101
- $log = array();
102
- $log['started_at'] = date('Y-m-d H:i:s');
103
- $log['status'] = "progressing";
104
- $log['store'] = $store->getName();
105
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
106
-
107
- // Check if crententials has been filled
108
- if (!$store->getConfig('cueconnect/credentials/login') || !$store->getConfig('cueconnect/credentials/password')) {
109
- $message = "Cue credentials are not filled.";
110
- return array('success' => false, 'message' => $message, 'log' => $log);
111
- }
112
-
113
- // Retailuser WS
114
- $soap_client = Mage::helper('cueconnect')->getSoapClient(
115
- Mage::helper('cueconnect')->getWsUrl('retailuser'),
116
- $store->getConfig('cueconnect/credentials/login'),
117
- $store->getConfig('cueconnect/credentials/password')
118
- );
119
-
120
- // Get place ID
121
- $place_id = null;
122
- try {
123
- $result = $soap_client->get(array(
124
- 'email' => $store->getConfig('cueconnect/credentials/login')
125
- ));
126
- $place_id = $result->data->id;
127
- }
128
- catch (Exception $e) {
129
- $message = $e->getMessage();
130
- return array('success' => false, 'message' => $message, 'log' => $log);
131
- }
132
-
133
- // Product WS
134
- $soap_client = Mage::helper('cueconnect')->getSoapClient(
135
- Mage::helper('cueconnect')->getWsUrl('product'),
136
- $store->getConfig('cueconnect/credentials/login'),
137
- $store->getConfig('cueconnect/credentials/password')
138
- );
139
-
140
- // Get Cue Catalog
141
- $cueconnect_products = array();
142
- $results = $soap_client->get(array('page' => 1, 'pagesize' => 100000, 'clipped' => false));
143
- foreach ($results->data as $result) {
144
- if ($result->sku) {
145
- $cueconnect_products[$result->sku] = $result;
146
- }
147
- }
148
-
149
- // Catalog products
150
- $catalog_products = Mage::getModel('catalog/product')
151
- ->getCollection()
152
- ->addAttributeToSelect('name')
153
- ->addAttributeToSelect('description')
154
- ->addAttributeToSelect('price')
155
- ->addAttributeToSelect('image')
156
- ->addAttributeToSelect('url_path')
157
- ->addStoreFilter($store->getId());
158
- $catalog_products_skus = array();
159
- $new_data = array();
160
- $updated_data = array();
161
- foreach ($catalog_products as $catalog_product) {
162
- $catalog_products_skus[] = $catalog_product->getSku();
163
-
164
- // Product image
165
- $icon = "http://www.cueconnect.com/images/no_image.gif";
166
- if ($catalog_product->getData('image')) {
167
- $icon = $catalog_product->getMediaConfig()->getMediaUrl($catalog_product->getData('image'));
168
- }
169
-
170
- // Product URL
171
- $url = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK).$catalog_product->getUrlPath();
172
-
173
- // Check if product exists in Cue database
174
- if (in_array($catalog_product->getSku(), array_keys($cueconnect_products))) {
175
- $updated_data[] = array(
176
- 'product_imic' => null,
177
- 'sku' => $catalog_product->getSku(),
178
- 'name' => $catalog_product->getName(),
179
- 'description' => $catalog_product->getDescription(),
180
- 'sms_name' => $catalog_product->getName(),
181
- 'sms_desc' => $catalog_product->getDescription(),
182
- 'url' => $url,
183
- 'taxonomy_id' => Mage::getStoreConfig('cueconnect/taxomomy_id'),
184
- 'icon' => $icon,
185
- 'live' => '1',
186
- 'price' => $catalog_product->getPrice()
187
- );
188
- }
189
- else {
190
- $new_data[] = array(
191
- 'sku' => $catalog_product->getSku(),
192
- 'upc' => uniqid(),
193
- 'name' => $catalog_product->getName(),
194
- 'description' => $catalog_product->getDescription(),
195
- 'sms_name' => $catalog_product->getName(),
196
- 'sms_desc' => $catalog_product->getDescription(),
197
- 'url' => $url,
198
- 'taxonomy_id' => Mage::getStoreConfig('cueconnect/taxomomy_id'),
199
- 'icon' => $icon,
200
- 'live' => '1',
201
- 'price' => $catalog_product->getPrice()
202
- );
203
- }
204
- }
205
- // Product to delete
206
- $skus_to_delete = array_diff(array_keys($cueconnect_products), $catalog_products_skus);
207
- $imics_to_delete = array();
208
- foreach ($skus_to_delete as $sku_to_delete) {
209
- $imics_to_delete[] = $cueconnect_products[$sku_to_delete]->product_imic;
210
- }
211
-
212
- // Log
213
- $log['total_products'] = count($catalog_products);
214
- $log['total_products_to_create'] = count($new_data);
215
- $log['total_products_to_update'] = count($updated_data);
216
- $log['total_products_to_delete'] = count($imics_to_delete);
217
- $log['total_products_created'] = 0;
218
- $log['total_products_updated'] = 0;
219
- $log['total_products_deleted'] = 0;
220
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
221
-
222
- // Send new data data to Cue (per slices)
223
- if (count($new_data)) {
224
- $new_data_slices = Mage::helper('cueconnect')->getSlicesFromArray($new_data, 20);
225
- foreach ($new_data_slices as $new_data_slice) {
226
- try {
227
- $soap_client->create(array(
228
- 'place_id' => $place_id,
229
- 'data' => $new_data_slice,
230
- 'count' => count($new_data_slice)
231
- ));
232
- // Log
233
- $log['total_products_created'] = $log['total_products_created'] + count($new_data_slice);
234
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
235
- }
236
- catch (Exception $e) {
237
- return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
238
- }
239
- }
240
- }
241
-
242
- // Send updated data data to Cue (per slices)
243
- if (count($updated_data)) {
244
- $updated_data_slices = Mage::helper('cueconnect')->getSlicesFromArray($updated_data, 20);
245
- foreach ($updated_data_slices as $updated_data_slice) {
246
- try {
247
- $soap_client->set(array(
248
- 'place_id' => $place_id,
249
- 'data' => $updated_data_slice,
250
- 'count' => count($updated_data_slice)
251
- ));
252
- // Log
253
- $log['total_products_updated'] = $log['total_products_updated'] + count($updated_data_slice);
254
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
255
- }
256
- catch (Exception $e) {
257
- return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
258
- }
259
- }
260
- }
261
-
262
- // Delete products which are not in the Magento catalog anymore
263
- if (count($imics_to_delete)) {
264
- $imics_to_delete_slices = Mage::helper('cueconnect')->getSlicesFromArray($imics_to_delete, 50);
265
- foreach ($imics_to_delete_slices as $imics_to_delete_slice) {
266
- try {
267
- $soap_client->delete(array(
268
- 'place_id' => $place_id,
269
- 'data' => $imics_to_delete_slice,
270
- 'count' => count($imics_to_delete_slice)
271
- ));
272
- // Log
273
- $log['total_products_deleted'] = $log['total_products_deleted'] + count($imics_to_delete_slice);
274
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
275
- }
276
- catch (Exception $e) {
277
- return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
278
- }
279
- }
280
- }
281
-
282
- // Log
283
- $log['end_at'] = date('Y-m-d H:i:s');
284
- $log['status'] = "done";
285
- Mage::helper('cueconnect')->logExportProgress(json_encode($log));
286
-
287
- // Return
288
- return array(
289
- 'success' => true,
290
- 'created_count' => count($new_data),
291
- 'updated_count' => count($updated_data),
292
- 'deleted_count' => count($imics_to_delete),
293
- 'message' => sprintf("%s product(s) has been created. %s product(s) has been updated. %s product(s) has been deleted.", count($new_data), count($updated_data), count($imics_to_delete)),
294
- 'log' => $log
295
- );
296
- }
297
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/CueConnect/Cue/Model/Cueconnect.php ADDED
@@ -0,0 +1,780 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Model_CueConnect extends Mage_Core_Model_Abstract
13
+ {
14
+ const CUE_GET_PAGE_SIZE = 100000;
15
+ const CUE_SET_PAGE_SIZE = 20;
16
+ const CUE_COLLECTION_PAGE_SIZE = 100;
17
+ const CUE_ERROR_MESSAGE_PRODUCT_SYNC = 'An error occurred while synchronization product data with Cueconnect for
18
+ the %s store. You can find more details in the log file.';
19
+ const XML_PATH_PRODUCT_SYNC_STATUS = 'cueconnect/product_sync_%s/status';
20
+ const XML_PATH_PRODUCT_LAST_SYNCED_PRODUCT = 'cueconnect/product_sync_%s/last_synced_product';
21
+ const XML_PATH_PRODUCT_SYNC_SCHEDULED = 'cueconnect/product_sync/scheduled';
22
+ const XML_PATH_CUE_SUPPORT_EMAIL = 'cueconnect/support/email';
23
+ const XML_PATH_CUE_SUPPORT_NAME = 'cueconnect/support/name';
24
+ const XML_PATH_CUE_SUPPORT_SUBJECT = 'cueconnect/support/subject';
25
+ const PRODUCT_SYNC_FAILED = 'failed';
26
+ const PRODUCT_SYNC_COMPLETE = 'complete';
27
+ const PRODUCT_SYNC_PROCESSING = 'processing';
28
+
29
+ protected $_cueLogin = false;
30
+ protected $_cuePassword = false;
31
+ protected $_placeId = false;
32
+ protected $_productSoapClient = false;
33
+ protected $_store = false;
34
+ protected $_cueProducts = array();
35
+ protected $_newData = array();
36
+ protected $_updateData = array();
37
+ protected $_errors = array();
38
+ protected $_lastProductId = false;
39
+
40
+ /**
41
+ * Construct
42
+ */
43
+ public function _construct() {
44
+ $this->_init('cueconnect/cueconnect');
45
+ }
46
+
47
+ /**
48
+ * Execute export and put result in message box
49
+ */
50
+ public static function dailyExport() {
51
+ if (Mage::getStoreConfig('cueconnect/cron/enabled')) {
52
+ // Execute export() for each stores
53
+ foreach (Mage::app()->getStores() as $store) {
54
+ if ($store->getConfig('cueconnect/enabled/enabled')) {
55
+ // Export
56
+ $result = self::export($store);
57
+
58
+ // Notification
59
+ $inbox = Mage::getModel('adminnotification/inbox');
60
+ if ($result['success']) {
61
+ $inbox->addNotice(sprintf("%s products has been successfully synced with Cue.", $store->getName()), $result['message']);
62
+ }
63
+ else {
64
+ $inbox->addCritical(sprintf("%s products has not been successfully synced with Cue.", $store->getName()), $result['message']);
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Execute export if manually asked and put result in message box
73
+ */
74
+ public static function manualExport() {
75
+ // Check for demands
76
+ $demand = Mage::getModel('cueconnect/demand');
77
+ $awaiting_demands = Mage::getModel('cueconnect/demand')
78
+ ->getCollection()
79
+ ->addFilter('status', $demand::STATUS_WAITING);
80
+
81
+ if (count($awaiting_demands)) {
82
+ // Update demands
83
+ foreach ($awaiting_demands as $awaiting_demand) {
84
+ $awaiting_demand->setStatus($demand::STATUS_PROGRESSING);
85
+ $awaiting_demand->setUpdatedAt(date('Y-m-d H:i:s'));
86
+ $awaiting_demand->save();
87
+ }
88
+
89
+ // Execute export() for each stores
90
+ foreach (Mage::app()->getStores() as $store) {
91
+ if ($store->getConfig('cueconnect/enabled/enabled')) {
92
+ // Export
93
+ $result = self::export($store);
94
+
95
+ // Log
96
+ $log = $result['log'];
97
+ $log['end_at'] = date('Y-m-d H:i:s');
98
+
99
+ // Notification
100
+ $inbox = Mage::getModel('adminnotification/inbox');
101
+ if ($result['success']) {
102
+ $inbox->addNotice(sprintf("%s products has been successfully synced with Cue.", $store->getName()), $result['message']);
103
+ }
104
+ else {
105
+ $inbox->addCritical(sprintf("%s products has not been successfully synced with Cue.", $store->getName()), $result['message']);
106
+ $log['status'] = 'error';
107
+ }
108
+
109
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
110
+ }
111
+ }
112
+
113
+ // Update demands
114
+ foreach ($awaiting_demands as $awaiting_demand) {
115
+ $awaiting_demand->setStatus($demand::STATUS_DONE);
116
+ $awaiting_demand->setUpdatedAt(date('Y-m-d H:i:s'));
117
+ $awaiting_demand->save();
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Export catalog products to Cue
124
+ */
125
+ public static function export($store) {
126
+ // Log
127
+ $log = array();
128
+ $log['started_at'] = date('Y-m-d H:i:s');
129
+ $log['status'] = "progressing";
130
+ $log['store'] = $store->getName();
131
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
132
+
133
+ // Check if crententials has been filled
134
+ if (!$store->getConfig('cueconnect/credentials/login') || !$store->getConfig('cueconnect/credentials/password')) {
135
+ $message = "Cue credentials are not filled.";
136
+ return array('success' => false, 'message' => $message, 'log' => $log);
137
+ }
138
+
139
+ // Retailuser WS
140
+ $soap_client = Mage::helper('cueconnect')->getSoapClient(
141
+ Mage::helper('cueconnect')->getWsUrl('retailuser'),
142
+ $store->getConfig('cueconnect/credentials/login'),
143
+ $store->getConfig('cueconnect/credentials/password')
144
+ );
145
+
146
+ // Get place ID
147
+ $place_id = null;
148
+ try {
149
+ $result = $soap_client->get(array(
150
+ 'email' => $store->getConfig('cueconnect/credentials/login')
151
+ ));
152
+ $place_id = $result->data->id;
153
+ }
154
+ catch (Exception $e) {
155
+ $message = $e->getMessage();
156
+ return array('success' => false, 'message' => $message, 'log' => $log);
157
+ }
158
+
159
+ // Product WS
160
+ $soap_client = Mage::helper('cueconnect')->getSoapClient(
161
+ Mage::helper('cueconnect')->getWsUrl('product'),
162
+ $store->getConfig('cueconnect/credentials/login'),
163
+ $store->getConfig('cueconnect/credentials/password')
164
+ );
165
+
166
+ // Get Cue Catalog
167
+ $cueconnect_products = array();
168
+ $results = $soap_client->get(array('page' => 1, 'pagesize' => 100000, 'clipped' => false));
169
+ foreach ($results->data as $result) {
170
+ if ($result->sku) {
171
+ $cueconnect_products[$result->sku] = $result;
172
+ }
173
+ }
174
+
175
+ // Catalog products
176
+ $catalog_products = Mage::getModel('catalog/product')
177
+ ->getCollection()
178
+ ->addAttributeToSelect('name')
179
+ ->addAttributeToSelect('description')
180
+ ->addAttributeToSelect('price')
181
+ ->addAttributeToSelect('image')
182
+ ->addAttributeToSelect('url_path')
183
+ ->addStoreFilter($store->getId());
184
+ $catalog_products_skus = array();
185
+ $new_data = array();
186
+ $updated_data = array();
187
+ foreach ($catalog_products as $catalog_product) {
188
+ $catalog_products_skus[] = $catalog_product->getSku();
189
+
190
+ // Product image
191
+ $icon = "http://www.cueconnect.com/images/no_image.gif";
192
+ if ($catalog_product->getData('image')) {
193
+ $icon = $catalog_product->getMediaConfig()->getMediaUrl($catalog_product->getData('image'));
194
+ }
195
+
196
+ // Product URL
197
+ $url = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK).$catalog_product->getUrlPath();
198
+
199
+ // Check if product exists in Cue database
200
+ if (in_array($catalog_product->getSku(), array_keys($cueconnect_products))) {
201
+ $updated_data[] = array(
202
+ 'product_imic' => null,
203
+ 'sku' => $catalog_product->getSku(),
204
+ 'name' => $catalog_product->getName(),
205
+ 'description' => $catalog_product->getDescription(),
206
+ 'sms_name' => $catalog_product->getName(),
207
+ 'sms_desc' => $catalog_product->getDescription(),
208
+ 'url' => $url,
209
+ 'taxonomy_id' => Mage::getStoreConfig('cueconnect/taxomomy_id'),
210
+ 'icon' => $icon,
211
+ 'live' => '1',
212
+ 'price' => $catalog_product->getPrice()
213
+ );
214
+ }
215
+ else {
216
+ $new_data[] = array(
217
+ 'sku' => $catalog_product->getSku(),
218
+ 'upc' => uniqid(),
219
+ 'name' => $catalog_product->getName(),
220
+ 'description' => $catalog_product->getDescription(),
221
+ 'sms_name' => $catalog_product->getName(),
222
+ 'sms_desc' => $catalog_product->getDescription(),
223
+ 'url' => $url,
224
+ 'taxonomy_id' => Mage::getStoreConfig('cueconnect/taxomomy_id'),
225
+ 'icon' => $icon,
226
+ 'live' => '1',
227
+ 'price' => $catalog_product->getPrice()
228
+ );
229
+ }
230
+ }
231
+ // Product to delete
232
+ $skus_to_delete = array_diff(array_keys($cueconnect_products), $catalog_products_skus);
233
+ $imics_to_delete = array();
234
+ foreach ($skus_to_delete as $sku_to_delete) {
235
+ $imics_to_delete[] = $cueconnect_products[$sku_to_delete]->product_imic;
236
+ }
237
+
238
+ // Log
239
+ $log['total_products'] = count($catalog_products);
240
+ $log['total_products_to_create'] = count($new_data);
241
+ $log['total_products_to_update'] = count($updated_data);
242
+ $log['total_products_to_delete'] = count($imics_to_delete);
243
+ $log['total_products_created'] = 0;
244
+ $log['total_products_updated'] = 0;
245
+ $log['total_products_deleted'] = 0;
246
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
247
+
248
+ // Send new data data to Cue (per slices)
249
+ if (count($new_data)) {
250
+ $new_data_slices = Mage::helper('cueconnect')->getSlicesFromArray($new_data, 20);
251
+ foreach ($new_data_slices as $new_data_slice) {
252
+ try {
253
+ $soap_client->create(array(
254
+ 'place_id' => $place_id,
255
+ 'data' => $new_data_slice,
256
+ 'count' => count($new_data_slice)
257
+ ));
258
+ // Log
259
+ $log['total_products_created'] = $log['total_products_created'] + count($new_data_slice);
260
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
261
+ }
262
+ catch (Exception $e) {
263
+ return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
264
+ }
265
+ }
266
+ }
267
+
268
+ // Send updated data data to Cue (per slices)
269
+ if (count($updated_data)) {
270
+ $updated_data_slices = Mage::helper('cueconnect')->getSlicesFromArray($updated_data, 20);
271
+ foreach ($updated_data_slices as $updated_data_slice) {
272
+ try {
273
+ $soap_client->set(array(
274
+ 'place_id' => $place_id,
275
+ 'data' => $updated_data_slice,
276
+ 'count' => count($updated_data_slice)
277
+ ));
278
+ // Log
279
+ $log['total_products_updated'] = $log['total_products_updated'] + count($updated_data_slice);
280
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
281
+ }
282
+ catch (Exception $e) {
283
+ return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
284
+ }
285
+ }
286
+ }
287
+
288
+ // Delete products which are not in the Magento catalog anymore
289
+ if (count($imics_to_delete)) {
290
+ $imics_to_delete_slices = Mage::helper('cueconnect')->getSlicesFromArray($imics_to_delete, 50);
291
+ foreach ($imics_to_delete_slices as $imics_to_delete_slice) {
292
+ try {
293
+ $soap_client->delete(array(
294
+ 'place_id' => $place_id,
295
+ 'data' => $imics_to_delete_slice,
296
+ 'count' => count($imics_to_delete_slice)
297
+ ));
298
+ // Log
299
+ $log['total_products_deleted'] = $log['total_products_deleted'] + count($imics_to_delete_slice);
300
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
301
+ }
302
+ catch (Exception $e) {
303
+ return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
304
+ }
305
+ }
306
+ }
307
+
308
+ // Log
309
+ $log['end_at'] = date('Y-m-d H:i:s');
310
+ $log['status'] = "done";
311
+ Mage::helper('cueconnect')->logExportProgress(json_encode($log));
312
+
313
+ // Return
314
+ return array(
315
+ 'success' => true,
316
+ 'created_count' => count($new_data),
317
+ 'updated_count' => count($updated_data),
318
+ 'deleted_count' => count($imics_to_delete),
319
+ 'message' => sprintf("%s product(s) has been created. %s product(s) has been updated. %s product(s) has been deleted.", count($new_data), count($updated_data), count($imics_to_delete)),
320
+ 'log' => $log
321
+ );
322
+ }
323
+
324
+ /**
325
+ * Sync updated products data with CUE
326
+ *
327
+ * @param array $productIds
328
+ * @return array
329
+ */
330
+ public function productsUpdate($productIds)
331
+ {
332
+ foreach (Mage::app()->getStores() as $store) {
333
+ $this->_store = $store;
334
+ if (!$this->_getCredentials() || !$this->_getPlaceId()) {
335
+ continue;
336
+ }
337
+ $this->_getProductSoap();
338
+ if ($this->_productSoapClient) {
339
+ $this->_getCueProducts();
340
+ $this->_prepareProductDataForIds($productIds);
341
+ $this->_addProducts();
342
+ $this->_updatedProducts();
343
+ }
344
+ }
345
+
346
+ return $this->_errors;
347
+ }
348
+
349
+ /**
350
+ * Cue data sync
351
+ */
352
+ public function sync()
353
+ {
354
+ Mage::getModel('cueconnect/observer')->syncAllCustomers();
355
+ $this->syncAllProducts();
356
+ }
357
+
358
+ /**
359
+ * Sync all product with CUE
360
+ *
361
+ * @return bool
362
+ */
363
+ public function syncAllProducts()
364
+ {
365
+ $scheduled = Mage::getStoreConfigFlag(self::XML_PATH_PRODUCT_SYNC_SCHEDULED);
366
+ if (!$scheduled) {
367
+
368
+ return false;
369
+ }
370
+ $this->removeScheduleProductSync();
371
+ foreach (Mage::app()->getStores() as $store) {
372
+ $this->_errors = array();
373
+ $this->_lastProductId = false;
374
+ $this->_store = $store;
375
+ $status = $this->_getProductSyncStatus();
376
+ // Skip all if product sync is processing
377
+ if ($status == self::PRODUCT_SYNC_PROCESSING) {
378
+ return false;
379
+ }
380
+ // Skip store if product sync is complete
381
+ if ($status == self::PRODUCT_SYNC_COMPLETE) {
382
+ continue;
383
+ }
384
+ // check credentials and proceed with sync
385
+ if ($this->_getCredentials() && $this->_getPlaceId()) {
386
+ $this->_getProductSoap();
387
+ if ($this->_productSoapClient) {
388
+ $this->_setProductSyncStatus(self::PRODUCT_SYNC_PROCESSING);
389
+ $this->_getCueProducts();
390
+ $this->_syncAllProducts();
391
+ }
392
+ }
393
+ $inbox = Mage::getModel('adminnotification/inbox');
394
+ if (count($this->_errors)) {
395
+ array_unshift($this->_errors, Mage::helper('cueconnect')->__('You can find more details below:'));
396
+ $title = Mage::helper('cueconnect')->__(
397
+ 'Product Synchronization has failed for the %s store, an email was sent to Cue Connect support.
398
+ Contact us on %s for more information',
399
+ $this->_store->getName(),
400
+ Mage::getStoreConfig(self::XML_PATH_CUE_SUPPORT_EMAIL)
401
+ );
402
+ $inbox->addCritical($title, $this->_errors);
403
+ $this->_setProductSyncStatus(self::PRODUCT_SYNC_FAILED);
404
+ $message = Mage::helper('cueconnect')->__(
405
+ 'Product Synchronization has failed for the %s store.',
406
+ $this->_store->getName()
407
+ );
408
+ $message = $message . ' ' . implode(',', $this->_errors);
409
+ $this->sendEmailToSupport($message);
410
+ } else {
411
+ $title = Mage::helper('cueconnect')->__(
412
+ 'Products data has been successfully synced with Cue for the %s store',
413
+ $this->_store->getName()
414
+ );
415
+ $description = Mage::helper('cueconnect')->__('Congratulation!') . ' ' . $title;
416
+ $inbox->addNotice($title, $description);
417
+ $this->_setProductSyncStatus(self::PRODUCT_SYNC_COMPLETE);
418
+ }
419
+ }
420
+
421
+ return false;
422
+ }
423
+
424
+ /**
425
+ * Get CUE credentials (login and password)
426
+ *
427
+ * @return bool
428
+ */
429
+ protected function _getCredentials()
430
+ {
431
+ $this->_cueLogin = $this->_store->getConfig('cueconnect/credentials/login');
432
+ $this->_cuePassword = $this->_store->getConfig('cueconnect/credentials/password');
433
+ // Check if credentials has been filled
434
+ if (!$this->_cueLogin || !$this->_cuePassword) {
435
+ $this->_errors[] = Mage::helper('cueconnect')->__(
436
+ 'Please check the following Cue API Credentials: E-mail and Password for the %s store.',
437
+ $this->_store->getName()
438
+ );
439
+
440
+ return false;
441
+ }
442
+
443
+ return true;
444
+ }
445
+
446
+ /**
447
+ * Get place id for the CUE account
448
+ *
449
+ * @return bool
450
+ */
451
+ protected function _getPlaceId()
452
+ {
453
+ // Retailuser WS
454
+ $soap_client = Mage::helper('cueconnect')->getSoapClient(
455
+ Mage::helper('cueconnect')->getWsUrl('retailuser'),
456
+ $this->_cueLogin,
457
+ $this->_cuePassword
458
+ );
459
+ // Get place ID
460
+ $place_id = null;
461
+ try {
462
+ $result = $soap_client->get(array(
463
+ 'email' => $this->_cueLogin
464
+ ));
465
+ $this->_placeId = $result->data->id;
466
+ } catch (Exception $e) {
467
+ Mage::log($e->getMessage());
468
+ $this->_errors[] = Mage::helper('cueconnect')->__(
469
+ self::CUE_ERROR_MESSAGE_PRODUCT_SYNC,
470
+ $this->_store->getName()
471
+ );
472
+
473
+ return false;
474
+ }
475
+
476
+ return true;
477
+ }
478
+
479
+ /**
480
+ * Get SOAP client for product
481
+ */
482
+ protected function _getProductSoap()
483
+ {
484
+ $this->_productSoapClient = Mage::helper('cueconnect')->getSoapClient(
485
+ Mage::helper('cueconnect')->getWsUrl('product'),
486
+ $this->_cueLogin,
487
+ $this->_cuePassword
488
+ );
489
+ }
490
+
491
+ /**
492
+ * Get all products (SKU's) from CUE
493
+ */
494
+ protected function _getCueProducts()
495
+ {
496
+ $page = 1;
497
+ do {
498
+ $results = $this->_productSoapClient->get(
499
+ array(
500
+ 'page' => $page,
501
+ 'pagesize' => self::CUE_GET_PAGE_SIZE,
502
+ 'clipped' => false)
503
+ );
504
+ $pages = ceil($results->totalcount / $results->pagesize);
505
+ foreach ($results->data as $result) {
506
+ if ($result->sku) {
507
+ $this->_cueProducts[$result->sku] = $result;
508
+ }
509
+ }
510
+ unset($results);
511
+ } while ($page++ < $pages);
512
+ }
513
+
514
+ /**
515
+ * Getting and preparing product data for specified product ids
516
+ *
517
+ * @param array $productIds
518
+ */
519
+ protected function _prepareProductDataForIds($productIds)
520
+ {
521
+ $productCollection = Mage::getModel('catalog/product')
522
+ ->getCollection()
523
+ ->addFieldToFilter('entity_id', array('in' => $productIds))
524
+ ->addAttributeToSelect('name')
525
+ ->addAttributeToSelect('description')
526
+ ->addAttributeToSelect('price')
527
+ ->addAttributeToSelect('image')
528
+ ->addAttributeToSelect('url_path')
529
+ ->addStoreFilter($this->_store->getId());
530
+ $this->_prepareProductData($productCollection);
531
+ }
532
+
533
+ /**
534
+ * Getting and preparing product data, run product sync
535
+ */
536
+ protected function _syncAllProducts()
537
+ {
538
+ $productCollection = Mage::getModel('catalog/product')
539
+ ->getCollection()
540
+ ->addAttributeToSelect('name')
541
+ ->addAttributeToSelect('description')
542
+ ->addAttributeToSelect('price')
543
+ ->addAttributeToSelect('image')
544
+ ->addAttributeToSelect('url_path')
545
+ ->addStoreFilter($this->_store->getId())
546
+ ->addAttributeToSort('entity_id');
547
+ if ($this->_lastProductId) {
548
+ $productCollection->addAttributeToFilter('entity_id', $this->_lastProductId);
549
+ }
550
+ $productCollection->setPageSize(self::CUE_COLLECTION_PAGE_SIZE);
551
+ $pages = $productCollection->getLastPageNumber();
552
+ $currentPage = 1;
553
+ do {
554
+ $productCollection->setCurPage($currentPage);
555
+ $this->_prepareProductData($productCollection);
556
+ $this->_addProducts();
557
+ $this->_updatedProducts();
558
+ $this->_saveLastSyncedProductId();
559
+ $productCollection->clear();
560
+ } while ($currentPage++ <= $pages);
561
+ }
562
+
563
+ /**
564
+ * Preparing product data
565
+ *
566
+ * @param $productCollection
567
+ */
568
+ protected function _prepareProductData($productCollection)
569
+ {
570
+ $this->_updateData = array();
571
+ $this->_newData = array();
572
+ foreach ($productCollection as $product) {
573
+ // Product image
574
+ $icon = "http://www.cueconnect.com/images/no_image.gif";
575
+ if ($product->getData('image')) {
576
+ $icon = $product->getMediaConfig()->getMediaUrl($product->getData('image'));
577
+ }
578
+ $url = $this->_store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . $product->getUrlPath();
579
+ $data = array(
580
+ 'sku' => $product->getSku(),
581
+ 'name' => $product->getName(),
582
+ 'description' => $product->getDescription(),
583
+ 'sms_name' => $product->getName(),
584
+ 'sms_desc' => $product->getDescription(),
585
+ 'url' => $url,
586
+ 'taxonomy_id' => Mage::getStoreConfig('cueconnect/taxomomy_id'),
587
+ 'icon' => $icon,
588
+ 'live' => '1',
589
+ 'price' => $product->getPrice()
590
+ );
591
+ // Check if product exists in Cue database
592
+ if (in_array($product->getSku(), array_keys($this->_cueProducts))) {
593
+ $data['product_imic'] = null;
594
+ $this->_updateData[] = $data;
595
+ } else {
596
+ $data['upc'] = uniqid();
597
+ $this->_newData[] = $data;
598
+ }
599
+ $this->_lastProductId = $product->getId();
600
+ }
601
+ }
602
+
603
+ /**
604
+ * Send new products data to Cue (per slices)
605
+ */
606
+ protected function _addProducts()
607
+ {
608
+ if ($this->_newData) {
609
+ $new_data_slices = Mage::helper('cueconnect')->getSlicesFromArray($this->_newData, self::CUE_SET_PAGE_SIZE);
610
+ foreach ($new_data_slices as $new_data_slice) {
611
+ try {
612
+ $this->_productSoapClient->create(array(
613
+ 'place_id' => $this->_placeId,
614
+ 'data' => $new_data_slice,
615
+ 'count' => count($new_data_slice)
616
+ ));
617
+ // TODO: check this if we need full log
618
+ // Log
619
+ // $log['total_products_created'] = $log['total_products_created'] + count($new_data_slice);
620
+ // Mage::helper('cueconnect')->logExportProgress(json_encode($log));
621
+ } catch (Exception $e) {
622
+ Mage::log($e->getMessage());
623
+ $this->_errors[] = Mage::helper('cueconnect')->__(
624
+ self::CUE_ERROR_MESSAGE_PRODUCT_SYNC,
625
+ $this->_store->getName()
626
+ );
627
+ // TODO: check this if we need full log
628
+ //return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
629
+ }
630
+ }
631
+ }
632
+ }
633
+
634
+ /**
635
+ * Send updated data to Cue (per slices)
636
+ */
637
+ protected function _updatedProducts()
638
+ {
639
+ if (count($this->_updateData)) {
640
+ $updated_data_slices = Mage::helper('cueconnect')->getSlicesFromArray($this->_updateData, self::CUE_SET_PAGE_SIZE);
641
+ foreach ($updated_data_slices as $updated_data_slice) {
642
+ try {
643
+ $this->_productSoapClient->set(array(
644
+ 'place_id' => $this->_placeId,
645
+ 'data' => $updated_data_slice,
646
+ 'count' => count($updated_data_slice)
647
+ ));
648
+ // TODO: check this if we need full log
649
+ // Log
650
+ // $log['total_products_updated'] = $log['total_products_updated'] + count($updated_data_slice);
651
+ // Mage::helper('cueconnect')->logExportProgress(json_encode($log));
652
+ } catch (Exception $e) {
653
+ Mage::log($e->getMessage());
654
+ $this->_errors[] = Mage::helper('cueconnect')->__(
655
+ self::CUE_ERROR_MESSAGE_PRODUCT_SYNC,
656
+ $this->_store->getName()
657
+ );
658
+ // TODO: check this if we need full log
659
+ // return array('success' => false, 'message' => $e->getMessage(), 'log' => $log);
660
+ }
661
+ }
662
+ }
663
+ }
664
+
665
+ /**
666
+ * Get Product Sync status for the store.
667
+ *
668
+ * @return mixed
669
+ */
670
+ protected function _getProductSyncStatus()
671
+ {
672
+ $path = sprintf(self::XML_PATH_PRODUCT_SYNC_STATUS, $this->_store->getId());
673
+ $status = $this->_store->getConfig($path);
674
+ if ($status == self::PRODUCT_SYNC_FAILED) {
675
+ $lastProductPath = sprintf(self::XML_PATH_PRODUCT_LAST_SYNCED_PRODUCT, $this->_store->getId());
676
+ $this->_lastProductId = $this->_store->getConfig($lastProductPath);
677
+ }
678
+
679
+ return $status;
680
+ }
681
+
682
+ /**
683
+ * Set and save product sync status for the store
684
+ *
685
+ * @param string $value
686
+ */
687
+ protected function _setProductSyncStatus($value)
688
+ {
689
+ $path = sprintf(self::XML_PATH_PRODUCT_SYNC_STATUS, $this->_store->getId());
690
+ Mage::getModel('core/config')->saveConfig($path, $value);
691
+ Mage::app()->getCacheInstance()->cleanType('config');
692
+ }
693
+
694
+ /**
695
+ * Set and save last synced product id
696
+ */
697
+ protected function _saveLastSyncedProductId()
698
+ {
699
+ $path = sprintf(self::XML_PATH_PRODUCT_LAST_SYNCED_PRODUCT, $this->_store->getId());
700
+ Mage::getModel('core/config')->saveConfig($path, $this->_lastProductId);
701
+ Mage::app()->getCacheInstance()->cleanType('config');
702
+ }
703
+
704
+ /**
705
+ * Check product sync status for the stores, return true when resync should be running.
706
+ * Moreover check if we have an actual credentials for the CUE account to schedule product
707
+ * sync automatically (only once)
708
+ *
709
+ * @return bool
710
+ */
711
+ public function isProductReSyncNeeded()
712
+ {
713
+ $scheduled = Mage::getStoreConfigFlag(self::XML_PATH_PRODUCT_SYNC_SCHEDULED);
714
+ if ($scheduled) {
715
+
716
+ return false;
717
+ }
718
+ $actualCredentials = false;
719
+ foreach (Mage::app()->getStores() as $store) {
720
+ $path = sprintf(self::XML_PATH_PRODUCT_SYNC_STATUS, $store->getId());
721
+ $status = $store->getConfig($path);
722
+ if ($status == self::PRODUCT_SYNC_PROCESSING) {
723
+
724
+ return false;
725
+ }
726
+ if ($status == self::PRODUCT_SYNC_FAILED) {
727
+
728
+ return true;
729
+ }
730
+ if (!$actualCredentials && is_null($status)) {
731
+ $this->_store = $store;
732
+ if ($this->_getCredentials() && $this->_getPlaceId()) {
733
+ $actualCredentials = true;
734
+ }
735
+ }
736
+ }
737
+ if ($actualCredentials) {
738
+ $this->scheduleProductSync();
739
+ }
740
+
741
+ return false;
742
+ }
743
+
744
+ /**
745
+ * Schedule Product Sync. Set flat to 1
746
+ */
747
+ public function scheduleProductSync()
748
+ {
749
+ Mage::getModel('core/config')->saveConfig(self::XML_PATH_PRODUCT_SYNC_SCHEDULED, 1);
750
+ Mage::app()->getCacheInstance()->cleanType('config');
751
+ }
752
+
753
+ /**
754
+ * Remove schedule Product Sync. Set flat to 0
755
+ */
756
+ public function removeScheduleProductSync()
757
+ {
758
+ Mage::getModel('core/config')->saveConfig(self::XML_PATH_PRODUCT_SYNC_SCHEDULED, 0);
759
+ Mage::app()->getStore()->setConfig(self::XML_PATH_PRODUCT_SYNC_SCHEDULED, 0);
760
+ Mage::app()->getCacheInstance()->cleanType('config');
761
+ }
762
+
763
+ /**
764
+ * Send email to the CUE support
765
+ *
766
+ * @param string $message
767
+ */
768
+ public function sendEmailToSupport($message = 'hello')
769
+ {
770
+ Mage::getModel('core/email')
771
+ ->setType('html')
772
+ ->setToName(Mage::getStoreConfig(self::XML_PATH_CUE_SUPPORT_NAME))
773
+ ->setToEmail(Mage::getStoreConfig(self::XML_PATH_CUE_SUPPORT_EMAIL))
774
+ ->setSubject(Mage::getStoreConfig(self::XML_PATH_CUE_SUPPORT_SUBJECT))
775
+ ->setFromEmail(Mage::getStoreConfig('trans_email/ident_general/email'))
776
+ ->setFromName(Mage::getStoreConfig('trans_email/ident_sales/name'))
777
+ ->setBody($message)
778
+ ->send();
779
+ }
780
+ }
app/code/community/CueConnect/Cue/Model/Observer.php CHANGED
@@ -10,7 +10,18 @@
10
  */
11
 
12
  class CueConnect_Cue_Model_Observer
13
- {
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  /**
16
  * accessing e-List - used to sync saved items to Cue if not already done
@@ -107,6 +118,16 @@ class CueConnect_Cue_Model_Observer
107
  // Get store
108
  $store = Mage::getModel('core/store')->load($store_id);
109
  if ($store->getConfig('cueconnect/enabled/enabled')) {
 
 
 
 
 
 
 
 
 
 
110
  // Retailuser SOAP client
111
  $soap_client = Mage::helper('cueconnect')->getSoapClient(
112
  Mage::helper('cueconnect')->getWsUrl('retailuser'),
@@ -124,6 +145,12 @@ class CueConnect_Cue_Model_Observer
124
  }
125
  catch (Exception $e) {
126
  Mage::log($e->getMessage());
 
 
 
 
 
 
127
  }
128
 
129
  if ($place_id) {
@@ -192,6 +219,12 @@ class CueConnect_Cue_Model_Observer
192
  }
193
  catch (Exception $e) {
194
  Mage::log($e->getMessage());
 
 
 
 
 
 
195
  }
196
  }
197
  }
@@ -225,7 +258,7 @@ class CueConnect_Cue_Model_Observer
225
  $config->saveConfig('cueconnect/credentials/retailer_id', $retailerId, 'default', 1);
226
  Mage::app()->getCacheInstance()->cleanType('config');
227
  */
228
- Mage::getModel('core/config')->saveConfig('cueconnect/credentials/retailer_id', $retailerId);
229
  Mage::app()->getCacheInstance()->cleanType('config');
230
  }
231
  }
@@ -238,7 +271,11 @@ class CueConnect_Cue_Model_Observer
238
  public function adminProductUpdated(Varien_Event_Observer $observer)
239
  {
240
  $product = $observer->getEvent()->getProduct();
241
-
 
 
 
 
242
  // For each related stores
243
  foreach ($product->getStoreIds() as $storeId) {
244
  $store = Mage::getModel('core/store')->load($storeId);
@@ -276,7 +313,7 @@ class CueConnect_Cue_Model_Observer
276
  $this->doRequest($url, $key, $params);
277
  }
278
  }
279
-
280
 
281
  /**
282
  * delete product from e-List when deleted in Magento (Magento -> Cue)
@@ -286,7 +323,7 @@ class CueConnect_Cue_Model_Observer
286
  {
287
  // Get catalog product
288
  $catalog_product = $observer->getEvent()->getProduct();
289
-
290
  // For each related stores
291
  foreach ($catalog_product->getStoreIds() as $store_id) {
292
  // Get store
@@ -317,7 +354,7 @@ class CueConnect_Cue_Model_Observer
317
  $store->getConfig('cueconnect/credentials/login'),
318
  $store->getConfig('cueconnect/credentials/password')
319
  );
320
-
321
  // Get and delete Cue Connect product
322
  try {
323
  $result = $soap_client->get(array(
@@ -337,7 +374,13 @@ class CueConnect_Cue_Model_Observer
337
  }
338
  catch (Exception $e) {
339
  Mage::log($e->getMessage());
340
- }
 
 
 
 
 
 
341
  }
342
  }
343
  }
@@ -350,9 +393,15 @@ class CueConnect_Cue_Model_Observer
350
  protected function createCueUser($customer) {
351
  if ($customer) {
352
  $storeId = $customer->getStoreId();
 
 
 
353
  if (!$storeId) {
354
  $storeId = Mage::app()->getStore()->getStoreId();
355
  }
 
 
 
356
 
357
  $store = Mage::getModel('core/store')->load($storeId);
358
  $placeApiKey = $store->getConfig('cueconnect/credentials/api_key');
@@ -511,19 +560,20 @@ class CueConnect_Cue_Model_Observer
511
 
512
  /**
513
  * flag local user as synced and create Cue user
514
- * @param Mage_Customer_Model_Customer $customer
515
  */
516
- protected function syncCustomer($customer)
517
  {
518
  if ($customer) {
519
  $exception = false;
 
520
  $userSyncModel = Mage::getModel('cueconnect/userSync');
521
 
522
  if ($userSyncModel) {
523
  $row = $userSyncModel->getCollection()
524
  ->addFieldToFilter('customer_id', $customer->getId())
525
  ->addFieldToFilter('status', $userSyncModel::STATUS_DONE)
526
- ->getFirstItem();
527
 
528
  if (!$row->getData()) {
529
  $userSyncModel->setData(array(
@@ -619,7 +669,7 @@ class CueConnect_Cue_Model_Observer
619
  try {
620
  $ch = curl_init();
621
  curl_setopt($ch, CURLOPT_URL, $url);
622
- curl_setopt($ch, CURLOPT_HEADER);
623
  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
624
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
625
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
@@ -648,5 +698,402 @@ class CueConnect_Cue_Model_Observer
648
 
649
  return $response;
650
  }
651
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  }
10
  */
11
 
12
  class CueConnect_Cue_Model_Observer
13
+ {
14
+ const XML_PATH_CUSTOMER_SYNCED_WITH_ERROR = 'cueconnect/customer_sync_%s/error_synced_customer';
15
+ const XML_PATH_CUSTOMER_SYNC_STATUS = 'cueconnect/customer_sync_%s/status';
16
+ const XML_PATH_CUSTOMER_SYNC_SCHEDULED = 'cueconnect/customer_sync/scheduled';
17
+
18
+ const CUSTOMER_SYNC_FAILED = 'failed';
19
+ const CUSTOMER_SYNC_COMPLETE = 'complete';
20
+ const CUSTOMER_SYNC_PROCESSING = 'processing';
21
+
22
+ const SYNC_MASS_ACTION_NAME = 'cue_sync_mass_action';
23
+
24
+ protected $_currentStoreId = false;
25
 
26
  /**
27
  * accessing e-List - used to sync saved items to Cue if not already done
118
  // Get store
119
  $store = Mage::getModel('core/store')->load($store_id);
120
  if ($store->getConfig('cueconnect/enabled/enabled')) {
121
+ $cueLogin = $store->getConfig('cueconnect/credentials/login');
122
+ $cuePassword = $store->getConfig('cueconnect/credentials/password');
123
+ if (!$cueLogin || !$cuePassword) {
124
+ $message = Mage::helper('cueconnect')->__(
125
+ 'Please check the following Cue API Credentials: E-mail and Password for the %s store.',
126
+ $store->getName()
127
+ );
128
+ Mage::getSingleton('adminhtml/session')->addError($message);
129
+ continue;
130
+ }
131
  // Retailuser SOAP client
132
  $soap_client = Mage::helper('cueconnect')->getSoapClient(
133
  Mage::helper('cueconnect')->getWsUrl('retailuser'),
145
  }
146
  catch (Exception $e) {
147
  Mage::log($e->getMessage());
148
+ $message = Mage::helper('cueconnect')->__(
149
+ 'An error occurred while synchronization product data with Cueconnect for the %s store.
150
+ You can find more details in the log file',
151
+ $store->getName()
152
+ );
153
+ Mage::getSingleton('adminhtml/session')->addError($message);
154
  }
155
 
156
  if ($place_id) {
219
  }
220
  catch (Exception $e) {
221
  Mage::log($e->getMessage());
222
+ $message = Mage::helper('cueconnect')->__(
223
+ 'An error occurred while synchronization product data with Cueconnect for the %s store.
224
+ You can find more details in the log file',
225
+ $store->getName()
226
+ );
227
+ Mage::getSingleton('adminhtml/session')->addError($message);
228
  }
229
  }
230
  }
258
  $config->saveConfig('cueconnect/credentials/retailer_id', $retailerId, 'default', 1);
259
  Mage::app()->getCacheInstance()->cleanType('config');
260
  */
261
+ Mage::getModel('core/config')->saveConfig('cueconnect/credentials/retailer_id', $retailerId);
262
  Mage::app()->getCacheInstance()->cleanType('config');
263
  }
264
  }
271
  public function adminProductUpdated(Varien_Event_Observer $observer)
272
  {
273
  $product = $observer->getEvent()->getProduct();
274
+
275
+ if (Mage::registry('old_product_sku')) {
276
+ $this->deleteOldSkuProduct($product->getStoreIds(), Mage::registry('old_product_sku'));
277
+ Mage::unregister('old_product_sku');
278
+ }
279
  // For each related stores
280
  foreach ($product->getStoreIds() as $storeId) {
281
  $store = Mage::getModel('core/store')->load($storeId);
313
  $this->doRequest($url, $key, $params);
314
  }
315
  }
316
+
317
 
318
  /**
319
  * delete product from e-List when deleted in Magento (Magento -> Cue)
323
  {
324
  // Get catalog product
325
  $catalog_product = $observer->getEvent()->getProduct();
326
+
327
  // For each related stores
328
  foreach ($catalog_product->getStoreIds() as $store_id) {
329
  // Get store
354
  $store->getConfig('cueconnect/credentials/login'),
355
  $store->getConfig('cueconnect/credentials/password')
356
  );
357
+
358
  // Get and delete Cue Connect product
359
  try {
360
  $result = $soap_client->get(array(
374
  }
375
  catch (Exception $e) {
376
  Mage::log($e->getMessage());
377
+ $message = Mage::helper('cueconnect')->__(
378
+ 'An error occurred while synchronization product data with Cueconnect for the %s store.
379
+ You can find more details in the log file',
380
+ $store->getName()
381
+ );
382
+ Mage::getSingleton('adminhtml/session')->addError($message);
383
+ }
384
  }
385
  }
386
  }
393
  protected function createCueUser($customer) {
394
  if ($customer) {
395
  $storeId = $customer->getStoreId();
396
+ if (!$storeId && $this->_currentStoreId ) {
397
+ $storeId = $this->_currentStoreId;
398
+ }
399
  if (!$storeId) {
400
  $storeId = Mage::app()->getStore()->getStoreId();
401
  }
402
+ if (!$storeId) {
403
+ $storeId = Mage::app()->getDefaultStoreView()->getStoreId();
404
+ }
405
 
406
  $store = Mage::getModel('core/store')->load($storeId);
407
  $placeApiKey = $store->getConfig('cueconnect/credentials/api_key');
560
 
561
  /**
562
  * flag local user as synced and create Cue user
563
+ * @param Mage_Customer_Model_Customer $customer
564
  */
565
+ protected function syncCustomer($customer)
566
  {
567
  if ($customer) {
568
  $exception = false;
569
+ /** @var CueConnect_Cue_Model_UserSync $userSyncModel*/
570
  $userSyncModel = Mage::getModel('cueconnect/userSync');
571
 
572
  if ($userSyncModel) {
573
  $row = $userSyncModel->getCollection()
574
  ->addFieldToFilter('customer_id', $customer->getId())
575
  ->addFieldToFilter('status', $userSyncModel::STATUS_DONE)
576
+ ->getFirstItem();
577
 
578
  if (!$row->getData()) {
579
  $userSyncModel->setData(array(
669
  try {
670
  $ch = curl_init();
671
  curl_setopt($ch, CURLOPT_URL, $url);
672
+ curl_setopt($ch, CURLOPT_HEADER, 0);
673
  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
674
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
675
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
698
 
699
  return $response;
700
  }
701
+
702
+ /**
703
+ * add link to the Main menu of a Magento site
704
+ * @param Varien_Event_Observer $observer
705
+ */
706
+ public function addToTopmenu(Varien_Event_Observer $observer)
707
+ {
708
+ if (Mage::helper('cueconnect')->isMyListEnabled()) {
709
+ $menu = $observer->getMenu();
710
+ $tree = $menu->getTree();
711
+ $node = new Varien_Data_Tree_Node(array(
712
+ 'name' => 'My List',
713
+ 'id' => 'mylist',
714
+ 'url' => Mage::getUrl('apps/mylist'),
715
+ 'class' => 'cue-stream'
716
+ ), 'id', $tree, $menu);
717
+ $menu->addChild($node);
718
+ }
719
+ }
720
+
721
+ /**
722
+ * Get order ids for the multishipping checkout, add it to session
723
+ *
724
+ * @param Varien_Event_Observer $observer
725
+ */
726
+ public function getOrderIds(Varien_Event_Observer $observer)
727
+ {
728
+ $orderIds = $observer->getOrderIds();
729
+ if ($orderIds && count($orderIds)) {
730
+ Mage::getSingleton('checkout/session')->setFirstOrderId($orderIds[0]);
731
+ }
732
+ }
733
+
734
+ /**
735
+ * Sync updated products data with CUE on product update attributes mass action
736
+ *
737
+ * @param Varien_Event_Observer $observer
738
+ *
739
+ * @return $this
740
+ */
741
+ public function productMassUpdate(Varien_Event_Observer $observer)
742
+ {
743
+ /** @var array $productIds */
744
+ $productIds = $observer->getProductIds();
745
+ $this->productUpdateExecute($productIds);
746
+ }
747
+
748
+ /**
749
+ * Sync import products data with CUE
750
+ *
751
+ * @param Varien_Event_Observer $observer
752
+ */
753
+ public function productsImportUpdate(Varien_Event_Observer $observer)
754
+ {
755
+ $adapter = $observer->getEvent()->getAdapter();
756
+ $productIds = $adapter->getAffectedEntityIds();
757
+ $this->productUpdateExecute($productIds);
758
+ }
759
+
760
+ /**
761
+ * Executed sync products data with CUE
762
+ *
763
+ * @param Array $productIds
764
+ */
765
+ protected function productUpdateExecute($productIds)
766
+ {
767
+ if (count($productIds)) {
768
+ $this->syncProducts($productIds);
769
+ }
770
+
771
+ return $this;
772
+ }
773
+
774
+ /**
775
+ * Sync updated products data with CUE on product update attributes mass action stock change
776
+ *
777
+ * @param Varien_Event_Observer $observer
778
+ *
779
+ * @return $this
780
+ */
781
+ public function productStockMassUpdate(Varien_Event_Observer $observer)
782
+ {
783
+ /** @var array $productIds */
784
+ $productIds = $observer->getProducts();
785
+ if (count($productIds)) {
786
+ $this->syncProducts($productIds);
787
+ }
788
+
789
+ return $this;
790
+ }
791
+
792
+ /**
793
+ * Sync updated products data with CUE
794
+ *
795
+ * @param [] $productIds
796
+ *
797
+ * @return $this
798
+ */
799
+ protected function syncProducts($productIds)
800
+ {
801
+ if (!Mage::registry(self::SYNC_MASS_ACTION_NAME)) {
802
+ Mage::register(self::SYNC_MASS_ACTION_NAME, true);
803
+ /** @var CueConnect_Cue_Model_CueConnect $productUpdateModel */
804
+ $productUpdateModel = Mage::getModel('cueconnect/cueconnect');
805
+ /** @var array $errors */
806
+ $errors = $productUpdateModel->productsUpdate($productIds);
807
+ /** @var Mage_Adminhtml_Model_Session $adminSession */
808
+ $adminSession = Mage::getSingleton('adminhtml/session');
809
+ /** @var string $error */
810
+ foreach ($errors as $error) {
811
+ $adminSession->addError($error);
812
+ }
813
+ }
814
+
815
+ return $this;
816
+ }
817
+
818
+ /**
819
+ * Sync all customers with CUE
820
+ *
821
+ * @return bool
822
+ */
823
+ public function syncAllCustomers()
824
+ {
825
+ // check if $scheduled sync
826
+ $scheduled = Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMER_SYNC_SCHEDULED);
827
+ if (!$scheduled) {
828
+
829
+ return false;
830
+ }
831
+ // check retailer_id
832
+ $retailer_id = Mage::getStoreConfig('cueconnect/credentials/retailer_id');
833
+ if (is_null($retailer_id)) {
834
+
835
+ return false;
836
+ }
837
+ $this->removeScheduleCustomerSync();
838
+
839
+ /** @var CueConnect_Cue_Model_CueConnect $cueModel */
840
+ $cueModel = Mage::getModel('cueconnect/cueconnect');
841
+ $notSyncPrev = $this->checkNotSyncedCustomer();
842
+ $storeCollection = Mage::getModel('core/store')->getCollection()
843
+ ->setLoadDefault(true);
844
+ foreach ($storeCollection as $store) {
845
+ $this->_currentStoreId = $store->getId();
846
+ // return sync status for current store
847
+ $status = $this->_getCustomerSyncStatus($store);
848
+
849
+ // skip if customers sync for current store compleate
850
+ if ($status == self::CUSTOMER_SYNC_COMPLETE) {
851
+ continue;
852
+ }
853
+ // Skip all if customer sync is processing
854
+ if ($status == self::CUSTOMER_SYNC_PROCESSING) {
855
+ return false;
856
+ }
857
+
858
+ // set $status processing for current store
859
+ $this->setCustomersSyncStatus(self::CUSTOMER_SYNC_PROCESSING);
860
+ $customerCollection = Mage::getModel('customer/customer')->getCollection()
861
+ ->addFieldToFilter('store_id', $this->_currentStoreId);
862
+ foreach ($customerCollection as $customer) {
863
+ $this->syncCustomer($customer);
864
+ }
865
+
866
+ //check the cueconnect_user_sync and find the customers with status - STATUS_ERROR (2) after sync
867
+ $notSyncUserIds = $this->checkNotSyncedCustomer();
868
+
869
+ /** @var Mage_AdminNotification_Model_Inbox $inbox */
870
+ $inbox = Mage::getModel('adminnotification/inbox');
871
+ if (count($notSyncPrev) < count($notSyncUserIds)) {
872
+ $this->setCustomersSyncStatus(self::CUSTOMER_SYNC_FAILED);
873
+ $title = Mage::helper('cueconnect')->__(
874
+ 'Customers Synchronization has failed for the %s store, an email was sent to Cue Connect support.
875
+ Contact us on %s for more information',
876
+ $store->getName(),
877
+ Mage::getStoreConfig($cueModel::XML_PATH_CUE_SUPPORT_EMAIL)
878
+ );
879
+ $message = Mage::helper('cueconnect')->__(
880
+ 'Customer Synchronization has failed for the %s store.',
881
+ $store->getName()
882
+ );
883
+ $cueModel->sendEmailToSupport($message);
884
+ $notificationBody = Mage::helper('cueconnect')->__(
885
+ 'Customer Synchronization for the %s store has failed for %s customer(s)',
886
+ $store->getName(),
887
+ count(array_diff($notSyncUserIds, $notSyncPrev))
888
+ );
889
+
890
+ $inbox->addCritical($title, $notificationBody);
891
+ } else {
892
+ $this->setCustomersSyncStatus(self::CUSTOMER_SYNC_COMPLETE);
893
+ $title = Mage::helper('cueconnect')->__(
894
+ 'Customer data has been successfully synced with Cue for the %s store',
895
+ $store->getName()
896
+ );
897
+ $description = Mage::helper('cueconnect')->__('Congratulation!') . ' ' . $title;
898
+ $inbox->addNotice($title, $description);
899
+ }
900
+
901
+ $notSyncPrev = $notSyncUserIds;
902
+
903
+ }
904
+ }
905
+
906
+
907
+ /**
908
+ * check the cueconnect_user_sync and find the customers with status - STATUS_ERROR (2)
909
+ */
910
+ public function checkNotSyncedCustomer()
911
+ {
912
+ /** @var CueConnect_Cue_Model_UserSync $userSyncModel */
913
+ $userSyncModel = Mage::getModel('cueconnect/userSync');
914
+ $notSyncUserIds = array();
915
+ $userSyncCollection = $userSyncModel->getCollection()
916
+ ->addFieldToFilter('status', $userSyncModel::STATUS_ERROR);
917
+ foreach ($userSyncCollection->getItems() as $user) {
918
+ $notSyncUserIds[] = $user->getId();
919
+ }
920
+
921
+ return $notSyncUserIds;
922
+ }
923
+
924
+ /**
925
+ * Set and save customers sync status for the store
926
+ *
927
+ * @param string $value
928
+ */
929
+ protected function setCustomersSyncStatus($value)
930
+ {
931
+ $path = sprintf(self::XML_PATH_CUSTOMER_SYNC_STATUS, $this->_currentStoreId);
932
+ Mage::getModel('core/config')->saveConfig($path, $value);
933
+ Mage::app()->getCacheInstance()->cleanType('config');
934
+ }
935
+
936
+ /**
937
+ * Remove schedule customer Sync. Set flat to 0
938
+ */
939
+ public function removeScheduleCustomerSync()
940
+ {
941
+ Mage::getModel('core/config')->saveConfig(self::XML_PATH_CUSTOMER_SYNC_SCHEDULED, 0);
942
+ Mage::app()->getStore()->setConfig(self::XML_PATH_CUSTOMER_SYNC_SCHEDULED, 0);
943
+ Mage::app()->getCacheInstance()->cleanType('config');
944
+ }
945
+
946
+ /**
947
+ * Get customer Sync status for the store.
948
+ *
949
+ * @return mixed
950
+ */
951
+ protected function _getCustomerSyncStatus($store)
952
+ {
953
+ $path = sprintf(self::XML_PATH_CUSTOMER_SYNC_STATUS, $this->_currentStoreId);
954
+ $status = $store->getConfig($path);
955
+
956
+ return $status;
957
+ }
958
+
959
+
960
+ /**
961
+ * Check customer sync status for the stores, return true when resync should be running.
962
+ *
963
+ * @return bool
964
+ */
965
+ public function isCustomerReSyncNeeded()
966
+ {
967
+ $scheduled = Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMER_SYNC_SCHEDULED);
968
+ if ($scheduled) {
969
+
970
+ return false;
971
+ }
972
+ $storeCollection = Mage::getModel('core/store')->getCollection()
973
+ ->setLoadDefault(true);
974
+ foreach ($storeCollection as $store) {
975
+ $path = sprintf(self::XML_PATH_CUSTOMER_SYNC_STATUS, $store->getId());
976
+ $status = $store->getConfig($path);
977
+ if ($status == self::CUSTOMER_SYNC_PROCESSING) {
978
+
979
+ return false;
980
+ }
981
+ if ($status == self::CUSTOMER_SYNC_FAILED) {
982
+
983
+ return true;
984
+ }
985
+
986
+ }
987
+ $retailer_id = Mage::getStoreConfig('cueconnect/credentials/retailer_id');
988
+ if (!is_null($retailer_id)) {
989
+
990
+ $this->scheduleCustomerSync();
991
+ }
992
+
993
+ return false;
994
+ }
995
+
996
+ /**
997
+ * Schedule customer Sync. Set flat to 1
998
+ */
999
+ public function scheduleCustomerSync()
1000
+ {
1001
+ Mage::getModel('core/config')->saveConfig(self::XML_PATH_CUSTOMER_SYNC_SCHEDULED, 1);
1002
+ Mage::app()->getCacheInstance()->cleanType('config');
1003
+ }
1004
+
1005
+ /**
1006
+ * Checked updated products SKU
1007
+ *
1008
+ * @param Varien_Event_Observer $observer
1009
+ */
1010
+ public function detectProductSkuChanges($observer)
1011
+ {
1012
+ /* @var Mage_Catalog_Model_Product $product */
1013
+ $product = $observer->getEvent()->getProduct();
1014
+
1015
+ if ($product->hasDataChanges()) {
1016
+ try {
1017
+ /* @var string $newSku */
1018
+ $newSku = ($product->getData('sku')) ? $product->getData('sku') : null;
1019
+ /* @var string $oldSku */
1020
+ $oldSku = ($product->getOrigData('sku')) ? $product->getOrigData('sku') : null;
1021
+
1022
+ if ($newSku && $oldSku && ($newSku != $oldSku)) {
1023
+ Mage::register('old_product_sku', $oldSku);
1024
+ }
1025
+ } catch (Exception $e) {
1026
+ Mage::log($e->getTraceAsString(), null, 'product_changes_fault.log');
1027
+ }
1028
+ }
1029
+ }
1030
+
1031
+ /**
1032
+ * Delete product from e-List when deleted in Magento or changed SKU
1033
+ *
1034
+ * @param array $storeIds
1035
+ * @param string $sku
1036
+ */
1037
+ protected function deleteOldSkuProduct($storeIds, $sku)
1038
+ {
1039
+ // For each related stores
1040
+ foreach ($storeIds as $store_id) {
1041
+ // Get store
1042
+ $store = Mage::getModel('core/store')->load($store_id);
1043
+ if ($store->getConfig('cueconnect/enabled/enabled')) {
1044
+ // Retailuser SOAP client
1045
+ $soap_client = Mage::helper('cueconnect')->getSoapClient(
1046
+ Mage::helper('cueconnect')->getWsUrl('retailuser'),
1047
+ $store->getConfig('cueconnect/credentials/login'),
1048
+ $store->getConfig('cueconnect/credentials/password')
1049
+ );
1050
+
1051
+ // Get place ID
1052
+ $place_id = null;
1053
+ try {
1054
+ $result = $soap_client->get(array(
1055
+ 'email' => $store->getConfig('cueconnect/credentials/login')
1056
+ ));
1057
+ $place_id = $result->data->id;
1058
+ }
1059
+ catch (Exception $e) {
1060
+ Mage::log($e->getMessage());
1061
+ }
1062
+
1063
+ // Product SOAP client
1064
+ $soap_client = Mage::helper('cueconnect')->getSoapClient(
1065
+ Mage::helper('cueconnect')->getWsUrl('product'),
1066
+ $store->getConfig('cueconnect/credentials/login'),
1067
+ $store->getConfig('cueconnect/credentials/password')
1068
+ );
1069
+
1070
+ // Get and delete Cue Connect product
1071
+ try {
1072
+ $result = $soap_client->get(array(
1073
+ 'place_id' => $place_id,
1074
+ 'sku' => $sku,
1075
+ 'page' => 1,
1076
+ 'page_size' => 1
1077
+ ));
1078
+ if ($result && isset($result->data) && isset($result->data[0]) && isset($result->inpagecount) && $result->inpagecount) {
1079
+ $cueconnect_product = $result->data[0];
1080
+ $soap_client->delete(array(
1081
+ 'place_id' => $place_id,
1082
+ 'data' => array($cueconnect_product->product_imic),
1083
+ 'count' => 1
1084
+ ));
1085
+ }
1086
+ }
1087
+ catch (Exception $e) {
1088
+ Mage::log($e->getMessage());
1089
+ $message = Mage::helper('cueconnect')->__(
1090
+ 'An error occurred while synchronization product data with Cueconnect for the %s store.
1091
+ You can find more details in the log file',
1092
+ $store->getName()
1093
+ );
1094
+ Mage::getSingleton('adminhtml/session')->addError($message);
1095
+ }
1096
+ }
1097
+ }
1098
+ }
1099
  }
app/code/community/CueConnect/Cue/controllers/Adminhtml/System/Config/CustomersyncController.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Adminhtml_System_Config_CustomersyncController extends Mage_Adminhtml_Controller_Action
13
+ {
14
+ /**
15
+ * Run customer resync
16
+ *
17
+ * @return void
18
+ */
19
+ public function indexAction()
20
+ {
21
+ Mage::getModel('cueconnect/observer')->scheduleCustomerSync();
22
+ $this->getResponse()->setBody(true);
23
+ }
24
+ }
app/code/community/CueConnect/Cue/controllers/Adminhtml/System/Config/ProductsyncController.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class CueConnect_Cue_Adminhtml_System_Config_ProductsyncController extends Mage_Adminhtml_Controller_Action
13
+ {
14
+ /**
15
+ * Run product resync
16
+ *
17
+ * @return void
18
+ */
19
+ public function indexAction()
20
+ {
21
+ Mage::getModel('cueconnect/cueconnect')->scheduleProductSync();
22
+ $this->getResponse()->setBody(true);
23
+ }
24
+ }
app/code/community/CueConnect/Cue/etc/config.xml CHANGED
@@ -104,6 +104,22 @@
104
  </cueconnect_cue_elist_view>
105
  </observers>
106
  </elist_view>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  </events>
108
  <rewrite>
109
  <elist_url>
@@ -203,6 +219,47 @@
203
  </cueconnect_cue_product_update>
204
  </observers>
205
  </catalog_product_save_after>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  </events>
207
  </adminhtml>
208
  <default>
@@ -225,6 +282,9 @@
225
  <alert>
226
  <enabled>1</enabled>
227
  </alert>
 
 
 
228
  <webservice>
229
  <url>http://rapi.cueconnect.com/</url>
230
  </webservice>
@@ -254,6 +314,23 @@
254
  <key>a2645def81375a4f88475acc6b4b0639fd87bfaef715b828e1704f79bac6262ef0e85876dd7047765360678b3372812b5f1741b3abfe9159a3d50fe01e05d757</key>
255
  </select_version>
256
  </webhook>
 
 
 
 
 
257
  </cueconnect>
258
  </default>
 
 
 
 
 
 
 
 
 
 
 
 
259
  </config>
104
  </cueconnect_cue_elist_view>
105
  </observers>
106
  </elist_view>
107
+ <page_block_html_topmenu_gethtml_before>
108
+ <observers>
109
+ <cueconnect_cue>
110
+ <class>cueconnect/observer</class>
111
+ <method>addToTopmenu</method>
112
+ </cueconnect_cue>
113
+ </observers>
114
+ </page_block_html_topmenu_gethtml_before>
115
+ <checkout_multishipping_controller_success_action>
116
+ <observers>
117
+ <cueconnect_cue_multishipping_get_order_ids>
118
+ <class>cueconnect/observer</class>
119
+ <method>getOrderIds</method>
120
+ </cueconnect_cue_multishipping_get_order_ids>
121
+ </observers>
122
+ </checkout_multishipping_controller_success_action>
123
  </events>
124
  <rewrite>
125
  <elist_url>
219
  </cueconnect_cue_product_update>
220
  </observers>
221
  </catalog_product_save_after>
222
+ <catalog_product_attribute_update_after>
223
+ <observers>
224
+ <cueconnect_cue_product_update_attribute_after>
225
+ <class>cueconnect/observer</class>
226
+ <method>productMassUpdate</method>
227
+ </cueconnect_cue_product_update_attribute_after>
228
+ </observers>
229
+ </catalog_product_attribute_update_after>
230
+ <catalog_product_website_update>
231
+ <observers>
232
+ <cueconnect_cue_product_update_website_after>
233
+ <class>cueconnect/observer</class>
234
+ <method>productMassUpdate</method>
235
+ </cueconnect_cue_product_update_website_after>
236
+ </observers>
237
+ </catalog_product_website_update>
238
+ <catalog_product_stock_item_mass_change>
239
+ <observers>
240
+ <cueconnect_cue_product_update_stock_after>
241
+ <class>cueconnect/observer</class>
242
+ <method>productStockMassUpdate</method>
243
+ </cueconnect_cue_product_update_stock_after>
244
+ </observers>
245
+ </catalog_product_stock_item_mass_change>
246
+ <catalog_product_import_finish_before>
247
+ <observers>
248
+ <cueconnect_cue_product_import_finish_before>
249
+ <class>cueconnect/observer</class>
250
+ <method>productsImportUpdate</method>
251
+ </cueconnect_cue_product_import_finish_before>
252
+ </observers>
253
+ </catalog_product_import_finish_before>
254
+ <catalog_product_save_before>
255
+ <observers>
256
+ <cueconnect_cue_product_changes>
257
+ <type>singleton</type>
258
+ <class>cueconnect/observer</class>
259
+ <method>detectProductSkuChanges</method>
260
+ </cueconnect_cue_product_changes>
261
+ </observers>
262
+ </catalog_product_save_before>
263
  </events>
264
  </adminhtml>
265
  <default>
282
  <alert>
283
  <enabled>1</enabled>
284
  </alert>
285
+ <tracking>
286
+ <enabled>1</enabled>
287
+ </tracking>
288
  <webservice>
289
  <url>http://rapi.cueconnect.com/</url>
290
  </webservice>
314
  <key>a2645def81375a4f88475acc6b4b0639fd87bfaef715b828e1704f79bac6262ef0e85876dd7047765360678b3372812b5f1741b3abfe9159a3d50fe01e05d757</key>
315
  </select_version>
316
  </webhook>
317
+ <support>
318
+ <email>dev@cueconnect.com</email>
319
+ <name>CUE support</name>
320
+ <subject>Synchronization has failed</subject>
321
+ </support>
322
  </cueconnect>
323
  </default>
324
+ <crontab>
325
+ <jobs>
326
+ <cue_sync>
327
+ <schedule>
328
+ <cron_expr>*/1 * * * *</cron_expr>
329
+ </schedule>
330
+ <run>
331
+ <model>cueconnect/cueconnect::sync</model>
332
+ </run>
333
+ </cue_sync>
334
+ </jobs>
335
+ </crontab>
336
  </config>
app/code/community/CueConnect/Cue/etc/config.xml_backup ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <CueConnect_Cue>
5
+ <version>3.0.19</version>
6
+ </CueConnect_Cue>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <cueconnect>
11
+ <class>CueConnect_Cue_Model</class>
12
+ <resourceModel>cueconnect_mysql4</resourceModel>
13
+ </cueconnect>
14
+ <cueconnect_mysql4>
15
+ <class>CueConnect_Cue_Model_Mysql4</class>
16
+ <entities>
17
+ <demand>
18
+ <table>cueconnect_demand</table>
19
+ </demand>
20
+ <userSync>
21
+ <table>cueconnect_user_sync</table>
22
+ </userSync>
23
+ <wishlistSync>
24
+ <table>cueconnect_wishlist_sync</table>
25
+ </wishlistSync>
26
+ </entities>
27
+ </cueconnect_mysql4>
28
+ </models>
29
+ <blocks>
30
+ <cueconnect>
31
+ <class>CueConnect_Cue_Block</class>
32
+ </cueconnect>
33
+ </blocks>
34
+ <helpers>
35
+ <cueconnect>
36
+ <class>CueConnect_Cue_Helper</class>
37
+ </cueconnect>
38
+ <wishlist>
39
+ <rewrite>
40
+ <data>CueConnect_Cue_Helper_Wishlist_Data</data> <!-- tell magento to use your own helper instead of the default one -->
41
+ </rewrite>
42
+ </wishlist>
43
+ </helpers>
44
+ <resources>
45
+ <cueconnect_setup>
46
+ <setup>
47
+ <module>CueConnect_Cue</module>
48
+ </setup>
49
+ </cueconnect_setup>
50
+ <cueconnect_write>
51
+ <connection>
52
+ <use>core_write</use>
53
+ </connection>
54
+ </cueconnect_write>
55
+ <cueconnect_read>
56
+ <connection>
57
+ <use>core_read</use>
58
+ </connection>
59
+ </cueconnect_read>
60
+ </resources>
61
+ <events>
62
+ <catalog_product_save_after>
63
+ <observers>
64
+ <cueconnect_cue_observer_update_product>
65
+ <type>singleton</type>
66
+ <class>CueConnect_Cue_Model_Observer</class>
67
+ <method>updateProduct</method>
68
+ </cueconnect_cue_observer_update_product>
69
+ </observers>
70
+ </catalog_product_save_after>
71
+ <catalog_product_delete_before>
72
+ <observers>
73
+ <cueconnect_cue_observer_delete_product>
74
+ <type>singleton</type>
75
+ <class>CueConnect_Cue_Model_Observer</class>
76
+ <method>deleteProduct</method>
77
+ </cueconnect_cue_observer_delete_product>
78
+ </observers>
79
+ </catalog_product_delete_before>
80
+ <customer_register_success>
81
+ <observers>
82
+ <cueconnect_cue_customer_register_success>
83
+ <type>singleton</type>
84
+ <class>CueConnect_Cue_Model_Observer</class>
85
+ <method>customerSaveProfile</method>
86
+ </cueconnect_cue_customer_register_success>
87
+ </observers>
88
+ </customer_register_success>
89
+ <customer_save_after>
90
+ <observers>
91
+ <cueconnect_cue_customer_save_after>
92
+ <type>singleton</type>
93
+ <class>CueConnect_Cue_Model_Observer</class>
94
+ <method>customerSaveProfile</method>
95
+ </cueconnect_cue_customer_save_after>
96
+ </observers>
97
+ </customer_save_after>
98
+ <elist_view>
99
+ <observers>
100
+ <cueconnect_cue_elist_view>
101
+ <type>singleton</type>
102
+ <class>CueConnect_Cue_Model_Observer</class>
103
+ <method>viewElist</method>
104
+ </cueconnect_cue_elist_view>
105
+ </observers>
106
+ </elist_view>
107
+ <page_block_html_topmenu_gethtml_before>
108
+ <observers>
109
+ <cueconnect_cue>
110
+ <class>cueconnect/observer</class>
111
+ <method>addToTopmenu</method>
112
+ </cueconnect_cue>
113
+ </observers>
114
+ </page_block_html_topmenu_gethtml_before>
115
+ <checkout_multishipping_controller_success_action>
116
+ <observers>
117
+ <cueconnect_cue_multishipping_get_order_ids>
118
+ <class>cueconnect/observer</class>
119
+ <method>getOrderIds</method>
120
+ </cueconnect_cue_multishipping_get_order_ids>
121
+ </observers>
122
+ </checkout_multishipping_controller_success_action>
123
+ </events>
124
+ <rewrite>
125
+ <elist_url>
126
+ <from><![CDATA[#^/apps/mylist(\/)*$#]]></from>
127
+ <to><![CDATA[/cueconnect/elist/index]]></to>
128
+ <complete>1</complete>
129
+ </elist_url>
130
+ </rewrite>
131
+ </global>
132
+ <frontend>
133
+ <layout>
134
+ <updates>
135
+ <cueconnect module="cueconnect">
136
+ <file>cueconnect.xml</file>
137
+ </cueconnect>
138
+ </updates>
139
+ </layout>
140
+ <routers>
141
+ <cueconnect>
142
+ <use>standard</use>
143
+ <args>
144
+ <module>CueConnect_Cue</module>
145
+ <frontName>elist</frontName>
146
+ </args>
147
+ </cueconnect>
148
+ </routers>
149
+ <events>
150
+ <customer_login>
151
+ <observers>
152
+ <cueconnect_cue_customer_login>
153
+ <type>model</type>
154
+ <class>CueConnect_Cue_Model_Observer</class>
155
+ <method>customerLogin</method>
156
+ </cueconnect_cue_customer_login>
157
+ </observers>
158
+ </customer_login>
159
+ </events>
160
+ </frontend>
161
+ <admin>
162
+ <routers>
163
+ <cueconnect>
164
+ <use>admin</use>
165
+ <args>
166
+ <module>CueConnect_Cue</module>
167
+ <frontName>cueconnect</frontName>
168
+ </args>
169
+ </cueconnect>
170
+ </routers>
171
+ </admin>
172
+ <adminhtml>
173
+ <acl>
174
+ <resources>
175
+ <all>
176
+ <title>Allow Everything</title>
177
+ </all>
178
+ <admin>
179
+ <children>
180
+ <system>
181
+ <children>
182
+ <config>
183
+ <children>
184
+ <cueconnect translate="title" module="cueconnect">
185
+ <title>Cue - All</title>
186
+ <sort_order>100</sort_order>
187
+ </cueconnect>
188
+ </children>
189
+ </config>
190
+ </children>
191
+ </system>
192
+ </children>
193
+ </admin>
194
+ </resources>
195
+ </acl>
196
+ <layout>
197
+ <updates>
198
+ <cueconnect module="cueconnect">
199
+ <file>cueconnect.xml</file>
200
+ </cueconnect>
201
+ </updates>
202
+ </layout>
203
+ <events>
204
+ <admin_system_config_changed_section_cueconnect>
205
+ <observers>
206
+ <cueconnect_cue_version_change>
207
+ <type>singleton</type>
208
+ <class>CueConnect_Cue_Model_Observer</class>
209
+ <method>adminCueConnectUpdated</method>
210
+ </cueconnect_cue_version_change>
211
+ </observers>
212
+ </admin_system_config_changed_section_cueconnect>
213
+ <catalog_product_save_after>
214
+ <observers>
215
+ <cueconnect_cue_product_update>
216
+ <type>singleton</type>
217
+ <class>CueConnect_Cue_Model_Observer</class>
218
+ <method>adminProductUpdated</method>
219
+ </cueconnect_cue_product_update>
220
+ </observers>
221
+ </catalog_product_save_after>
222
+ <catalog_product_attribute_update_after>
223
+ <observers>
224
+ <cueconnect_cue_product_update_attribute_after>
225
+ <class>cueconnect/observer</class>
226
+ <method>productMassUpdate</method>
227
+ </cueconnect_cue_product_update_attribute_after>
228
+ </observers>
229
+ </catalog_product_attribute_update_after>
230
+ <catalog_product_website_update>
231
+ <observers>
232
+ <cueconnect_cue_product_update_website_after>
233
+ <class>cueconnect/observer</class>
234
+ <method>productMassUpdate</method>
235
+ </cueconnect_cue_product_update_website_after>
236
+ </observers>
237
+ </catalog_product_website_update>
238
+ <catalog_product_stock_item_mass_change>
239
+ <observers>
240
+ <cueconnect_cue_product_update_stock_after>
241
+ <class>cueconnect/observer</class>
242
+ <method>productStockMassUpdate</method>
243
+ </cueconnect_cue_product_update_stock_after>
244
+ </observers>
245
+ </catalog_product_stock_item_mass_change>
246
+ <catalog_product_import_finish_before>
247
+ <observers>
248
+ <cueconnect_cue_product_import_finish_before>
249
+ <class>cueconnect/observer</class>
250
+ <method>productsImportUpdate</method>
251
+ </cueconnect_cue_product_import_finish_before>
252
+ </observers>
253
+ </catalog_product_import_finish_before>
254
+ </events>
255
+ </adminhtml>
256
+ <default>
257
+ <cueconnect>
258
+ <enabled>
259
+ <enabled>1</enabled>
260
+ </enabled>
261
+ <mode>
262
+ <mode>1</mode>
263
+ </mode>
264
+ <collection>
265
+ <enabled>1</enabled>
266
+ </collection>
267
+ <ob>
268
+ <enabled>1</enabled>
269
+ </ob>
270
+ <favorite>
271
+ <enabled>1</enabled>
272
+ </favorite>
273
+ <alert>
274
+ <enabled>1</enabled>
275
+ </alert>
276
+ <tracking>
277
+ <enabled>1</enabled>
278
+ </tracking>
279
+ <webservice>
280
+ <url>http://qa-rapi.cueconnect.net/</url>
281
+ </webservice>
282
+ <taxomomy_id>fcc3465</taxomomy_id>
283
+ <image>
284
+ <width>480</width>
285
+ <height>480</height>
286
+ </image>
287
+ <path>
288
+ <elist>apps/mylist</elist>
289
+ </path>
290
+ <webhook>
291
+ <save_customer>
292
+ <url>https://qa-business.cueconnect.net/magento/saveCustomer</url>
293
+ <key>026132282952ccf731a765413bf11ca32ccbc683ab92c7ad3171b2a0a71ef21d69d1334efcf79da5ecc2d496221e0e28ed025e71d210ebf16e70bfa338c4f2d3</key>
294
+ </save_customer>
295
+ <save_mark>
296
+ <url>https://qa-business.cueconnect.net/magento/saveMark</url>
297
+ <key>bf83fc65e0e710e68e17c811bdb6e5d48ea2e805d8fc4af3ac9c8c428631fa044fa6509f128e6891b6d5e8df54508e045b53d95289d72f2f46d98499286772ca</key>
298
+ </save_mark>
299
+ <price_changed>
300
+ <url>https://qa-business.cueconnect.net/magento/priceChanged</url>
301
+ <key>f7ba9544bdded1d3a1aead3cb43557b340bf69ce1919a94e7282bfe11f573c94ffc375bf778bc374677c8150ae3880e9fa1502bb5e4235d7628e1ed3e95a6895</key>
302
+ </price_changed>
303
+ <select_version>
304
+ <url>https://qa-business.cueconnect.net/magento/selectVersion</url>
305
+ <key>a2645def81375a4f88475acc6b4b0639fd87bfaef715b828e1704f79bac6262ef0e85876dd7047765360678b3372812b5f1741b3abfe9159a3d50fe01e05d757</key>
306
+ </select_version>
307
+ </webhook>
308
+ <support>
309
+ <email>dev@cueconnect.com</email>
310
+ <name>CUE support</name>
311
+ <subject>Synchronization has failed</subject>
312
+ </support>
313
+ </cueconnect>
314
+ </default>
315
+ <crontab>
316
+ <jobs>
317
+ <cue_sync>
318
+ <schedule>
319
+ <cron_expr>*/1 * * * *</cron_expr>
320
+ </schedule>
321
+ <run>
322
+ <model>cueconnect/cueconnect::sync</model>
323
+ </run>
324
+ </cue_sync>
325
+ </jobs>
326
+ </crontab>
327
+ </config>
app/code/community/CueConnect/Cue/etc/system.xml CHANGED
@@ -14,14 +14,14 @@
14
  <label>Environment</label>
15
  <frontend_type>text</frontend_type>
16
  <sort_order>1</sort_order>
17
- <show_in_default>0</show_in_default>
18
- <show_in_website>0</show_in_website>
19
  <show_in_store>1</show_in_store>
20
  <fields>
21
  <env translate="label">
22
  <label>Env</label>
23
- <show_in_default>0</show_in_default>
24
- <show_in_website>0</show_in_website>
25
  <show_in_store>1</show_in_store>
26
  <frontend_type>text</frontend_type>
27
  <sort_order>3</sort_order>
@@ -29,23 +29,60 @@
29
  </fields>
30
  </environment>
31
  <credentials translate="label">
32
- <label>Cue API Key</label>
33
  <comment><![CDATA[<p>Get your Cue API key from your Merchant Hub account under the Code Implementation section.</p>]]></comment>
34
  <frontend_type>text</frontend_type>
35
  <sort_order>1</sort_order>
36
- <show_in_default>0</show_in_default>
37
- <show_in_website>0</show_in_website>
38
  <show_in_store>1</show_in_store>
39
  <fields>
40
  <api_key translate="label">
41
- <label>API key</label>
42
  <tooltip>Get your Cue API key from your Merchant Hub account.</tooltip>
43
- <show_in_default>0</show_in_default>
44
- <show_in_website>0</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  <frontend_type>text</frontend_type>
47
- <sort_order>3</sort_order>
48
  </api_key>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  </fields>
50
  </credentials>
51
  <enabled translate="label">
@@ -53,15 +90,15 @@
53
  <comment><![CDATA[<p>When &quot;My-List&quot; is enabled, magento's native wishlist will be disabled and customers' saved items are transfered to &quot;My-List&quot;.</p>]]></comment>
54
  <frontend_type>text</frontend_type>
55
  <sort_order>2</sort_order>
56
- <show_in_default>0</show_in_default>
57
- <show_in_website>0</show_in_website>
58
  <show_in_store>1</show_in_store>
59
  <fields>
60
  <enabled translate="label">
61
  <label>Enabled</label>
62
  <tooltip>Enable My-List for this store</tooltip>
63
- <show_in_default>0</show_in_default>
64
- <show_in_website>0</show_in_website>
65
  <show_in_store>1</show_in_store>
66
  <frontend_type>select</frontend_type>
67
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -76,8 +113,8 @@
76
  <comment><![CDATA[<p>Available in two versions: a customizable widget or enterprise fully integrated that works seamlessly with your existing Customer Account and Profile.</p><p><strong>Standalone Widget:</strong> My-List technology is deployed on a standalone widget. Shoppers will opt into this service by signing up through the My-list login popup modal.</p><p><strong>Fully Integrated:</strong> works seamlessly with your existing Customer Account and Profile. Shoppers simply need to create an account with your store to have access to My-List capabilities.</p>]]></comment>
77
  <frontend_type>text</frontend_type>
78
  <sort_order>3</sort_order>
79
- <show_in_default>0</show_in_default>
80
- <show_in_website>0</show_in_website>
81
  <show_in_store>1</show_in_store>
82
  <fields>
83
  <mode translate="label">
@@ -85,8 +122,8 @@
85
  <frontend_type>select</frontend_type>
86
  <source_model>cueconnect/options</source_model>
87
  <sort_order>1</sort_order>
88
- <show_in_default>0</show_in_default>
89
- <show_in_website>0</show_in_website>
90
  <show_in_store>1</show_in_store>
91
  </mode>
92
  </fields>
@@ -96,14 +133,14 @@
96
  <comment><![CDATA[<p>The &quot;My List&quot; link can be automatically added to the top links or manually inserted in any location in your theme files. <br>If you wish to manually place the &quot;My List&quot; link, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
97
  <frontend_type>text</frontend_type>
98
  <sort_order>4</sort_order>
99
- <show_in_default>0</show_in_default>
100
- <show_in_website>0</show_in_website>
101
  <show_in_store>1</show_in_store>
102
  <fields>
103
  <enabled translate="label">
104
  <label>Automatic</label>
105
- <show_in_default>0</show_in_default>
106
- <show_in_website>0</show_in_website>
107
  <show_in_store>1</show_in_store>
108
  <frontend_type>select</frontend_type>
109
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -116,14 +153,14 @@
116
  <comment><![CDATA[<p>The &quot;Share&quot; button can be automatically added or manually inserted into the product page.<br>If you wish to manually place the &quot;Share&quot; button, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
117
  <frontend_type>text</frontend_type>
118
  <sort_order>5</sort_order>
119
- <show_in_default>0</show_in_default>
120
- <show_in_website>0</show_in_website>
121
  <show_in_store>1</show_in_store>
122
  <fields>
123
  <enabled translate="label">
124
  <label>Automatic</label>
125
- <show_in_default>0</show_in_default>
126
- <show_in_website>0</show_in_website>
127
  <show_in_store>1</show_in_store>
128
  <frontend_type>select</frontend_type>
129
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -136,14 +173,14 @@
136
  <comment><![CDATA[<p>The &quot;Add to Wishlist&quot; link can be automatically added or manually inserted into the product page.<br>If you wish to manually place the &quot;Add to Wishlist&quot; link, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
137
  <frontend_type>text</frontend_type>
138
  <sort_order>6</sort_order>
139
- <show_in_default>0</show_in_default>
140
- <show_in_website>0</show_in_website>
141
  <show_in_store>1</show_in_store>
142
  <fields>
143
  <enabled translate="label">
144
  <label>Automatic</label>
145
- <show_in_default>0</show_in_default>
146
- <show_in_website>0</show_in_website>
147
  <show_in_store>1</show_in_store>
148
  <frontend_type>select</frontend_type>
149
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -156,14 +193,14 @@
156
  <comment><![CDATA[<p>The &quot;Price Alert&quot; link can be automatically added or manually inserted into the product page.<br>If you wish to manually place the &quot;Price Alert&quot; link, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
157
  <frontend_type>text</frontend_type>
158
  <sort_order>7</sort_order>
159
- <show_in_default>0</show_in_default>
160
- <show_in_website>0</show_in_website>
161
  <show_in_store>1</show_in_store>
162
  <fields>
163
  <enabled translate="label">
164
  <label>Automatic</label>
165
- <show_in_default>0</show_in_default>
166
- <show_in_website>0</show_in_website>
167
  <show_in_store>1</show_in_store>
168
  <frontend_type>select</frontend_type>
169
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -171,7 +208,27 @@
171
  </enabled>
172
  </fields>
173
  </alert>
174
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  <setup translate="label">
176
  <label>Manual Setup Instructions</label>
177
  <comment><![CDATA[
@@ -184,7 +241,7 @@
184
  <div class="reg_main" style="padding:0 20px;margin-bottom: 20px">
185
  <textarea readonly="readonly" style="width: 80%; height: 50px;">
186
 
187
- <a class="cue-stream"></a>
188
 
189
  </textarea>
190
  </div>
@@ -200,7 +257,7 @@
200
  <div class="reg_main" style="padding:0 20px;margin-bottom: 20px">
201
  <textarea readonly="readonly" style="width: 80%; height: 60px;">
202
 
203
- <div class="cue-onebutton" data-imisku="<?php echo $this->htmlEscape($_product->getSku()) ?>"></div>
204
 
205
  </textarea>
206
  </div>
@@ -237,9 +294,9 @@
237
  </div>
238
  ]]></comment>
239
  <frontend_type>text</frontend_type>
240
- <sort_order>8</sort_order>
241
- <show_in_default>0</show_in_default>
242
- <show_in_website>0</show_in_website>
243
  <show_in_store>1</show_in_store>
244
  </setup>
245
  </groups>
14
  <label>Environment</label>
15
  <frontend_type>text</frontend_type>
16
  <sort_order>1</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
  <show_in_store>1</show_in_store>
20
  <fields>
21
  <env translate="label">
22
  <label>Env</label>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
  <show_in_store>1</show_in_store>
26
  <frontend_type>text</frontend_type>
27
  <sort_order>3</sort_order>
29
  </fields>
30
  </environment>
31
  <credentials translate="label">
32
+ <label>Cue API Credentials</label>
33
  <comment><![CDATA[<p>Get your Cue API key from your Merchant Hub account under the Code Implementation section.</p>]]></comment>
34
  <frontend_type>text</frontend_type>
35
  <sort_order>1</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
  <show_in_store>1</show_in_store>
39
  <fields>
40
  <api_key translate="label">
41
+ <label>API Credentials</label>
42
  <tooltip>Get your Cue API key from your Merchant Hub account.</tooltip>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  <frontend_type>text</frontend_type>
47
+ <sort_order>1</sort_order>
48
  </api_key>
49
+ <login translate="label">
50
+ <label>E-mail</label>
51
+ <tooltip>This field is required.</tooltip>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>2</sort_order>
57
+ <validate>validate-email</validate>
58
+ </login>
59
+ <password translate="label">
60
+ <label>Password</label>
61
+ <tooltip>This field is required.</tooltip>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <frontend_type>password</frontend_type>
66
+ <sort_order>3</sort_order>
67
+ </password>
68
+ <product_sync translate="button_label">
69
+ <label></label>
70
+ <button_label>Product Full Resync</button_label>
71
+ <frontend_model>cueconnect/system_config_productresync</frontend_model>
72
+ <sort_order>4</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </product_sync>
77
+ <customer_sync translate="button_label">
78
+ <label></label>
79
+ <button_label>Customer Full Resync</button_label>
80
+ <frontend_model>cueconnect/system_config_customerresync</frontend_model>
81
+ <sort_order>10</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </customer_sync>
86
  </fields>
87
  </credentials>
88
  <enabled translate="label">
90
  <comment><![CDATA[<p>When &quot;My-List&quot; is enabled, magento's native wishlist will be disabled and customers' saved items are transfered to &quot;My-List&quot;.</p>]]></comment>
91
  <frontend_type>text</frontend_type>
92
  <sort_order>2</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
  <show_in_store>1</show_in_store>
96
  <fields>
97
  <enabled translate="label">
98
  <label>Enabled</label>
99
  <tooltip>Enable My-List for this store</tooltip>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
  <show_in_store>1</show_in_store>
103
  <frontend_type>select</frontend_type>
104
  <source_model>adminhtml/system_config_source_yesno</source_model>
113
  <comment><![CDATA[<p>Available in two versions: a customizable widget or enterprise fully integrated that works seamlessly with your existing Customer Account and Profile.</p><p><strong>Standalone Widget:</strong> My-List technology is deployed on a standalone widget. Shoppers will opt into this service by signing up through the My-list login popup modal.</p><p><strong>Fully Integrated:</strong> works seamlessly with your existing Customer Account and Profile. Shoppers simply need to create an account with your store to have access to My-List capabilities.</p>]]></comment>
114
  <frontend_type>text</frontend_type>
115
  <sort_order>3</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
  <show_in_store>1</show_in_store>
119
  <fields>
120
  <mode translate="label">
122
  <frontend_type>select</frontend_type>
123
  <source_model>cueconnect/options</source_model>
124
  <sort_order>1</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
  <show_in_store>1</show_in_store>
128
  </mode>
129
  </fields>
133
  <comment><![CDATA[<p>The &quot;My List&quot; link can be automatically added to the top links or manually inserted in any location in your theme files. <br>If you wish to manually place the &quot;My List&quot; link, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
134
  <frontend_type>text</frontend_type>
135
  <sort_order>4</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
  <show_in_store>1</show_in_store>
139
  <fields>
140
  <enabled translate="label">
141
  <label>Automatic</label>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
  <show_in_store>1</show_in_store>
145
  <frontend_type>select</frontend_type>
146
  <source_model>adminhtml/system_config_source_yesno</source_model>
153
  <comment><![CDATA[<p>The &quot;Share&quot; button can be automatically added or manually inserted into the product page.<br>If you wish to manually place the &quot;Share&quot; button, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
154
  <frontend_type>text</frontend_type>
155
  <sort_order>5</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
  <show_in_store>1</show_in_store>
159
  <fields>
160
  <enabled translate="label">
161
  <label>Automatic</label>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>1</show_in_website>
164
  <show_in_store>1</show_in_store>
165
  <frontend_type>select</frontend_type>
166
  <source_model>adminhtml/system_config_source_yesno</source_model>
173
  <comment><![CDATA[<p>The &quot;Add to Wishlist&quot; link can be automatically added or manually inserted into the product page.<br>If you wish to manually place the &quot;Add to Wishlist&quot; link, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
174
  <frontend_type>text</frontend_type>
175
  <sort_order>6</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
  <show_in_store>1</show_in_store>
179
  <fields>
180
  <enabled translate="label">
181
  <label>Automatic</label>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
  <show_in_store>1</show_in_store>
185
  <frontend_type>select</frontend_type>
186
  <source_model>adminhtml/system_config_source_yesno</source_model>
193
  <comment><![CDATA[<p>The &quot;Price Alert&quot; link can be automatically added or manually inserted into the product page.<br>If you wish to manually place the &quot;Price Alert&quot; link, set this option to &quot;No&quot; and follow the steps in the Manual Setup Instructions section below in this page.</p>]]></comment>
194
  <frontend_type>text</frontend_type>
195
  <sort_order>7</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
  <show_in_store>1</show_in_store>
199
  <fields>
200
  <enabled translate="label">
201
  <label>Automatic</label>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
  <show_in_store>1</show_in_store>
205
  <frontend_type>select</frontend_type>
206
  <source_model>adminhtml/system_config_source_yesno</source_model>
208
  </enabled>
209
  </fields>
210
  </alert>
211
+ <tracking translate="label">
212
+ <label>Conversion Tracking</label>
213
+ <comment><![CDATA[<p>The Conversion Tracking code will be automatically added on the Confirmation page after a purchase.</p>]]></comment>
214
+ <frontend_type>text</frontend_type>
215
+ <sort_order>8</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
+ <fields>
220
+ <enabled translate="label">
221
+ <label>Automatic</label>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>1</show_in_store>
225
+ <frontend_type>select</frontend_type>
226
+ <source_model>adminhtml/system_config_source_yesno</source_model>
227
+ <sort_order>1</sort_order>
228
+ </enabled>
229
+ </fields>
230
+ </tracking>
231
+
232
  <setup translate="label">
233
  <label>Manual Setup Instructions</label>
234
  <comment><![CDATA[
241
  <div class="reg_main" style="padding:0 20px;margin-bottom: 20px">
242
  <textarea readonly="readonly" style="width: 80%; height: 50px;">
243
 
244
+ <a class="cue-stream"> My Wish List </a>
245
 
246
  </textarea>
247
  </div>
257
  <div class="reg_main" style="padding:0 20px;margin-bottom: 20px">
258
  <textarea readonly="readonly" style="width: 80%; height: 60px;">
259
 
260
+ <div class="cue-onebutton" data-imisku="<?php echo $this->getSku(); ?>" data-cid="<?php echo $this->getCID(); ?>"></div>
261
 
262
  </textarea>
263
  </div>
294
  </div>
295
  ]]></comment>
296
  <frontend_type>text</frontend_type>
297
+ <sort_order>9</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
  <show_in_store>1</show_in_store>
301
  </setup>
302
  </groups>
app/design/frontend/base/default/layout/cueconnect.xml CHANGED
@@ -63,4 +63,16 @@
63
  </reference> -->
64
  </reference>
65
  </default>
 
 
 
 
 
 
 
 
 
 
 
 
66
  </layout>
63
  </reference> -->
64
  </reference>
65
  </default>
66
+ <checkout_onepage_success>
67
+ <reference name="content">
68
+ <block type="cueconnect/checkout_success_share" name="product.info.cueconnect.share"
69
+ template="cueconnect/checkout/success/share.phtml" after="-"/>
70
+ </reference>
71
+ </checkout_onepage_success>
72
+ <checkout_multishipping_success>
73
+ <reference name="content">
74
+ <block type="cueconnect/checkout_success_share" name="product.info.cueconnect.share"
75
+ template="cueconnect/checkout/success/share.phtml" after="-"/>
76
+ </reference>
77
+ </checkout_multishipping_success>
78
  </layout>
app/design/frontend/base/default/template/cueconnect/checkout/success/share.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CueConnect_Cue
4
+ *
5
+ * @category CueConnect
6
+ * @package CueConnect_Cue
7
+ * @copyright Copyright (c) 2015 Cue Connect
8
+ * @author Cue Connect (http://www.cueconnect.com)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ /**
13
+ * @var $this CueConnect_Cue_Block_Checkout_Success_Share
14
+ */
15
+ ?>
16
+
17
+ <?php if ($this->isEnabled() && $this->getRetailerId() && $this->getFirstProductSku()): ?>
18
+ <!-- share button (widget) -->
19
+ <div class="cue-onebutton" data-imisku="<?php echo $this->escapeHtml($this->getFirstProductSku()) ?>"></div>
20
+ <?php if ($this->isTrackingEnabled()): ?>
21
+ <!-- Cue Conversion Tracking START -->
22
+ <img height="1" width="1" src="<?php echo $this->getTrackingSource() ?>" style="display:none"/>
23
+ <!-- Cue Conversion Tracking END -->
24
+ <?php endif; ?>
25
+ <?php endif; ?>
package.xml CHANGED
@@ -1,20 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cue</name>
4
- <version>3.0.19</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Powerful onsite marketing solution that helps increase engagement and conversions.</summary>
10
  <description>Drive greater ROI using an experience and tools shoppers already engage with on your site today. Provide Cue as a free personal shopping assistant to your customers and get an inside look at the items they save and conversations they have about them. Use the data to personalize various touch points of their shopping journey and thoughtfully stimulate conversions. Receive a free 90-day trial when you sign up and grow your business risk-free.</description>
11
- <notes>- fixes for internet explorer&#xD;
12
- - stability improvements&#xD;
13
- </notes>
14
- <authors><author><name>Cue Connect</name><user>hrais</user><email>hrais@cueconnect.com</email></author></authors>
15
- <date>2016-11-15</date>
16
- <time>10:00:05</time>
17
- <contents><target name="mageetc"><dir name="modules"><file name="CueConnect_Cue.xml" hash="6bd6cf8a7f9e647dc5729e8b0a77cfa1"/></dir></target><target name="magecommunity"><dir name="CueConnect"><dir name="Cue"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><file name="Product.php" hash="da20e73d9d6c46f8e9b8f2e0b130b69a"/></dir><file name="Index.php" hash="0c40f5f733dd6ecd2dd5a0453d1df14b"/><file name="Progress.php" hash="9767500cf8507eacd58c6b441a23d7c1"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Readonly.php" hash="847f56fbe8ce7b3334b8831981aff5fb"/></dir></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/><file name="._.DS_Store" hash="7d40ce63be1b295f209e8b80541f880d"/></dir></dir></dir><file name="Alert.php" hash="416cb0dba8485a32feb55306f2004664"/><file name="BaseCueBlock.php" hash="762bd5f6105ae2c82bb06888ac7e079d"/><file name="Collection.php" hash="34049e05086f52a1b74bcf7046f8a4f8"/><file name="Elist.php" hash="7832410c357470a083cf3d3679ab376d"/><file name="Favorite.php" hash="dd4bd0736e3cfea4d87e366fb0e228b3"/><file name="Js.php" hash="fa423dff429d99b1969fe9b2932be095"/><file name="Meta.php" hash="c16b07f77ac3c1ccb6fdcbcfc17ea703"/><file name="Navigation.php" hash="a43d159e9629ca20461c88ba9eb2c16a"/><file name="Share.php" hash="c0a2dd7fcc9a3537718fe811d1b4d7df"/></dir><dir name="Helper"><file name="Data.php" hash="b6483a7a9d4bd1025aaeec93840145a2"/><dir name="Wishlist"><file name="Data.php" hash="df7c81da4f905c5cfdc9adf18b2918f7"/></dir></dir><dir name="Model"><file name="CueConnect.php" hash="f87201b50f23e93a3c34f995de8a2fe5"/><file name="Demand.php" hash="e1d627c3207a364c861faf8decbcd7cc"/><dir name="Mysql4"><dir name="Demand"><file name="Collection.php" hash="4bd64ac5500aacdd861c05161bfdea60"/></dir><file name="Demand.php" hash="6b3b0d54f7d15fb55d47773ea96690d8"/><dir name="UserSync"><file name="Collection.php" hash="2f70172ef8506195355d0f34fa963de7"/></dir><file name="UserSync.php" hash="29fbf5674f15ba2a8db2c4f79545431c"/><dir name="WishlistSync"><file name="Collection.php" hash="c7ae0dc2a51c0d6e26360cba2c82c685"/></dir><file name="WishlistSync.php" hash="18079cce3dcf1129dd412d9de5199351"/></dir><file name="Observer.php" hash="e77bf0f4b7e37ae0f3652734d807a3e7"/><file name="Options.php" hash="6f312d0f07fb27129c6bb8eb83fdda8c"/><file name="UserSync.php" hash="45dc5508786c1db53088f4257cd5e3bd"/><file name="WishlistSync.php" hash="4b77f0097f4ed05ea63058cc1099ce66"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SyncController.php" hash="c9cd0b21c257205cae0f09044ba12333"/></dir><file name="ElistController.php" hash="dc112c88f2ced7880379bc87ec0138a9"/></dir><dir name="etc"><file name="config.xml" hash="9490de03f4daaa55e9ee849b51299306"/><file name="system.xml" hash="1801e59671ae1e08f4a0ac5aae4e8c7f"/></dir><dir name="sql"><dir name="cueconnect_setup"><file name="mysql4-install-3.0.9.php" hash="35e874c8e139497043b0e50ea6cf2fa0"/><file name="mysql4-upgrade-3.0.8-3.0.9.php" hash="54cfba6c455bebb9e614013642fb8fdd"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cueconnect.xml" hash="4b7e20ae6fda830865d7b30ee9e82aae"/></dir><dir name="template"><dir name="cueconnect"><file name="alert.phtml" hash="1b84532e255e6c4cfba9881e48013896"/><file name="collection.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="customer"><dir name="form"><file name="forgotpassword.phtml" hash="e77cbc35be0786aa61e08de47008595f"/><file name="login.phtml" hash="830203b7f6a8d8647a3812b51ac45721"/><file name="register.phtml" hash="b23b45199434202d0c7f582e804fb8c1"/></dir></dir><file name="elist.phtml" hash="951910b42b5115f2c39bd9d23b0b870e"/><file name="favorite.phtml" hash="89f0bca645d6f81e2a3c3cf375c5d44e"/><file name="js.phtml" hash="8a0fc52374904a5c932a927094cd0bfb"/><file name="links.phtml" hash="b5567bf97bd53184fb84e23c73ab4778"/><file name="meta.phtml" hash="57bd5367b677d71d935faf8a9dfefa82"/><file name="share.phtml" hash="781d6414c1b41f3bdb2a5befc8817463"/></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
- <dependencies><required><php><min>5.1.0</min><max>5.7.0</max></php><extension><name>Core</name><min/><max/></extension></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cue</name>
4
+ <version>3.0.20</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Powerful onsite marketing solution that helps increase engagement and conversions.</summary>
10
  <description>Drive greater ROI using an experience and tools shoppers already engage with on your site today. Provide Cue as a free personal shopping assistant to your customers and get an inside look at the items they save and conversations they have about them. Use the data to personalize various touch points of their shopping journey and thoughtfully stimulate conversions. Receive a free 90-day trial when you sign up and grow your business risk-free.</description>
11
+ <notes>- Improvements and bugfixes</notes>
12
+ <authors><author><name>Cue Connect</name><user>dev</user><email>dev@cueconnect.com</email></author></authors>
13
+ <date>2017-03-17</date>
14
+ <time>22:48:54</time>
15
+ <contents><target name="magecommunity"><dir name="CueConnect"><dir name="Cue"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><file name="Product.php" hash="da20e73d9d6c46f8e9b8f2e0b130b69a"/></dir><file name="Index.php" hash="0c40f5f733dd6ecd2dd5a0453d1df14b"/><file name="Progress.php" hash="9767500cf8507eacd58c6b441a23d7c1"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Readonly.php" hash="847f56fbe8ce7b3334b8831981aff5fb"/></dir></dir></dir></dir></dir><file name="Alert.php" hash="416cb0dba8485a32feb55306f2004664"/><file name="BaseCueBlock.php" hash="762bd5f6105ae2c82bb06888ac7e079d"/><dir name="Checkout"><dir name="Success"><file name="Share.php" hash="9d06573d7278f3d3bf72fa6b37f6a4eb"/></dir></dir><file name="Collection.php" hash="34049e05086f52a1b74bcf7046f8a4f8"/><file name="Elist.php" hash="7832410c357470a083cf3d3679ab376d"/><file name="Favorite.php" hash="dd4bd0736e3cfea4d87e366fb0e228b3"/><file name="Js.php" hash="fa423dff429d99b1969fe9b2932be095"/><file name="Meta.php" hash="c16b07f77ac3c1ccb6fdcbcfc17ea703"/><file name="Navigation.php" hash="a43d159e9629ca20461c88ba9eb2c16a"/><file name="Share.php" hash="c0a2dd7fcc9a3537718fe811d1b4d7df"/><dir name="System"><dir name="Config"><file name="Customerresync.php" hash="fdd3c3b6236bb76f291b7eff37386a25"/><file name="Productresync.php" hash="c58753a91269ec79c05d1efbf6eb637e"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="2845147829619755bd1cd399a1046ae7"/><file name="Product.php" hash="f116d42cb6ce9aff6dec783cf7bb7bea"/><dir name="Wishlist"><file name="Data.php" hash="df7c81da4f905c5cfdc9adf18b2918f7"/></dir></dir><dir name="Model"><file name="Cueconnect.php" hash="302a39210b0807fffe6cb31c52de69a0"/><file name="Demand.php" hash="e1d627c3207a364c861faf8decbcd7cc"/><dir name="Mysql4"><dir name="Demand"><file name="Collection.php" hash="4bd64ac5500aacdd861c05161bfdea60"/></dir><file name="Demand.php" hash="6b3b0d54f7d15fb55d47773ea96690d8"/><dir name="UserSync"><file name="Collection.php" hash="2f70172ef8506195355d0f34fa963de7"/></dir><file name="UserSync.php" hash="29fbf5674f15ba2a8db2c4f79545431c"/><dir name="WishlistSync"><file name="Collection.php" hash="c7ae0dc2a51c0d6e26360cba2c82c685"/></dir><file name="WishlistSync.php" hash="18079cce3dcf1129dd412d9de5199351"/></dir><file name="Observer.php" hash="e3a8b67f59c06030ee49ad23132dfce9"/><file name="Options.php" hash="6f312d0f07fb27129c6bb8eb83fdda8c"/><file name="UserSync.php" hash="45dc5508786c1db53088f4257cd5e3bd"/><file name="WishlistSync.php" hash="4b77f0097f4ed05ea63058cc1099ce66"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SyncController.php" hash="c9cd0b21c257205cae0f09044ba12333"/><dir name="System"><dir name="Config"><file name="CustomersyncController.php" hash="e294ed638c39e61402373927b4bd763b"/><file name="ProductsyncController.php" hash="11ad2928c8dc3ba01b0be06feba904f8"/></dir></dir></dir><file name="ElistController.php" hash="dc112c88f2ced7880379bc87ec0138a9"/></dir><dir name="etc"><file name="config.xml" hash="b73f7523a7a79d658089e4b9f702c7e1"/><file name="config.xml_backup" hash="bb24416e1f96b58ad969149e03d2f0ff"/><file name="system.xml" hash="a6207618c56ba33e5074779d2a93488c"/></dir><dir name="sql"><dir name="cueconnect_setup"><file name="mysql4-install-3.0.9.php" hash="35e874c8e139497043b0e50ea6cf2fa0"/><file name="mysql4-upgrade-3.0.8-3.0.9.php" hash="54cfba6c455bebb9e614013642fb8fdd"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cueconnect.xml" hash="9d71f0d163c1fd881896fbea137a45f9"/></dir><dir name="template"><dir name="cueconnect"><file name="alert.phtml" hash="1b84532e255e6c4cfba9881e48013896"/><dir name="checkout"><dir name="success"><file name="share.phtml" hash="f822230a4d6fe88a923065c1d06297fc"/></dir></dir><file name="collection.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="customer"><dir name="form"><file name="forgotpassword.phtml" hash="e77cbc35be0786aa61e08de47008595f"/><file name="login.phtml" hash="830203b7f6a8d8647a3812b51ac45721"/><file name="register.phtml" hash="b23b45199434202d0c7f582e804fb8c1"/></dir></dir><file name="elist.phtml" hash="b8c2211f819d4ae9b0faa23caee7f677"/><file name="favorite.phtml" hash="89f0bca645d6f81e2a3c3cf375c5d44e"/><file name="js.phtml" hash="65bb0542fbbb7c718a6702bb0bdc4866"/><file name="links.phtml" hash="b5567bf97bd53184fb84e23c73ab4778"/><file name="meta.phtml" hash="57bd5367b677d71d935faf8a9dfefa82"/><file name="share.phtml" hash="781d6414c1b41f3bdb2a5befc8817463"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CueConnect_Cue.xml" hash="6bd6cf8a7f9e647dc5729e8b0a77cfa1"/></dir></target></contents>
 
 
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>5.6.2</max></php></required></dependencies>
18
  </package>