neklo_monitor - Version 1.2.1

Version Notes

Notifications on new orders - on all or exceptional only (payment amount exceeded, number of items exceeded).

Notifications on inventory changes with the possibility to set value for each attribute set - a product becomes out of stock or drops to low inventory.

Daily sales report notifications - every day at the time pointed a notification comes with information gathered during the previous day.

Download this release

Release Info

Developer NEKLO
Extension neklo_monitor
Version 1.2.1
Comparing to
See all releases


Code changes from version 1.1.3 to 1.2.1

Files changed (30) hide show
  1. app/code/community/Neklo/Core/etc/config.xml +2 -2
  2. app/code/community/Neklo/Monitor/Controller/Abstract.php +9 -0
  3. app/code/community/Neklo/Monitor/Helper/Config.php +39 -4
  4. app/code/community/Neklo/Monitor/Helper/Data.php +11 -0
  5. app/code/community/Neklo/Monitor/Helper/Flat.php +14 -0
  6. app/code/community/Neklo/Monitor/Helper/Request.php +2 -0
  7. app/code/community/Neklo/Monitor/Model/Cron/Server.php +1 -2
  8. app/code/community/Neklo/Monitor/Model/Cron/Store.php +1 -2
  9. app/code/community/Neklo/Monitor/Model/Gateway/Connector.php +20 -13
  10. app/code/community/Neklo/Monitor/Model/Gateway/Queue.php +9 -0
  11. app/code/community/Neklo/Monitor/Model/Linfo.php +2 -1
  12. app/code/community/Neklo/Monitor/Model/Log.php +0 -6
  13. app/code/community/Neklo/Monitor/Model/Minfo/Parser.php +5 -0
  14. app/code/community/Neklo/Monitor/Model/Observer.php +197 -0
  15. app/code/community/Neklo/Monitor/Model/Resource/Changelog.php +53 -0
  16. app/code/community/Neklo/Monitor/Model/Resource/Gateway/Queue.php +49 -0
  17. app/code/community/Neklo/Monitor/Model/Resource/Gateway/Queue/Collection.php +10 -0
  18. app/code/community/Neklo/Monitor/Model/Resource/Minfo/Daily.php +115 -0
  19. app/code/community/Neklo/Monitor/Model/Resource/Minfo/Daily/ReportsOrderCollection.php +138 -0
  20. app/code/community/Neklo/Monitor/Model/System/Config/Source/Server/Type.php +2 -2
  21. app/code/community/Neklo/Monitor/controllers/AuthController.php +3 -1
  22. app/code/community/Neklo/Monitor/controllers/CustomerController.php +8 -1
  23. app/code/community/Neklo/Monitor/controllers/DashboardController.php +141 -54
  24. app/code/community/Neklo/Monitor/controllers/InfoController.php +23 -0
  25. app/code/community/Neklo/Monitor/controllers/ProductController.php +10 -7
  26. app/code/community/Neklo/Monitor/etc/config.xml +42 -1
  27. app/code/community/Neklo/Monitor/sql/neklo_monitor_setup/mysql4-upgrade-1.1.2-1.1.3.php +2 -0
  28. app/code/community/Neklo/Monitor/sql/neklo_monitor_setup/mysql4-upgrade-1.1.3-1.2.0.php +24 -0
  29. app/code/community/Neklo/Monitor/sql/neklo_monitor_setup/mysql4-upgrade-1.2.0-1.2.1.php +40 -0
  30. package.xml +5 -1
app/code/community/Neklo/Core/etc/config.xml CHANGED
@@ -36,9 +36,9 @@
36
  <adminhtml>
37
  <layout>
38
  <updates>
39
- <awall module="Neklo_Core">
40
  <file>neklo/core.xml</file>
41
- </awall>
42
  </updates>
43
  </layout>
44
  <translate>
36
  <adminhtml>
37
  <layout>
38
  <updates>
39
+ <neklo_core module="Neklo_Core">
40
  <file>neklo/core.xml</file>
41
+ </neklo_core>
42
  </updates>
43
  </layout>
44
  <translate>
app/code/community/Neklo/Monitor/Controller/Abstract.php CHANGED
@@ -3,6 +3,7 @@
3
  class Neklo_Monitor_Controller_Abstract extends Mage_Core_Controller_Front_Action
4
  {
5
  const PAGE_SIZE = 50;
 
6
 
7
  // some controllers (auth) should skip isConnected checking @see preDispatch
8
  protected $_allowConnectedOnly = true;
@@ -44,9 +45,17 @@ class Neklo_Monitor_Controller_Abstract extends Mage_Core_Controller_Front_Actio
44
  )
45
  );
46
 
 
 
47
  return $this;
48
  }
49
 
 
 
 
 
 
 
50
  protected function _jsonResult($data)
51
  {
52
  $this->getResponse()->setHeader('Content-type', 'text/json');
3
  class Neklo_Monitor_Controller_Abstract extends Mage_Core_Controller_Front_Action
4
  {
5
  const PAGE_SIZE = 50;
6
+ const API_VERSION_HEADER = 'X-API-Version';
7
 
8
  // some controllers (auth) should skip isConnected checking @see preDispatch
9
  protected $_allowConnectedOnly = true;
45
  )
46
  );
47
 
48
+ Mage::register('neklo_monitor_request', true, true);
49
+
50
  return $this;
51
  }
52
 
53
+ public function postDispatch()
54
+ {
55
+ $this->getResponse()->setHeader(self::API_VERSION_HEADER, $this->_getConfigHelper()->getModuleVersion());
56
+ return parent::postDispatch();
57
+ }
58
+
59
  protected function _jsonResult($data)
60
  {
61
  $this->getResponse()->setHeader('Content-type', 'text/json');
app/code/community/Neklo/Monitor/Helper/Config.php CHANGED
@@ -19,6 +19,11 @@ class Neklo_Monitor_Helper_Config extends Mage_Core_Helper_Data
19
  'frequency' => self::GATEWAY_FREQUENCY,
20
  );
21
 
 
 
 
 
 
22
  public function isEnabled()
23
  {
24
  return Mage::getStoreConfigFlag(self::GENERAL_IS_ENABLED);
@@ -111,6 +116,8 @@ class Neklo_Monitor_Helper_Config extends Mage_Core_Helper_Data
111
  $this->_saveConfig($configPath . '_' . $serverType, $config[$field]);
112
  }
113
 
 
 
114
  // reinit configuration cache
115
  Mage::getConfig()->reinit();
116
  }
@@ -133,13 +140,10 @@ class Neklo_Monitor_Helper_Config extends Mage_Core_Helper_Data
133
  return Mage::getStoreConfig(self::GATEWAY_LAST_UPDATE . '_' . $serverType);
134
  }
135
 
136
- public function updateGatewayLastUpdate()
137
  {
138
  $serverType = $this->getGatewayServerType();
139
  $this->_saveConfig(self::GATEWAY_LAST_UPDATE . '_' . $serverType, time());
140
-
141
- // reinit configuration cache
142
- Mage::getConfig()->reinit();
143
  }
144
 
145
  protected function _saveConfig($path, $value, $scope = 'default', $scopeId = 0)
@@ -147,4 +151,35 @@ class Neklo_Monitor_Helper_Config extends Mage_Core_Helper_Data
147
  $configModel = Mage::getModel('core/config');
148
  $configModel->saveConfig($path, $value, $scope, $scopeId);
149
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
19
  'frequency' => self::GATEWAY_FREQUENCY,
20
  );
21
 
22
+ public function getModuleVersion()
23
+ {
24
+ return (string) Mage::getConfig()->getNode('modules/Neklo_Monitor/version');
25
+ }
26
+
27
  public function isEnabled()
28
  {
29
  return Mage::getStoreConfigFlag(self::GENERAL_IS_ENABLED);
116
  $this->_saveConfig($configPath . '_' . $serverType, $config[$field]);
117
  }
118
 
119
+ $this->_updateGatewayLastUpdate();
120
+
121
  // reinit configuration cache
122
  Mage::getConfig()->reinit();
123
  }
140
  return Mage::getStoreConfig(self::GATEWAY_LAST_UPDATE . '_' . $serverType);
141
  }
142
 
143
+ protected function _updateGatewayLastUpdate()
144
  {
145
  $serverType = $this->getGatewayServerType();
146
  $this->_saveConfig(self::GATEWAY_LAST_UPDATE . '_' . $serverType, time());
 
 
 
147
  }
148
 
149
  protected function _saveConfig($path, $value, $scope = 'default', $scopeId = 0)
151
  $configModel = Mage::getModel('core/config');
152
  $configModel->saveConfig($path, $value, $scope, $scopeId);
153
  }
154
+
155
+
156
+
157
+
158
+
159
+ public function getAlertOutofstockEnabled()
160
+ {
161
+ $serverType = $this->getGatewayServerType();
162
+ return Mage::getStoreConfigFlag(self::ALERT_INVENTORY_OUTOFSTOCK_IS_ENABLED . '_' . $serverType);
163
+ }
164
+
165
+
166
+ public function getAlertLowstockEnabled()
167
+ {
168
+ $serverType = $this->getGatewayServerType();
169
+ return Mage::getStoreConfigFlag(self::ALERT_INVENTORY_LOWSTOCK_IS_ENABLED . '_' . $serverType);
170
+ }
171
+
172
+ public function getAlertLowstockConfig()
173
+ {
174
+ $serverType = $this->getGatewayServerType();
175
+ $data = Mage::getStoreConfig(self::ALERT_INVENTORY_LOWSTOCK_ATTRSETS . '_' . $serverType);
176
+ if (!$data) {
177
+ return array();
178
+ }
179
+
180
+ return Mage::helper('core')->jsonDecode($data);
181
+ }
182
+
183
+
184
+
185
  }
app/code/community/Neklo/Monitor/Helper/Data.php CHANGED
@@ -2,4 +2,15 @@
2
 
3
  class Neklo_Monitor_Helper_Data extends Mage_Core_Helper_Data
4
  {
 
 
 
 
 
 
 
 
 
 
 
5
  }
2
 
3
  class Neklo_Monitor_Helper_Data extends Mage_Core_Helper_Data
4
  {
5
+ public function resizeProductImage($product, $attribute)
6
+ {
7
+ $hlp = Mage::helper('catalog/image');
8
+ /** @var Mage_Catalog_Helper_Image $hlp */
9
+ $hlp->init($product, $attribute);
10
+
11
+ return array(
12
+ 'image2xUrl' => $hlp->resize(224, 300)->__toString(),
13
+ 'image3xUrl' => $hlp->resize(336, 450)->__toString(),
14
+ );
15
+ }
16
  }
app/code/community/Neklo/Monitor/Helper/Flat.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Neklo_Monitor_Helper_Flat extends Mage_Catalog_Helper_Product_Flat
5
+ {
6
+ public function isEnabled($store = null)
7
+ {
8
+ if (Mage::registry('neklo_monitor_request')) {
9
+ return false;
10
+ }
11
+
12
+ return parent::isEnabled($store);
13
+ }
14
+ }
app/code/community/Neklo/Monitor/Helper/Request.php CHANGED
@@ -52,6 +52,7 @@ class Neklo_Monitor_Helper_Request
52
  ),
53
 
54
  'info/storeviewlist' => 'common//common',
 
55
  'info/total' => array( // common//common + store + from
56
  'sid',
57
  'device_id',
@@ -79,6 +80,7 @@ class Neklo_Monitor_Helper_Request
79
  'customer/list' => 'dashboard//common',
80
  'customer/online' => 'dashboard//common',
81
 
 
82
  'product/outofstock' => 'dashboard//common',
83
  'order/list' => 'dashboard//common',
84
 
52
  ),
53
 
54
  'info/storeviewlist' => 'common//common',
55
+ 'info/attrsetlist' => 'common//common',
56
  'info/total' => array( // common//common + store + from
57
  'sid',
58
  'device_id',
80
  'customer/list' => 'dashboard//common',
81
  'customer/online' => 'dashboard//common',
82
 
83
+ 'config/alertsave' => 'dashboard//common',
84
  'product/outofstock' => 'dashboard//common',
85
  'order/list' => 'dashboard//common',
86
 
app/code/community/Neklo/Monitor/Model/Cron/Server.php CHANGED
@@ -10,9 +10,8 @@ class Neklo_Monitor_Model_Cron_Server extends Neklo_Monitor_Model_Cron_Abstract
10
  try {
11
  $gatewayConfig = $this->_getConnector()->sendInfo('server', $serverData);
12
  $this->_getConfig()->updateGatewayConfig($gatewayConfig);
13
- $this->_getConfig()->updateGatewayLastUpdate();
14
  } catch (Exception $e) {
15
- Mage::logException($e);
16
  $msg = $schedule->getMessages();
17
  if ($msg) {
18
  $msg .= "\n";
10
  try {
11
  $gatewayConfig = $this->_getConnector()->sendInfo('server', $serverData);
12
  $this->_getConfig()->updateGatewayConfig($gatewayConfig);
 
13
  } catch (Exception $e) {
14
+ // Mage::logException($e);
15
  $msg = $schedule->getMessages();
16
  if ($msg) {
17
  $msg .= "\n";
app/code/community/Neklo/Monitor/Model/Cron/Store.php CHANGED
@@ -10,9 +10,8 @@ class Neklo_Monitor_Model_Cron_Store extends Neklo_Monitor_Model_Cron_Abstract
10
  try {
11
  $gatewayConfig = $this->_getConnector()->sendInfo('store', $storeData);
12
  $this->_getConfig()->updateGatewayConfig($gatewayConfig);
13
- $this->_getConfig()->updateGatewayLastUpdate();
14
  } catch (Exception $e) {
15
- Mage::logException($e);
16
  $msg = $schedule->getMessages();
17
  if ($msg) {
18
  $msg .= "\n";
10
  try {
11
  $gatewayConfig = $this->_getConnector()->sendInfo('store', $storeData);
12
  $this->_getConfig()->updateGatewayConfig($gatewayConfig);
 
13
  } catch (Exception $e) {
14
+ // Mage::logException($e);
15
  $msg = $schedule->getMessages();
16
  if ($msg) {
17
  $msg .= "\n";
app/code/community/Neklo/Monitor/Model/Gateway/Connector.php CHANGED
@@ -18,38 +18,45 @@ class Neklo_Monitor_Model_Gateway_Connector
18
  array(
19
  'maxredirects' => 0,
20
  'timeout' => 30,
 
21
  )
22
  )
23
- ->setHeaders('SID', $this->_getConfig()->getGatewaySid())
24
  ;
25
  }
26
  return $this->_client;
27
  }
28
 
29
- public function sendInfo($type, $info)
30
  {
31
- $requestData = array(
32
- $type => $info,
33
- );
 
 
 
 
 
 
 
 
34
  $client = $this->getClient();
35
 
36
- $client->setUri($this->_getUri());
 
 
37
 
38
- $result = $client
39
- ->setRawData(Mage::helper('core')->jsonEncode($requestData))
40
- ->request()
41
- ;
42
 
43
  if (!$result->isSuccessful()) {
44
- throw new Exception('Error sending request: '.$result->getMessage());
45
  }
46
 
47
  return Mage::helper('core')->jsonDecode($this->_getBody($result));
48
  }
49
 
50
- protected function _getUri()
51
  {
52
- return $this->_getConfig()->getGatewayServerUri() . 'server/info';
53
  }
54
 
55
  /**
18
  array(
19
  'maxredirects' => 0,
20
  'timeout' => 30,
21
+ 'verifypeer' => 0,
22
  )
23
  )
 
24
  ;
25
  }
26
  return $this->_client;
27
  }
28
 
29
+ public function sendInfo($type, $info, $action = 'info')
30
  {
31
+ if (is_null($type)) {
32
+ // multiple types, $info is an assoc array
33
+ $requestData = $info;
34
+ } else {
35
+ $requestData = array(
36
+ $type => $info,
37
+ );
38
+ }
39
+
40
+ $requestData['SID'] = $this->_getConfig()->getGatewaySid();
41
+
42
  $client = $this->getClient();
43
 
44
+ $url = $this->_getUri($action);
45
+ $client->setUri($url);
46
+ $client->setRawData(Mage::helper('core')->jsonEncode($requestData));
47
 
48
+ $result = $client->request();
 
 
 
49
 
50
  if (!$result->isSuccessful()) {
51
+ throw new Exception(Mage::helper('core')->__('Error sending request to %s: %s', $url, $result->getMessage()));
52
  }
53
 
54
  return Mage::helper('core')->jsonDecode($this->_getBody($result));
55
  }
56
 
57
+ protected function _getUri($action)
58
  {
59
+ return $this->_getConfig()->getGatewayServerUri() . 'server/' . $action;
60
  }
61
 
62
  /**
app/code/community/Neklo/Monitor/Model/Gateway/Queue.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Monitor_Model_Gateway_Queue extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('neklo_monitor/gateway_queue');
8
+ }
9
+ }
app/code/community/Neklo/Monitor/Model/Linfo.php CHANGED
@@ -23,7 +23,7 @@ class Neklo_Monitor_Model_Linfo extends \Linfo\Linfo
23
  'webservice' => false,
24
  'phpversion' => false,
25
  'process_stats' => false,
26
- 'hostname' => false,
27
  'devices' => false,
28
  'model' => false,
29
  'numLoggedIn' => false,
@@ -69,6 +69,7 @@ class Neklo_Monitor_Model_Linfo extends \Linfo\Linfo
69
 
70
  // OS
71
  'OS' => 'os/name',
 
72
  'Distro/name' => 'os/distro/name',
73
  'Distro/version' => 'os/distro/version',
74
 
23
  'webservice' => false,
24
  'phpversion' => false,
25
  'process_stats' => false,
26
+ 'hostname' => true,
27
  'devices' => false,
28
  'model' => false,
29
  'numLoggedIn' => false,
69
 
70
  // OS
71
  'OS' => 'os/name',
72
+ 'HostName' => 'os/hostname',
73
  'Distro/name' => 'os/distro/name',
74
  'Distro/version' => 'os/distro/version',
75
 
app/code/community/Neklo/Monitor/Model/Log.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- class Neklo_Monitor_Model_Log
4
- {
5
-
6
- }
 
 
 
 
 
 
app/code/community/Neklo/Monitor/Model/Minfo/Parser.php CHANGED
@@ -129,6 +129,11 @@ class Neklo_Monitor_Model_Minfo_Parser
129
  $collection->addStoreFilter($storeId);
130
  }
131
 
 
 
 
 
 
132
  // copy-pasted from CE 1.4 Layer Model
133
  /*
134
  $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
129
  $collection->addStoreFilter($storeId);
130
  }
131
 
132
+ $collection->addAttributeToFilter(
133
+ 'status',
134
+ array('in' => Mage::getSingleton('catalog/product_status')->getSaleableStatusIds())
135
+ );
136
+
137
  // copy-pasted from CE 1.4 Layer Model
138
  /*
139
  $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
app/code/community/Neklo/Monitor/Model/Observer.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Monitor_Model_Observer
4
+ {
5
+ /**
6
+ * @param Varien_Event_Observer $observer
7
+ * @observe order place event
8
+ */
9
+ public function checkOrder(Varien_Event_Observer $observer)
10
+ {
11
+ if (!$this->_getConfig()->isEnabled()) {
12
+ return;
13
+ }
14
+
15
+ if (!$this->_getConfig()->isConnected()) {
16
+ return;
17
+ }
18
+
19
+ /** @var Mage_Sales_Model_Order $order */
20
+ $order = $observer->getEvent()->getOrder();
21
+
22
+ $total = $order->getGrandTotal();
23
+ $totalFormated = $order->getOrderCurrency()->format($total, array(), false);
24
+
25
+ $info = array(
26
+ 'increment_id' => $order->getIncrementId(),
27
+ 'grand_total' => $total,
28
+ 'grand_total_formated' => $totalFormated,
29
+ 'qty' => $order->getTotalQtyOrdered(),
30
+ );
31
+
32
+ $this->_addToRequestQueue('order', $info);
33
+ }
34
+
35
+ protected function _addToRequestQueue($type, $info)
36
+ {
37
+ /** @var Neklo_Monitor_Model_Gateway_Queue $queue */
38
+ $queue = Mage::getModel('neklo_monitor/gateway_queue');
39
+ $queue
40
+ ->setType($type)
41
+ ->setMessage(Mage::helper('core')->jsonEncode($info))
42
+ ->setScheduledAt(time())
43
+ ->save();
44
+ }
45
+
46
+ // * * * * * cronjob
47
+
48
+ public function sendQueuedRequest(Mage_Cron_Model_Schedule $schedule)
49
+ {
50
+ if (!$this->_getConfig()->isEnabled()) {
51
+ $schedule->setMessages('Disabled');
52
+ return;
53
+ }
54
+
55
+ if (!$this->_getConfig()->isConnected()) {
56
+ $schedule->setMessages('Not connected');
57
+ return;
58
+ }
59
+
60
+ $startedAt = time();
61
+
62
+ /** @var Neklo_Monitor_Model_Resource_Gateway_Queue $resc */
63
+ $resc = Mage::getResourceModel('neklo_monitor/gateway_queue');
64
+
65
+ // release entries stuck for 1hr and more: started, but not sent
66
+
67
+ $countStuck = $resc->releaseEntries($startedAt - 60 * 60);
68
+ if ($countStuck > 0) {
69
+ $schedule->setMessages($schedule->getMessages()
70
+ . sprintf('%d stuck items rescheduled.', $countStuck));
71
+ }
72
+
73
+
74
+ // remove old entries sent 30 days ago: started and sent
75
+
76
+ $countOld = $resc->cleanupEntries($startedAt - 60 * 60 * 24 * 30);
77
+ if ($countOld > 0) {
78
+ $schedule->setMessages($schedule->getMessages()
79
+ . sprintf('%d archive items removed.', $countOld));
80
+ }
81
+
82
+
83
+ /** @var Neklo_Monitor_Model_Resource_Gateway_Queue_Collection $collSending */
84
+ $collSending = Mage::getResourceModel('neklo_monitor/gateway_queue_collection');
85
+ $collSending->addFieldToFilter('started_at', $startedAt);
86
+ if ($collSending->getSize() > 0) {
87
+ // to prevent several cron runs at the same timestamp
88
+ return;
89
+ }
90
+
91
+ // mark pending requests to run at $time
92
+ // to prevent same rows sent by different cron processes,
93
+ // i.e. when previous sending process lasts too long and another cron process has started
94
+
95
+ $resc->bookEntries($startedAt);
96
+
97
+ // fetch entries to send
98
+
99
+ /** @var Neklo_Monitor_Model_Resource_Gateway_Queue_Collection $collToSend */
100
+ $collToSend = Mage::getResourceModel('neklo_monitor/gateway_queue_collection');
101
+ $collToSend->addFieldToFilter('started_at', $startedAt);
102
+ if (!$collToSend->getSize()) {
103
+ $schedule->setMessages($schedule->getMessages()
104
+ . 'Nothing to send');
105
+ return;
106
+ }
107
+
108
+ $requestData = array();
109
+ foreach ($collToSend as $queue) {
110
+ /** @var Neklo_Monitor_Model_Gateway_Queue $queue */
111
+ if (!array_key_exists($queue->getType(), $requestData)) {
112
+ $requestData[ $queue->getType() ] = array();
113
+ }
114
+ $requestData[ $queue->getType() ][] = base64_encode($queue->getMessage());
115
+ }
116
+
117
+ try {
118
+ $gatewayConfig = $this->_getConnector()->sendInfo(null, $requestData, 'alert');
119
+ $this->_getConfig()->updateGatewayConfig($gatewayConfig);
120
+ } catch (Exception $e) {
121
+ $schedule->setMessages($schedule->getMessages()
122
+ . $e->getMessage());
123
+ // Mage::logException($e);
124
+ }
125
+
126
+ if ($collToSend->count() > 0) {
127
+ $schedule->setMessages($schedule->getMessages()
128
+ . sprintf('%d items sent.', $collToSend->count())); // collection is already loaded, so we do not use ->getSize()
129
+ }
130
+
131
+ // mark as sent
132
+
133
+ $sentAt = time();
134
+ $resc->sentEntries($startedAt, $sentAt);
135
+
136
+ }
137
+
138
+ // * * * * * cronjob
139
+ // create queue messages based on inventory changelog product ids list
140
+ public function convertChangelogToQueue(Mage_Cron_Model_Schedule $schedule)
141
+ {
142
+ if (!$this->_getConfig()->isEnabled()) {
143
+ $schedule->setMessages('Disabled');
144
+ return;
145
+ }
146
+
147
+ if (!$this->_getConfig()->isConnected()) {
148
+ $schedule->setMessages('Not connected');
149
+ return;
150
+ }
151
+
152
+ /** @var Neklo_Monitor_Model_Resource_Changelog $resrc */
153
+ $resrc = Mage::getResourceModel('neklo_monitor/changelog');
154
+ $data = $resrc->fetchChangelog();
155
+ if ($data && is_array($data)) {
156
+ foreach ($data as $_item) {
157
+ $this->_addToRequestQueue('inventory', array(
158
+ 'name' => $_item['name'],
159
+ 'sku' => $_item['sku'],
160
+ 'attribute_set_id' => $_item['attribute_set_id'],
161
+ 'attribute_set_name'=> $_item['attribute_set_name'],
162
+ 'qty' => $_item['qty'],
163
+ 'in_stock' => $_item['stock_status'] ? 1 : 0,
164
+ ));
165
+ }
166
+
167
+ $schedule->setMessages($schedule->getMessages()
168
+ . sprintf('Ready to send %d inventory updates.', count($data)));
169
+ }
170
+ }
171
+
172
+ public function aggregateSalesReportOrderData($schedule)
173
+ {
174
+ $report = Mage::getResourceModel('neklo_monitor/minfo_daily')->collect();
175
+
176
+ $this->_addToRequestQueue('dailyreport', $report);
177
+
178
+ $schedule->setMessages($schedule->getMessages()
179
+ . sprintf('Collected sales report with %d new orders.', $report['orders']['all']['orders_count']));
180
+ }
181
+
182
+ /**
183
+ * @return Neklo_Monitor_Helper_Config
184
+ */
185
+ protected function _getConfig()
186
+ {
187
+ return Mage::helper('neklo_monitor/config');
188
+ }
189
+
190
+ /**
191
+ * @return Neklo_Monitor_Model_Gateway_Connector
192
+ */
193
+ protected function _getConnector()
194
+ {
195
+ return Mage::getSingleton('neklo_monitor/gateway_connector');
196
+ }
197
+ }
app/code/community/Neklo/Monitor/Model/Resource/Changelog.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Neklo_Monitor_Model_Resource_Changelog extends Mage_Core_Model_Mysql4_Abstract
5
+ {
6
+ protected function _construct()
7
+ {
8
+ $this->_init('neklo_monitor/cicl', 'cl_id');
9
+ }
10
+
11
+ public function fetchChangelog()
12
+ {
13
+ /** @var Mage_Catalog_Model_Resource_Product $resrc */
14
+ $resrc = Mage::getResourceModel('catalog/product');
15
+ /** @var Mage_Eav_Model_Config $eavConfig */
16
+ $eavConfig = Mage::getSingleton('eav/config');
17
+ /** @var Mage_Eav_Model_Entity_Attribute_Abstract $attrName */
18
+ $attrName = $eavConfig->getCollectionAttribute($resrc->getType(), 'name');
19
+ $attrNameTable = $attrName->getBackendTable();
20
+
21
+ $select = $this->_getReadAdapter()->select()
22
+ ->distinct()
23
+ ->from(array('cl' => $this->getMainTable()), array('cl.product_id'))
24
+ ->join(array('st' => $this->getTable('cataloginventory/stock_status')),
25
+ 'st.product_id = cl.product_id',
26
+ array('st.qty', 'st.stock_status'))
27
+ ->join(array('n' => $attrNameTable),
28
+ 'n.entity_id = cl.product_id',
29
+ array('name' => 'n.value'))
30
+ ->join(array('p' => $this->getTable('catalog/product')),
31
+ 'p.entity_id = cl.product_id',
32
+ array('p.sku', 'p.attribute_set_id'))
33
+ ->join(array('as' => $this->getTable('eav/attribute_set')),
34
+ 'as.attribute_set_id = p.attribute_set_id',
35
+ array('as.attribute_set_name'))
36
+ ->where('n.attribute_id = ?', $attrName->getId())
37
+ ;
38
+
39
+ $data = $this->_getReadAdapter()->fetchAssoc($select);
40
+
41
+ $productIds = array();
42
+ foreach($data as $_val) {
43
+ $productIds[] = $_val['product_id'];
44
+ }
45
+
46
+ if ($productIds) {
47
+ $this->_getWriteAdapter()->delete($this->getMainTable(), array('product_id IN (?)' => $productIds));
48
+ }
49
+
50
+ return $data;
51
+ }
52
+
53
+ }
app/code/community/Neklo/Monitor/Model/Resource/Gateway/Queue.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Neklo_Monitor_Model_Resource_Gateway_Queue extends Mage_Core_Model_Mysql4_Abstract
5
+ {
6
+ protected function _construct()
7
+ {
8
+ $this->_init('neklo_monitor/queue', 'queue_id');
9
+ }
10
+
11
+ public function bookEntries($startedAt)
12
+ {
13
+ return $this->_getWriteAdapter()->update($this->getMainTable(),
14
+ array('started_at' => $startedAt),
15
+ array('started_at = ?' => 0)
16
+ );
17
+ }
18
+
19
+ public function sentEntries($startedAt, $sentAt)
20
+ {
21
+ return $this->_getWriteAdapter()->update($this->getMainTable(),
22
+ array('sent_at' => $sentAt),
23
+ array('started_at = ?' => $startedAt)
24
+ );
25
+ }
26
+
27
+ public function releaseEntries($startedAt)
28
+ {
29
+ return $this->_getWriteAdapter()->update($this->getMainTable(),
30
+ array('started_at' => 0),
31
+ array(
32
+ 'started_at < ?' => $startedAt,
33
+ 'sent_at = ?' => 0,
34
+ )
35
+ );
36
+ }
37
+
38
+ public function cleanupEntries($startedAt)
39
+ {
40
+ return $this->_getWriteAdapter()->delete($this->getMainTable(),
41
+ array(
42
+ 'started_at > ?' => 0,
43
+ 'started_at < ?' => $startedAt,
44
+ 'sent_at > ?' => 0,
45
+ 'sent_at < ?' => $startedAt,
46
+ )
47
+ );
48
+ }
49
+ }
app/code/community/Neklo/Monitor/Model/Resource/Gateway/Queue/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Neklo_Monitor_Model_Resource_Gateway_Queue_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
5
+ {
6
+ protected function _construct()
7
+ {
8
+ $this->_init('neklo_monitor/gateway_queue');
9
+ }
10
+ }
app/code/community/Neklo/Monitor/Model/Resource/Minfo/Daily.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Neklo_Monitor_Model_Resource_Minfo_Daily extends Mage_Sales_Model_Mysql4_Report_Abstract
5
+ {
6
+ protected function _construct()
7
+ {
8
+ $this->_init('sales/order_aggregated_created', 'id');
9
+ }
10
+
11
+ public function collect()
12
+ {
13
+ $dateEnd = new Zend_Date(Mage::getModel('core/date')->gmtTimestamp());
14
+ $dateStart = clone $dateEnd;
15
+
16
+ // go to the end of the previous day
17
+ $dateEnd->subDay(1);
18
+ $dateEnd->setHour(23);
19
+ $dateEnd->setMinute(59);
20
+ $dateEnd->setSecond(59);
21
+
22
+ // go to the beginning of the previous day
23
+ $dateStart->subDay(1);
24
+ $dateStart->setHour(0);
25
+ $dateStart->setMinute(0);
26
+ $dateStart->setSecond(0);
27
+
28
+
29
+ $report = array(
30
+ 'orders' => array(
31
+ 'all' => array(
32
+ 'orders_count' => 0,
33
+ 'subtotal_sum' => $this->_convertPrice(0),
34
+ 'subtotal_avg' => $this->_convertPrice(0),
35
+ 'revenue_sum' => $this->_convertPrice(0),
36
+ 'revenue_avg' => $this->_convertPrice(0),
37
+ 'items_qty_sum' => 0,
38
+ 'items_qty_avg' => 0,
39
+ ),
40
+ 'newcustomers' => array(
41
+ 'orders_count' => 0,
42
+ 'subtotal_sum' => $this->_convertPrice(0),
43
+ 'subtotal_avg' => $this->_convertPrice(0),
44
+ 'revenue_sum' => $this->_convertPrice(0),
45
+ 'revenue_avg' => $this->_convertPrice(0),
46
+ 'items_qty_sum' => 0,
47
+ 'items_qty_avg' => 0,
48
+ ),
49
+ 'oldcustomers' => array(
50
+ 'orders_count' => 0,
51
+ 'subtotal_sum' => $this->_convertPrice(0),
52
+ 'subtotal_avg' => $this->_convertPrice(0),
53
+ 'revenue_sum' => $this->_convertPrice(0),
54
+ 'revenue_avg' => $this->_convertPrice(0),
55
+ 'items_qty_sum' => 0,
56
+ 'items_qty_avg' => 0,
57
+ ),
58
+ 'guests' => array(
59
+ 'orders_count' => 0,
60
+ 'subtotal_sum' => $this->_convertPrice(0),
61
+ 'subtotal_avg' => $this->_convertPrice(0),
62
+ 'revenue_sum' => $this->_convertPrice(0),
63
+ 'revenue_avg' => $this->_convertPrice(0),
64
+ 'items_qty_sum' => 0,
65
+ 'items_qty_avg' => 0,
66
+ ),
67
+ ),
68
+ 'newcustomers_count' => 0,
69
+ 'from' => $dateStart->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
70
+ 'to' => $dateEnd->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
71
+ );
72
+
73
+
74
+ /** @var Neklo_Monitor_Model_Resource_Minfo_Daily_ReportsOrderCollection $totalData */
75
+ $totalData = Mage::getResourceModel('neklo_monitor/minfo_daily_reportsOrderCollection');
76
+ $totalData->calculateDailyReport('custom', $dateStart, $dateEnd, false);
77
+ foreach ($totalData as $_data) {
78
+ $report['orders']['all'] = $this->_fillInDataArray($_data);
79
+ }
80
+
81
+
82
+ /** @var Neklo_Monitor_Model_Resource_Minfo_Daily_ReportsOrderCollection $splitData */
83
+ $splitData = Mage::getResourceModel('neklo_monitor/minfo_daily_reportsOrderCollection');
84
+ $splitData->calculateDailyReport('custom', $dateStart, $dateEnd, true);
85
+ foreach ($splitData as $_data) {
86
+ $report['orders'][ $_data->getData('customer_type') ] = $this->_fillInDataArray($_data);
87
+ }
88
+
89
+
90
+ /** @var Mage_Customer_Model_Entity_Customer_Collection $collCustomers */
91
+ $collCustomers = Mage::getResourceModel('customer/customer_collection');
92
+ $collCustomers->addAttributeToFilter('created_at', array('from' => $dateStart, 'to' => $dateEnd, 'datetime' => true));
93
+ $report['newcustomers_count'] = $collCustomers->getSize();
94
+
95
+ return $report;
96
+ }
97
+
98
+ protected function _fillInDataArray($_data)
99
+ {
100
+ return array(
101
+ 'orders_count' => $_data->getData('orders_count') * 1,
102
+ 'subtotal_sum' => $this->_convertPrice($_data->getData('orders_sum_amount')),
103
+ 'subtotal_avg' => $this->_convertPrice($_data->getData('orders_avg_amount')),
104
+ 'revenue_sum' => $this->_convertPrice($_data->getData('revenue_sum')),
105
+ 'revenue_avg' => $this->_convertPrice($_data->getData('revenue_avg')),
106
+ 'items_qty_sum' => $_data->getData('items_qty_sum') * 1,
107
+ 'items_qty_avg' => $_data->getData('items_qty_avg') * 1,
108
+ );
109
+ }
110
+
111
+ protected function _convertPrice($value)
112
+ {
113
+ return Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->convertPrice($value, true, false);
114
+ }
115
+ }
app/code/community/Neklo/Monitor/Model/Resource/Minfo/Daily/ReportsOrderCollection.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Monitor_Model_Resource_Minfo_Daily_ReportsOrderCollection extends Mage_Reports_Model_Mysql4_Order_Collection
4
+ {
5
+ public function calculateDailyReport($range, $customStart, $customEnd, $groupByCustomers = false)
6
+ {
7
+ list($from, $to) = $this->getDateRange($range, $customStart, $customEnd, true);
8
+ $from = $from->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
9
+ $to = $to->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
10
+
11
+ $this->setMainTable('sales/order');
12
+
13
+ $this->getSelect()->reset(Zend_Db_Select::COLUMNS);
14
+ $this->removeAllFieldsFromSelect();
15
+
16
+ $this->_addRevenueExpression();
17
+
18
+ /*
19
+ $subtotalExpr = vsprintf(
20
+ '(main_table.base_subtotal - %s - %s) * main_table.base_to_global_rate',
21
+ array(
22
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_subtotal_refunded', 0)),
23
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_subtotal_canceled', 0)),
24
+ )
25
+ );
26
+ $this->getSelect()->columns(array(
27
+ 'orders_subtotal' => new Zend_Db_Expr(sprintf('SUM(%s)', $subtotalExpr)),
28
+ ));
29
+ */
30
+
31
+ /*
32
+ $shippingExpr = vsprintf(
33
+ '(main_table.base_shipping_amount - %s - %s) * main_table.base_to_global_rate',
34
+ array(
35
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_shipping_refunded', 0)),
36
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_shipping_canceled', 0)),
37
+ )
38
+ );
39
+ $this->getSelect()->columns(array(
40
+ 'orders_shipping_sum' => new Zend_Db_Expr(sprintf('SUM(%s)', $shippingExpr))
41
+ ));
42
+ */
43
+
44
+ /*
45
+ $taxExpr = vsprintf(
46
+ '(main_table.base_tax_amount - %s - %s) * main_table.base_to_global_rate',
47
+ array(
48
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_tax_refunded', 0)),
49
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_tax_canceled', 0)),
50
+ )
51
+ );
52
+ $this->getSelect()->columns(array(
53
+ 'orders_tax_sum' => new Zend_Db_Expr(sprintf('SUM(%s)', $taxExpr))
54
+ ));
55
+ */
56
+
57
+ if ($groupByCustomers) {
58
+ $this->_groupByCustomers($from, $to);
59
+ }
60
+
61
+ $this->addFieldToFilter('main_table.created_at', array(
62
+ 'from' => $from,
63
+ 'to' => $to
64
+ ));
65
+
66
+ $this->addSumAvgTotals();
67
+
68
+ $this->addOrdersCount();
69
+
70
+ $this->_addSumAvgItems();
71
+
72
+ return $this;
73
+
74
+ }
75
+
76
+ protected function _addRevenueExpression()
77
+ {
78
+ // _getSalesAmountExpression for 'revenue'
79
+ $revenueExpression = vsprintf(
80
+ '(%s - %s - %s - (%s - %s - %s)) * main_table.base_to_global_rate',
81
+ array(
82
+ // instead of $adapter->getIfNullSql() which does not exist in old versions
83
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_total_invoiced', 0)),
84
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_tax_invoiced', 0)),
85
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_shipping_invoiced', 0)),
86
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_total_refunded', 0)),
87
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_tax_refunded', 0)),
88
+ new Zend_Db_Expr(sprintf("IFNULL(%s, %s)", 'main_table.base_shipping_refunded', 0)),
89
+ )
90
+ );
91
+ $this->getSelect()
92
+ ->columns(array(
93
+ 'revenue_sum' => new Zend_Db_Expr(sprintf('SUM(%s)', $revenueExpression)),
94
+ 'revenue_avg' => new Zend_Db_Expr(sprintf('AVG(%s)', $revenueExpression)),
95
+ ))
96
+ ->where('main_table.state NOT IN (?)', array(
97
+ Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
98
+ Mage_Sales_Model_Order::STATE_NEW)
99
+ );
100
+
101
+ return $this;
102
+ }
103
+
104
+ protected function _groupByCustomers($from, $to)
105
+ {
106
+ $adapter = $this->getConnection();
107
+
108
+ $registeredSubExpression = new Zend_Db_Expr(
109
+ sprintf("IF(%s AND %s, 'newcustomers', 'oldcustomers')",
110
+ $adapter->quoteInto('customers.created_at >= ?', $from),
111
+ $adapter->quoteInto('customers.created_at <= ?', $to)
112
+ )
113
+ );
114
+ $registeredExpression = new Zend_Db_Expr("IF(main_table.customer_id IS NULL, 'guests', {$registeredSubExpression})");
115
+ $this->getSelect()
116
+ ->columns(array(
117
+ // 0 - guest customers, 1 - registered within period, 2 - old customers
118
+ 'customer_type' => $registeredExpression,
119
+ ))
120
+ ->joinLeft(array('customers' => $this->getTable('customer/entity')),
121
+ 'customers.entity_id = main_table.customer_id',
122
+ array()
123
+ )
124
+ ->group($registeredExpression)
125
+ ;
126
+ return $this;
127
+ }
128
+
129
+ protected function _addSumAvgItems()
130
+ {
131
+ $this->getSelect()
132
+ ->columns(array(
133
+ "items_qty_sum" => "SUM(main_table.total_qty_ordered)",
134
+ "items_qty_avg" => "AVG(main_table.total_qty_ordered)"
135
+ ));
136
+ return $this;
137
+ }
138
+ }
app/code/community/Neklo/Monitor/Model/System/Config/Source/Server/Type.php CHANGED
@@ -4,11 +4,11 @@ class Neklo_Monitor_Model_System_Config_Source_Server_Type
4
  {
5
  const PRODUCTION_CODE = 'production';
6
  const PRODUCTION_LABEL = 'Production';
7
- const PRODUCTION_URL = 'http://magento1.m1stats.neklodev.com/';
8
 
9
  const SANDBOX_CODE = 'sandbox';
10
  const SANDBOX_LABEL = 'Sandbox';
11
- const SANDBOX_URL = 'http://magento1.m1stats.neklodev.com/';
12
 
13
  public function toOptionArray()
14
  {
4
  {
5
  const PRODUCTION_CODE = 'production';
6
  const PRODUCTION_LABEL = 'Production';
7
+ const PRODUCTION_URL = 'https://magento1-m1stats.neklodev.com/';
8
 
9
  const SANDBOX_CODE = 'sandbox';
10
  const SANDBOX_LABEL = 'Sandbox';
11
+ const SANDBOX_URL = 'https://magento1-m1stats.neklodev.com/';
12
 
13
  public function toOptionArray()
14
  {
app/code/community/Neklo/Monitor/controllers/AuthController.php CHANGED
@@ -16,7 +16,9 @@ class Neklo_Monitor_AuthController extends Neklo_Monitor_Controller_Abstract
16
  {
17
  if (!$this->_getConfigHelper()->isConnected()) {
18
  $sid = $this->_getRequestHelper()->getParam('sid', null);
19
- $this->_getConfigHelper()->connect($sid);
 
 
20
  }
21
 
22
  // Return store icon and store name
16
  {
17
  if (!$this->_getConfigHelper()->isConnected()) {
18
  $sid = $this->_getRequestHelper()->getParam('sid', null);
19
+ if ($sid !== null) {
20
+ $this->_getConfigHelper()->connect($sid);
21
+ }
22
  }
23
 
24
  // Return store icon and store name
app/code/community/Neklo/Monitor/controllers/CustomerController.php CHANGED
@@ -46,7 +46,14 @@ class Neklo_Monitor_CustomerController extends Neklo_Monitor_Controller_Abstract
46
  ->toOptionHash()
47
  ;
48
 
49
- $customerIds = $collection->getAllIds();
 
 
 
 
 
 
 
50
  /* @var $orders Mage_Sales_Model_Mysql4_Order_Collection */
51
  $orders = Mage::getResourceModel('sales/order_collection');
52
  $orders->addFieldToFilter('customer_id', array('in' => $customerIds));
46
  ->toOptionHash()
47
  ;
48
 
49
+ $customerIds = $collection->getAllIds(self::PAGE_SIZE, $offset);
50
+ /*
51
+ $customerIds = array(); // // getAllIds without parameters resets limits and pages
52
+ foreach ($collection as $customer) {
53
+ $customerIds[] = $customer->getData('entity_id');
54
+ }
55
+ */
56
+
57
  /* @var $orders Mage_Sales_Model_Mysql4_Order_Collection */
58
  $orders = Mage::getResourceModel('sales/order_collection');
59
  $orders->addFieldToFilter('customer_id', array('in' => $customerIds));
app/code/community/Neklo/Monitor/controllers/DashboardController.php CHANGED
@@ -5,25 +5,43 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
5
  public function totalAction()
6
  {
7
  if (Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
8
- /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
9
- $collection = Mage::getResourceModel('reports/order_collection');
10
- $collection->calculateSales(false);
11
 
 
12
  $storeId = $this->_getRequestHelper()->getParam('store', null);
 
 
 
 
 
 
13
  if ($storeId) {
14
  $collection->addFieldToFilter('store_id', (int)$storeId);
15
  }
16
 
17
  $collection->setPageSize(1);
18
- $collection->setCurPage(1);
19
-
20
- $collection->load();
21
  $salesStats = $collection->getFirstItem();
22
 
23
  $result = array(
24
  'lifetime' => Mage::app()->getStore($storeId)->convertPrice($salesStats->getLifetime(), true, false),
25
  'average' => Mage::app()->getStore($storeId)->convertPrice($salesStats->getAverage(), true, false),
26
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  } else {
28
  $result = array();
29
  }
@@ -57,33 +75,55 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
57
  'small_image', // exists in collection when Flat Product is enabled
58
  )
59
  );
60
- $skuList = array();
61
- $thumbList = array();
62
- $hlp = Mage::helper('catalog/image');
63
- /** @var Mage_Catalog_Helper_Image $hlp */
64
  foreach ($productCollection as $row) {
65
  /** @var Mage_Catalog_Model_Product $row */
66
- $skuList[$row->getId()] = $row->getSku();
67
-
68
- $hlp->init($row, 'small_image');
69
- $thumbList[$row->getId()] = array(
70
- 'image2xUrl' => $hlp->resize(224, 300)->__toString(),
71
- 'image3xUrl' => $hlp->resize(336, 450)->__toString(),
72
- );
73
  }
74
 
75
- $result = array();
 
76
  foreach ($collection as $row) {
77
- if (isset($skuList[$row->getData('product_id')])) {
78
- $result[] = array(
 
 
79
  'id' => $row->getData('product_id'),
80
  'name' => $row->getData('product_name'),
81
  'price' => Mage::app()->getStore($storeId)->convertPrice($row->getData('product_price'), true, false),
82
- 'sku' => $skuList[$row->getData('product_id')],
83
  'qty' => (int)$row->getData('qty_ordered'),
84
- 'image2xUrl' => $thumbList[$row->getData('product_id')]['image2xUrl'],
85
- 'image3xUrl' => $thumbList[$row->getData('product_id')]['image3xUrl'],
86
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  }
89
 
@@ -115,21 +155,18 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
115
  $collection->setCurPage(1);
116
  $collection->load();
117
 
118
- $hlp = Mage::helper('catalog/image');
119
- /** @var Mage_Catalog_Helper_Image $hlp */
120
- $result = array();
121
  foreach ($collection as $row) {
122
  /** @var Mage_Catalog_Model_Product $row */
123
- $hlp->init($row, 'small_image');
124
- $result[] = array(
125
  'id' => $row->getEntityId(),
126
  'name' => $row->getName(),
127
  'price' => Mage::app()->getStore($storeId)->convertPrice($row->getPrice(), true, false),
128
  'sku' => $row->getSku(),
129
  'views' => (int)$row->getData('views'),
130
- 'image2xUrl' => $hlp->resize(224, 300)->__toString(),
131
- 'image3xUrl' => $hlp->resize(336, 450)->__toString(),
132
  );
 
 
133
  }
134
 
135
  $this->_jsonResult($result);
@@ -157,7 +194,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
157
  ->toOptionHash()
158
  ;
159
 
160
- $result = array();
161
  foreach ($collection as $row) {
162
 
163
  if ((array_key_exists($row->getData('group_id'), $groupList))) {
@@ -177,7 +214,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
177
  'order_count' => (int)$row->getData('orders_count'),
178
  );
179
 
180
- $result[] = $customerData;
181
  }
182
 
183
  $this->_jsonResult($result);
@@ -195,7 +232,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
195
  $storeFilter = 0;
196
  $storeId = $this->_getRequestHelper()->getParam('store', null);
197
  if ($storeId) {
198
- $collection->addAttributeToFilter('store_id', $storeId);
199
  $storeFilter = 1;
200
  }
201
  $collection
@@ -218,7 +255,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
218
  $collection->setPageSize(5);
219
  $collection->setCurPage(1);
220
 
221
- $result = array();
222
  foreach ($collection as $row) {
223
  if ((array_key_exists($row->getData('customer_group_id'), $groupList))) {
224
  $customerGroup = $groupList[$row->getData('customer_group_id')];
@@ -237,7 +274,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
237
  'order_count' => (int)$row->getData('orders_count'),
238
  );
239
 
240
- $result[] = $customerData;
241
  }
242
 
243
  $this->_jsonResult($result);
@@ -271,7 +308,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
271
  ->toOptionHash()
272
  ;
273
 
274
- $result = array();
275
  foreach ($collection as $row) {
276
  if ((array_key_exists($row->getData('status'), $orderStatusList))) {
277
  $orderStatus = $orderStatusList[$row->getData('status')];
@@ -300,7 +337,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
300
  ),
301
  );
302
 
303
- $result[] = $orderData;
304
  }
305
 
306
  $this->_jsonResult($result);
@@ -314,13 +351,13 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
314
 
315
  $storeId = $this->_getRequestHelper()->getParam('store', null);
316
  if ($storeId) {
317
- $collection->addAttributeToFilter('store_id', $storeId);
318
  }
319
 
320
  $collection->setPageSize(5);
321
  $collection->setCurPage(1);
322
 
323
- $result = array();
324
  foreach ($collection as $row) {
325
  $searchData = array(
326
  'id' => $row->getData('query_id'),
@@ -329,7 +366,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
329
  'number_of_results' => $row->getData('num_results'),
330
  'last_usage' => Mage::helper('neklo_monitor/date')->convertToTimestamp($row->getData('updated_at')),
331
  );
332
- $result[] = $searchData;
333
  }
334
 
335
  $this->_jsonResult($result);
@@ -342,11 +379,12 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
342
 
343
  $storeId = $this->_getRequestHelper()->getParam('store', '');
344
  $collection->setPopularQueryFilter($storeId);
 
345
 
346
  $collection->setPageSize(5);
347
  $collection->setCurPage(1);
348
 
349
- $result = array();
350
  foreach ($collection as $row) {
351
  $searchData = array(
352
  'query' => $row->getData('name'),
@@ -354,7 +392,7 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
354
  'number_of_results' => $row->getData('num_results'),
355
  'last_usage' => Mage::helper('neklo_monitor/date')->convertToTimestamp($row->getData('updated_at')),
356
  );
357
- $result[] = $searchData;
358
  }
359
 
360
  $this->_jsonResult($result);
@@ -362,11 +400,14 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
362
 
363
  public function chartAction()
364
  {
 
365
  $chartHelper = Mage::helper('adminhtml/dashboard_order');
366
 
 
367
  $storeId = $this->_getRequestHelper()->getParam('store', null);
368
  if ($storeId) {
369
  $chartHelper->setParam('store', $storeId);
 
370
  }
371
 
372
  $chartType = $this->_getRequestHelper()->getParam('type', 'quantity');
@@ -394,16 +435,26 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
394
  break;
395
  }
396
 
397
- $chartData = array();
398
- $items = $chartHelper->getCollection()->getItems();
399
- foreach ($items as $item) {
400
- $zDate = new Zend_Date($item->getData('range'), $periodMask);
401
- $chartData[$zDate->getTimestamp()] = (float)$item->getData($chartType);
 
402
  }
403
 
404
- list ($dateStart, $dateEnd) = Mage::getResourceModel('reports/order_collection')->getDateRange($period, '', '', true);
 
 
 
 
405
  while ($dateStart->compare($dateEnd) < 0) {
406
- $timestamp = $dateStart->getTimestamp();
 
 
 
 
 
407
  switch ($period) {
408
  case '24h':
409
  $dateStart->addHour(1);
@@ -417,19 +468,55 @@ class Neklo_Monitor_DashboardController extends Neklo_Monitor_Controller_Abstrac
417
  $dateStart->addMonth(1);
418
  break;
419
  }
420
- if (!array_key_exists($timestamp, $chartData)) {
421
- $chartData[$timestamp] = 0;
422
- }
 
 
 
 
423
  }
424
  ksort($chartData);
425
 
426
- $result = array();
 
 
 
 
 
 
427
  foreach ($chartData as $date => $value) {
428
- $result[] = array(
 
 
 
 
 
 
 
 
429
  'date' => $date,
430
  'value' => $value,
431
  );
432
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
 
434
  $this->_jsonResult($result);
435
  }
5
  public function totalAction()
6
  {
7
  if (Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
 
 
 
8
 
9
+ $isFilter = false;
10
  $storeId = $this->_getRequestHelper()->getParam('store', null);
11
+ if ($storeId) {
12
+ $isFilter = true;
13
+ }
14
+ /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
15
+ $collection = Mage::getResourceModel('reports/order_collection');
16
+ $collection->calculateSales($isFilter);
17
  if ($storeId) {
18
  $collection->addFieldToFilter('store_id', (int)$storeId);
19
  }
20
 
21
  $collection->setPageSize(1);
 
 
 
22
  $salesStats = $collection->getFirstItem();
23
 
24
  $result = array(
25
  'lifetime' => Mage::app()->getStore($storeId)->convertPrice($salesStats->getLifetime(), true, false),
26
  'average' => Mage::app()->getStore($storeId)->convertPrice($salesStats->getAverage(), true, false),
27
  );
28
+
29
+ foreach (array('24h', '1m') as $period) {
30
+ /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
31
+ $collection = Mage::getResourceModel('reports/order_collection');
32
+ $collection
33
+ ->addCreateAtPeriodFilter($period)
34
+ ->calculateTotals($isFilter);
35
+ if ($storeId) {
36
+ $collection->addFieldToFilter('store_id', (int)$storeId);
37
+ }
38
+
39
+ $collection->setPageSize(1);
40
+ $salesStats = $collection->getFirstItem();
41
+
42
+ $result['period'.$period] = Mage::app()->getStore($storeId)->convertPrice($salesStats->getRevenue(), true, false);
43
+ }
44
+
45
  } else {
46
  $result = array();
47
  }
75
  'small_image', // exists in collection when Flat Product is enabled
76
  )
77
  );
78
+ $productsData = array();
 
 
 
79
  foreach ($productCollection as $row) {
80
  /** @var Mage_Catalog_Model_Product $row */
81
+ $productsData[$row->getId()] = $row->getData();
82
+ $productsData[$row->getId()] += Mage::helper('neklo_monitor')->resizeProductImage($row, 'small_image');
 
 
 
 
 
83
  }
84
 
85
+ $result = array('result' => array());
86
+ // the aggregated_yearly data fetched by $collection
87
  foreach ($collection as $row) {
88
+ $_prodId = $row->getData('product_id');
89
+ if (isset($productsData[$_prodId])) {
90
+ $prodData = $productsData[$_prodId];
91
+ $reportItem = array(
92
  'id' => $row->getData('product_id'),
93
  'name' => $row->getData('product_name'),
94
  'price' => Mage::app()->getStore($storeId)->convertPrice($row->getData('product_price'), true, false),
95
+ 'sku' => $prodData['sku'],
96
  'qty' => (int)$row->getData('qty_ordered'),
97
+ 'image2xUrl' => $prodData['image2xUrl'],
98
+ 'image3xUrl' => $prodData['image3xUrl'],
99
  );
100
+ // actually no images in simple products, and placeholders are generated into 'image2xUrl' 'image3xUrl'
101
+ if ('simple' == $prodData['type_id']
102
+ && (empty($prodData['small_image']) || 'no_selection' == $prodData['small_image'])) {
103
+ // search for any order item with this product during the period (a year based on report data)
104
+ // to find a configurable parent, then load its product to get its image
105
+ $orderItems = Mage::getResourceModel('sales/order_item_collection');
106
+ $_from = $row['period'] . ' 00:00:00';
107
+ $_toTs = strtotime($row['period']) + 365*24*60*60; // + 1 year, as the report is fetched from aggregated_yearly table
108
+ $_to = date('Y-m-d', $_toTs) . ' 00:00:00';
109
+ $orderItems
110
+ ->addFieldToFilter('created_at', array('from' => $_from, 'to' => $_to))
111
+ ->addFieldToFilter('product_id', $_prodId)
112
+ ->addFieldToFilter('product_type', 'simple')
113
+ ->addFieldToFilter('parent_item_id', array('gt' => 0))
114
+ ->setOrder('created_at', 'desc')
115
+ ->setPageSize(1);
116
+ $orderItem = $orderItems->getFirstItem();
117
+
118
+ $parentOrderItem = Mage::getModel('sales/order_item')->load($orderItem->getParentItemId());
119
+ $parentProd = Mage::getModel('catalog/product')->load($parentOrderItem->getProductId());
120
+ if ($orderItem && $orderItem->getId() && $parentOrderItem->getId() && $parentProd->getId()) {
121
+ $parentImages = Mage::helper('neklo_monitor')->resizeProductImage($parentProd, 'small_image');
122
+ $reportItem['image2xUrl'] = $parentImages['image2xUrl'];
123
+ $reportItem['image3xUrl'] = $parentImages['image3xUrl'];
124
+ }
125
+ }
126
+ $result['result'][] = $reportItem;
127
  }
128
  }
129
 
155
  $collection->setCurPage(1);
156
  $collection->load();
157
 
158
+ $result = array('result' => array());
 
 
159
  foreach ($collection as $row) {
160
  /** @var Mage_Catalog_Model_Product $row */
161
+ $listItem = array(
 
162
  'id' => $row->getEntityId(),
163
  'name' => $row->getName(),
164
  'price' => Mage::app()->getStore($storeId)->convertPrice($row->getPrice(), true, false),
165
  'sku' => $row->getSku(),
166
  'views' => (int)$row->getData('views'),
 
 
167
  );
168
+ $listItem += Mage::helper('neklo_monitor')->resizeProductImage($row, 'small_image');
169
+ $result['result'][] = $listItem;
170
  }
171
 
172
  $this->_jsonResult($result);
194
  ->toOptionHash()
195
  ;
196
 
197
+ $result = array('result' => array());
198
  foreach ($collection as $row) {
199
 
200
  if ((array_key_exists($row->getData('group_id'), $groupList))) {
214
  'order_count' => (int)$row->getData('orders_count'),
215
  );
216
 
217
+ $result['result'][] = $customerData;
218
  }
219
 
220
  $this->_jsonResult($result);
232
  $storeFilter = 0;
233
  $storeId = $this->_getRequestHelper()->getParam('store', null);
234
  if ($storeId) {
235
+ $collection->addAttributeToFilter('main_table.store_id', $storeId);
236
  $storeFilter = 1;
237
  }
238
  $collection
255
  $collection->setPageSize(5);
256
  $collection->setCurPage(1);
257
 
258
+ $result = array('result' => array());
259
  foreach ($collection as $row) {
260
  if ((array_key_exists($row->getData('customer_group_id'), $groupList))) {
261
  $customerGroup = $groupList[$row->getData('customer_group_id')];
274
  'order_count' => (int)$row->getData('orders_count'),
275
  );
276
 
277
+ $result['result'][] = $customerData;
278
  }
279
 
280
  $this->_jsonResult($result);
308
  ->toOptionHash()
309
  ;
310
 
311
+ $result = array('result' => array());
312
  foreach ($collection as $row) {
313
  if ((array_key_exists($row->getData('status'), $orderStatusList))) {
314
  $orderStatus = $orderStatusList[$row->getData('status')];
337
  ),
338
  );
339
 
340
+ $result['result'][] = $orderData;
341
  }
342
 
343
  $this->_jsonResult($result);
351
 
352
  $storeId = $this->_getRequestHelper()->getParam('store', null);
353
  if ($storeId) {
354
+ $collection->addFieldToFilter('store_id', $storeId);
355
  }
356
 
357
  $collection->setPageSize(5);
358
  $collection->setCurPage(1);
359
 
360
+ $result = array('result' => array());
361
  foreach ($collection as $row) {
362
  $searchData = array(
363
  'id' => $row->getData('query_id'),
366
  'number_of_results' => $row->getData('num_results'),
367
  'last_usage' => Mage::helper('neklo_monitor/date')->convertToTimestamp($row->getData('updated_at')),
368
  );
369
+ $result['result'][] = $searchData;
370
  }
371
 
372
  $this->_jsonResult($result);
379
 
380
  $storeId = $this->_getRequestHelper()->getParam('store', '');
381
  $collection->setPopularQueryFilter($storeId);
382
+ $collection->getSelect()->columns('main_table.updated_at');
383
 
384
  $collection->setPageSize(5);
385
  $collection->setCurPage(1);
386
 
387
+ $result = array('result' => array());
388
  foreach ($collection as $row) {
389
  $searchData = array(
390
  'query' => $row->getData('name'),
392
  'number_of_results' => $row->getData('num_results'),
393
  'last_usage' => Mage::helper('neklo_monitor/date')->convertToTimestamp($row->getData('updated_at')),
394
  );
395
+ $result['result'][] = $searchData;
396
  }
397
 
398
  $this->_jsonResult($result);
400
 
401
  public function chartAction()
402
  {
403
+ /** @var Mage_Adminhtml_Helper_Dashboard_Order $chartHelper */
404
  $chartHelper = Mage::helper('adminhtml/dashboard_order');
405
 
406
+ $isFilter = false;
407
  $storeId = $this->_getRequestHelper()->getParam('store', null);
408
  if ($storeId) {
409
  $chartHelper->setParam('store', $storeId);
410
+ $isFilter = true;
411
  }
412
 
413
  $chartType = $this->_getRequestHelper()->getParam('type', 'quantity');
435
  break;
436
  }
437
 
438
+ /* @var $chartCollection Mage_Reports_Model_Mysql4_Order_Collection */
439
+ $chartCollection = $chartHelper->getCollection();
440
+
441
+ $originalChart = array();
442
+ foreach ($chartCollection->getItems() as $item) {
443
+ $originalChart[ $item->getData('range') ] = (float)$item->getData($chartType);
444
  }
445
 
446
+ /** @var Zend_Date $dateStart */
447
+ /** @var Zend_Date $dateEnd */
448
+
449
+ // fill empty x-axis points with 0 values
450
+ list ($dateStart, $dateEnd) = $chartCollection->getDateRange($period, '', '', true);
451
  while ($dateStart->compare($dateEnd) < 0) {
452
+ $_range = $dateStart->toString($periodMask);
453
+ if (!array_key_exists($_range, $originalChart)) {
454
+ $originalChart[$_range] = 0;
455
+ }
456
+
457
+ // move to next x-axis point
458
  switch ($period) {
459
  case '24h':
460
  $dateStart->addHour(1);
468
  $dateStart->addMonth(1);
469
  break;
470
  }
471
+ }
472
+
473
+ $chartData = array();
474
+ foreach ($originalChart as $_range => $_value) {
475
+ $zDate = new Zend_Date($_range, $periodMask);
476
+ $_ts = $zDate->getTimestamp();
477
+ $chartData[$_ts] = $_value;
478
  }
479
  ksort($chartData);
480
 
481
+ $result = array(
482
+ 'chart' => array(),
483
+ 'total' => array(
484
+ 'revenue' => '0',
485
+ 'qty' => 0,
486
+ ),
487
+ );
488
  foreach ($chartData as $date => $value) {
489
+ $result['chart'][] = array(
490
+ 'date' => $date,
491
+ // 'date_hf' => date('Y-m-d H:i:s', $date),
492
+ 'value' => $value,
493
+ );
494
+ }
495
+ /*
496
+ foreach ($originalChart as $date => $value) {
497
+ $result['o-chart'][] = array(
498
  'date' => $date,
499
  'value' => $value,
500
  );
501
  }
502
+ */
503
+
504
+ /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
505
+ $collection = Mage::getResourceModel('reports/order_collection');
506
+ $collection->addCreateAtPeriodFilter($period);
507
+ $collection->calculateTotals($isFilter);
508
+ if ($storeId) {
509
+ $collection->addFieldToFilter('store_id', (int)$storeId);
510
+ } else if (!$collection->isLive()) {
511
+ $collection->addFieldToFilter('store_id',
512
+ array('eq' => Mage::app()->getStore(Mage_Core_Model_Store::ADMIN_CODE)->getId())
513
+ );
514
+ }
515
+ $collection->setPageSize(1);
516
+ $collection->load();
517
+ $salesStats = $collection->getFirstItem();
518
+ $result['total']['revenue'] = Mage::app()->getStore($storeId)->convertPrice($salesStats->getRevenue(), true, false);
519
+ $result['total']['qty'] = $salesStats->getQuantity() * 1;
520
 
521
  $this->_jsonResult($result);
522
  }
app/code/community/Neklo/Monitor/controllers/InfoController.php CHANGED
@@ -70,4 +70,27 @@ class Neklo_Monitor_InfoController extends Neklo_Monitor_Controller_Abstract
70
 
71
  $this->_jsonResult($result);
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
70
 
71
  $this->_jsonResult($result);
72
  }
73
+
74
+ public function attrsetlistAction()
75
+ {
76
+ $result = array('result' => array());
77
+
78
+ /** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product $resrc */
79
+ $resrc = Mage::getResourceModel('catalog/product');
80
+ /** @var Mage_Eav_Model_Mysql4_Entity_Attribute_Set_Collection $attributeSetCollection */
81
+ $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection');
82
+ $attributeSetCollection
83
+ ->setEntityTypeFilter($resrc->getTypeId())
84
+ ->load();
85
+ foreach ($attributeSetCollection as $_set) {
86
+ /** @var Mage_Eav_Model_Entity_Attribute_Set $_set */
87
+ $result['result'][] = array(
88
+ 'id' => $_set->getId(),
89
+ 'label' => $_set->getAttributeSetName(),
90
+ );
91
+ }
92
+
93
+ $this->_jsonResult($result);
94
+ }
95
+
96
  }
app/code/community/Neklo/Monitor/controllers/ProductController.php CHANGED
@@ -10,20 +10,23 @@ class Neklo_Monitor_ProductController extends Neklo_Monitor_Controller_Abstract
10
  $parser = Mage::getModel('neklo_monitor/minfo_parser');
11
  $collection = $parser->getProductsOutofstockCollection($storeId);
12
 
13
- $outOfStockProductList = array();
14
- $hlp = Mage::helper('catalog/image');
15
- /** @var Mage_Catalog_Helper_Image $hlp */
 
 
 
 
16
  foreach ($collection as $row) {
17
  /** @var Mage_Catalog_Model_Product $row */
18
- $hlp->init($row, 'small_image');
19
- $outOfStockProductList[] = array(
20
  'id' => $row->getEntityId(),
21
  'name' => $row->getName(),
22
  'price' => Mage::app()->getStore($storeId)->convertPrice($row->getPrice(), true, false),
23
  'sku' => $row->getSku(),
24
- 'image2xUrl' => $hlp->resize(224, 300)->__toString(),
25
- 'image3xUrl' => $hlp->resize(336, 450)->__toString(),
26
  );
 
 
27
  }
28
 
29
  $this->_jsonResult($outOfStockProductList);
10
  $parser = Mage::getModel('neklo_monitor/minfo_parser');
11
  $collection = $parser->getProductsOutofstockCollection($storeId);
12
 
13
+ $offset = $this->_getRequestHelper()->getParam('offset', 0);
14
+ $page = ceil($offset / self::PAGE_SIZE) + 1;
15
+ $collection->setPage($page, self::PAGE_SIZE);
16
+
17
+ $collection->setOrder('main_table.created_at', 'desc');
18
+
19
+ $outOfStockProductList = array('result' => array());
20
  foreach ($collection as $row) {
21
  /** @var Mage_Catalog_Model_Product $row */
22
+ $listItem = array(
 
23
  'id' => $row->getEntityId(),
24
  'name' => $row->getName(),
25
  'price' => Mage::app()->getStore($storeId)->convertPrice($row->getPrice(), true, false),
26
  'sku' => $row->getSku(),
 
 
27
  );
28
+ $listItem += Mage::helper('neklo_monitor')->resizeProductImage($row, 'small_image');
29
+ $outOfStockProductList['result'][] = $listItem;
30
  }
31
 
32
  $this->_jsonResult($outOfStockProductList);
app/code/community/Neklo/Monitor/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Neklo_Monitor>
5
- <version>1.1.3</version>
6
  </Neklo_Monitor>
7
  </modules>
8
  <global>
@@ -18,6 +18,11 @@
18
  <neklo_monitor>
19
  <class>Neklo_Monitor_Helper</class>
20
  </neklo_monitor>
 
 
 
 
 
21
  </helpers>
22
  <models>
23
  <neklo_monitor>
@@ -29,6 +34,8 @@
29
  <entities>
30
  <report><table>neklo_monitor_report</table></report>
31
  <log><table>neklo_monitor_log</table></log>
 
 
32
  </entities>
33
  </neklo_monitor_resource>
34
  </models>
@@ -39,6 +46,16 @@
39
  </setup>
40
  </neklo_monitor_setup>
41
  </resources>
 
 
 
 
 
 
 
 
 
 
42
  </global>
43
  <frontend>
44
  <routers>
@@ -77,6 +94,30 @@
77
  <model>neklo_monitor/cron_store::collect</model>
78
  </run>
79
  </neklo_monitor_collect_store>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  </jobs>
81
  </crontab>
82
  <default>
2
  <config>
3
  <modules>
4
  <Neklo_Monitor>
5
+ <version>1.2.1</version>
6
  </Neklo_Monitor>
7
  </modules>
8
  <global>
18
  <neklo_monitor>
19
  <class>Neklo_Monitor_Helper</class>
20
  </neklo_monitor>
21
+ <catalog>
22
+ <rewrite>
23
+ <product_flat>Neklo_Monitor_Helper_Flat</product_flat>
24
+ </rewrite>
25
+ </catalog>
26
  </helpers>
27
  <models>
28
  <neklo_monitor>
34
  <entities>
35
  <report><table>neklo_monitor_report</table></report>
36
  <log><table>neklo_monitor_log</table></log>
37
+ <queue><table>neklo_monitor_queue</table></queue>
38
+ <cicl><table>neklo_monitor_cataloginventory_cl</table></cicl>
39
  </entities>
40
  </neklo_monitor_resource>
41
  </models>
46
  </setup>
47
  </neklo_monitor_setup>
48
  </resources>
49
+ <events>
50
+ <sales_order_place_after>
51
+ <observers>
52
+ <neklo_monitor_orders>
53
+ <class>neklo_monitor/observer</class>
54
+ <method>checkOrder</method>
55
+ </neklo_monitor_orders>
56
+ </observers>
57
+ </sales_order_place_after>
58
+ </events>
59
  </global>
60
  <frontend>
61
  <routers>
94
  <model>neklo_monitor/cron_store::collect</model>
95
  </run>
96
  </neklo_monitor_collect_store>
97
+ <neklo_monitor_changelog_process>
98
+ <schedule>
99
+ <cron_expr>* * * * *</cron_expr>
100
+ </schedule>
101
+ <run>
102
+ <model>neklo_monitor/observer::convertChangelogToQueue</model>
103
+ </run>
104
+ </neklo_monitor_changelog_process>
105
+ <neklo_monitor_queue>
106
+ <schedule>
107
+ <cron_expr>* * * * *</cron_expr>
108
+ </schedule>
109
+ <run>
110
+ <model>neklo_monitor/observer::sendQueuedRequest</model>
111
+ </run>
112
+ </neklo_monitor_queue>
113
+ <neklo_monitor_aggregate_sales_report_order_data>
114
+ <schedule>
115
+ <cron_expr>5 0 * * *</cron_expr>
116
+ </schedule>
117
+ <run>
118
+ <model>neklo_monitor/observer::aggregateSalesReportOrderData</model>
119
+ </run>
120
+ </neklo_monitor_aggregate_sales_report_order_data>
121
  </jobs>
122
  </crontab>
123
  <default>
app/code/community/Neklo/Monitor/sql/neklo_monitor_setup/mysql4-upgrade-1.1.2-1.1.3.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // dummy upgrade
app/code/community/Neklo/Monitor/sql/neklo_monitor_setup/mysql4-upgrade-1.1.3-1.2.0.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+ $tbl = $installer->getTable('neklo_monitor/queue');
8
+ $installer->run("
9
+
10
+ CREATE TABLE `$tbl` (
11
+ `queue_id` INT(11) NOT NULL AUTO_INCREMENT,
12
+ `type` VARCHAR(32) NOT NULL,
13
+ `scheduled_at` INT(11) UNSIGNED NOT NULL,
14
+ `started_at` INT(11) UNSIGNED NOT NULL,
15
+ `sent_at` INT(11) UNSIGNED NOT NULL,
16
+ `message` TEXT NOT NULL,
17
+ PRIMARY KEY (`queue_id`),
18
+ KEY `started_at` (`started_at`),
19
+ KEY `type` (`type`)
20
+ ) ENGINE=InnoDB;
21
+
22
+ ");
23
+
24
+ $installer->endSetup();
app/code/community/Neklo/Monitor/sql/neklo_monitor_setup/mysql4-upgrade-1.2.0-1.2.1.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+ $cltbl = $installer->getTable('neklo_monitor/cicl');
8
+ $citbl = $installer->getTable('cataloginventory_stock_status');
9
+
10
+ $installer->run("
11
+
12
+ CREATE TABLE `$cltbl` (
13
+ `cl_id` INT(11) NOT NULL AUTO_INCREMENT,
14
+ `product_id` INT(11) UNSIGNED NOT NULL,
15
+ `created_at` INT(11) UNSIGNED NOT NULL,
16
+ PRIMARY KEY (`cl_id`),
17
+ KEY `product_id` (`product_id`)
18
+ ) ENGINE=InnoDB Comment='Catalog Inventory Status Change Log';
19
+
20
+ CREATE TRIGGER `neklo_monitor_inventory_insert`
21
+ AFTER INSERT ON `$citbl`
22
+ FOR EACH ROW
23
+ INSERT INTO `$cltbl` (`product_id`, `created_at`)
24
+ VALUES (NEW.product_id, UNIX_TIMESTAMP());
25
+
26
+ CREATE TRIGGER `neklo_monitor_inventory_update`
27
+ AFTER UPDATE ON `$citbl`
28
+ FOR EACH ROW
29
+ INSERT INTO `$cltbl` (`product_id`, `created_at`)
30
+ VALUES (NEW.product_id, UNIX_TIMESTAMP());
31
+
32
+ CREATE TRIGGER `neklo_monitor_inventory_delete`
33
+ AFTER DELETE ON `$citbl`
34
+ FOR EACH ROW
35
+ INSERT INTO `$cltbl` (`product_id`, `created_at`)
36
+ VALUES (OLD.product_id, UNIX_TIMESTAMP());
37
+
38
+ ");
39
+
40
+ $installer->endSetup();
package.xml CHANGED
@@ -1,2 +1,6 @@
1
  <?xml version="1.0"?>
2
- <package><name>Neklo_Monitor</name><version>1.1.3</version><stability>stable</stability><license>License</license><channel>community</channel><extends></extends><summary>Minor updates</summary><description>Connector for Magento Monitor Application</description><notes>- Added information about connecting module to mobile application</notes><authors><author><name>NEKLO</name><user>NEKLO</user><email>info@neklo.com</email></author></authors><date>2016-05-18</date><time>0:48:19</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Neklo_Core.xml" hash="335032ff690c5272626dca9106642680"/><file name="Neklo_Monitor.xml" hash="e93ded9f7368552a843959e953a2bf10"/></dir></dir><dir name="code"><dir name="community"><dir name="Neklo"><dir name="Monitor"><file name="Autoload.php" hash="612c4e0d0a4db5be84c29650655085f6"/><dir name="etc"><file name="adminhtml.xml" hash="897debfe836ca9d58971b44b2232187e"/><file name="config.xml" hash="06e6640dd2ed7821544a99597e751292"/><file name="system.xml" hash="c99ed6a7ac945fab0fb803d7ac5b820b"/></dir><dir name="controllers"><file name="AuthController.php" hash="c164010a1b5237587ad4edef5bd14b1d"/><file name="CustomerController.php" hash="682be2c35cb7d5d2e30b75153a93381b"/><file name="DashboardController.php" hash="8ff4c2a8b24b6256680a0c38ed232126"/><file name="InfoController.php" hash="6bfe3889fa3454d39e9fa39003cc8d20"/><file name="OrderController.php" hash="9383692d3ce5b22d22afee32ddfae10b"/><file name="ProductController.php" hash="948d4214a9ba5e68887f73b66062b6cf"/><dir name="State"><file name="CacheController.php" hash="efb77eeae42be795d7618c620270d0d7"/><file name="IndexerController.php" hash="fa23622aabd0f1d40d4d03de692ae0a2"/></dir><dir name="Var"><file name="LogController.php" hash="b0c9fb0510dd81d3de890d1050d8ac18"/><file name="ReportController.php" hash="5e871965109e78c57252fd221c8e3a9b"/></dir><dir name="Report"><file name="SalesController.php" hash="700675ceeb05054ff3be6155d37cd37c"/></dir></dir><dir name="Controller"><file name="Abstract.php" hash="c451f6e756bac9cbc5460c3b65812bb6"/></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Frontend"><file name="Label.php" hash="bd831c28818a1b998dda55df056b28b4"/><file name="Status.php" hash="6c00cedcb46f4886476f2fda6757e692"/></dir></dir></dir></dir></dir><dir name="sql"><dir name="neklo_monitor_setup"><file name="mysql4-install-1.0.0.php" hash="3a5ee59cda3ec27eca737f515eec4a71"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="bba6559d5040c937d775a76df6611b77"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="f3bbc768ae43e1b45009de02c519dcd7"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="0a03caae9eb41f5f8bcf1a2a8476a13a"/></dir></dir><dir name="Model"><file name="Linfo.php" hash="585d42953c5585d9851dad82c0881410"/><file name="Log.php" hash="7ae437f9f39e62317faa9a2c4b57a3d2"/><file name="Minfo.php" hash="eaab8efeb41a9d2dd073093b869fe440"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Server"><file name="Type.php" hash="4c86daaa4320ac41b7bdba25f1285056"/></dir></dir><dir name="Backend"><file name="Empty.php" hash="556343bcf15ea8b294a15e77f6662cf8"/><file name="Token.php" hash="7669597367cd26bd848d0d8251feb4b7"/></dir></dir></dir><dir name="Cron"><file name="Abstract.php" hash="7183a30f5a456ee29a3e58f814999e87"/><file name="Server.php" hash="5f3e4ac9492b6e7d658fabeaa0e35e44"/><file name="Store.php" hash="97a0691ceda29f4b52481666b5ab9406"/></dir><dir name="Resource"><dir name="Minfo"><file name="Log.php" hash="54f05d3ced0a1aee770177265695eac9"/><file name="Report.php" hash="acb9c02688a9403a67904fda72c57533"/><dir name="Log"><file name="Collection.php" hash="fc6cbcd4c15227046cb7e85dfdad614d"/></dir><dir name="Report"><file name="Collection.php" hash="a9c74ab52be17dec7c4fafb883bda732"/></dir></dir></dir><dir name="Minfo"><file name="Log.php" hash="d787eeaab4cae6f3d9fe7e696c427014"/><file name="Parser.php" hash="2d7f4603d25d63b0416d338924add4e9"/><file name="Report.php" hash="d97960716a8c152d1614b8d0c752e064"/></dir><dir name="Linfo"><dir name="Os"><file name="Linux.php" hash="e61e9aceb9723b5c8e72200274b7f6ab"/></dir></dir><dir name="Gateway"><file name="Connector.php" hash="3f9667344ccd34dbe4461e71891335fa"/></dir></dir><dir name="Helper"><file name="Config.php" hash="1982c834fe1fb08757c880f2fc10c56a"/><file name="Country.php" hash="15176ed5b48639f8c50242b126e9dea4"/><file name="Data.php" hash="ebba3993c28262dc258166187cc41aba"/><file name="Date.php" hash="0aa9fb8caa33c51ba224bd1336724704"/><file name="Request.php" hash="dab02c51e8da47f8cb2b57999576ed5c"/><dir name="Request"><file name="Validator.php" hash="16375fad2da02f6732fefd465a388774"/></dir></dir></dir><dir name="Core"><dir name="etc"><file name="adminhtml.xml" hash="68b00ad4118462d74b0c0a7126063462"/><file name="config.xml" hash="3fc06c04d63578d873a4d4145785e4c0"/><file name="system.xml" hash="f9ee62f79b22584cc6180ec5e8049539"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Neklo"><dir name="Core"><file name="ContactController.php" hash="fe735a9c3c0ad9c4ecb88edd009059a9"/><file name="NewsletterController.php" hash="b9342c80bf94c29a463251b1c7b02705"/></dir></dir></dir></dir><dir name="Block"><dir name="System"><file name="Contact.php" hash="a0e89ca48de64bb8526c35598f99802b"/><file name="Extension.php" hash="8cd6609bd4f00bf8a8f5913d20e98e65"/><dir name="Contact"><file name="Header.php" hash="a6c4f8dbf002a0d2f6be0ea37445a562"/><file name="Send.php" hash="333d3059033faa826ef3781946676b16"/><dir name="Send"><file name="Button.php" hash="c94e2ae59246a968d7eb2e89e63485c8"/></dir></dir><dir name="Newsletter"><file name="Subscribe.php" hash="1015b8e49758e40c829667e94bb06220"/><dir name="Subscribe"><file name="Button.php" hash="98162d3c3280bdc3da75c90c45fc9500"/></dir></dir><dir name="Extension"><file name="List.php" hash="0006ff459c6b19de9349fa31c8be6b2b"/></dir></dir></dir><dir name="Model"><file name="Feed.php" hash="b5e0d2343b2c9db1f4d86ca0e8b3a922"/><file name="Observer.php" hash="dfc8c917e3f3882d1d99c734831c6e0b"/><dir name="Source"><file name="Reason.php" hash="02eb3c4cfe3433e5a8194862aef636c4"/><dir name="Subscription"><file name="Type.php" hash="616c3f7e7e4ebe3e42e16d54d159d378"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Empty.php" hash="2af2d53c7c56b9ea4a148a2862da224b"/></dir></dir></dir><dir name="Feed"><file name="Extension.php" hash="1ff201b02db7827df350b11c19902fa2"/></dir></dir><dir name="Helper"><file name="Config.php" hash="42eff18ca97b961e1186a790abcb8690"/><file name="Data.php" hash="5492cb13c72b737d85e9009f0f623336"/><file name="Extension.php" hash="c0c987bd848e5270ec31544460438eab"/></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="neklo"><file name="core.xml" hash="8851b2c111c8e0745fb78af2bb57e6a6"/></dir></dir><dir name="template"><dir name="neklo"><dir name="core"><dir name="system"><dir name="contact"><file name="button.phtml" hash="f7b5f21ddb974aa32c888c29f3057d18"/><file name="header.phtml" hash="3c0a401955a9b2bac799aa65b5bf7a81"/></dir><dir name="extension"><file name="list.phtml" hash="29378800cc0a7488badb2698a02220d7"/></dir><dir name="subscribe"><file name="button.phtml" hash="865b84befba4d00e6a1e4de2b989776e"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="Neklo_Core.csv" hash="c6abfbb8be878de9c02339e2ecfc4e16"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="neklo"><dir name="core"><dir name="images"><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir><dir name="css"><file name="style.css" hash="77e35507d6f2e748afc08f11f322120d"/></dir></dir><dir name="monitor"><dir name="css"><file name="styles.css" hash="ab8dc36c3c18794064b0ea8b8c8334fb"/></dir></dir></dir></dir></dir></dir></dir><dir name="lib"><dir name="Linfo"><file name="Common.php" hash="3d55bb51d9de7438c044a012ae50175b"/><file name="Linfo.php" hash="d26c95e093e3c4d5eb456c6c5dfa1579"/><dir name="Output"><file name="Html.php" hash="5ec70c500dda56a561d188dd6e908e49"/><file name="Json.php" hash="4616bcc1ddd3eaa312ef2235e7da1586"/><file name="Ncurses.php" hash="60dbe6e0b2eb00dedccc972271a712fa"/><file name="Output.php" hash="34ef640283d567d93300a2b9c107d276"/><file name="Serialized.php" hash="aa749737127da4bb25c941557d1cfb81"/><file name="Xml.php" hash="7fb392ee95df014c30dd52130e9db45c"/></dir><dir name="Exceptions"><file name="FatalException.php" hash="ac7ae108aa403bc300ba9086410cf0a9"/></dir><dir name="Extension"><file name="Apcaccess.php" hash="8e274bd0036006e064c0cd85fbd732a9"/><file name="Cups.php" hash="25bb7dfe794d5ff211c9862615e2192b"/><file name="Dhcpd3_leases.php" hash="40ffcf2c2ec8618ff8155d197c15bbf1"/><file name="Dnsmasq_dhcpd.php" hash="bc751a49a09f06d8e4492f7ddf432cea"/><file name="Extension.php" hash="d09316ce5276805b702fdc1115b4adc3"/><file name="Ipmi.php" hash="5536abf11a4f06e0b91852f5e17b77bc"/><file name="Libvirt.php" hash="889dcd93239aecb42d6f80b2618e87b1"/><file name="Smb.php" hash="d6d4e995bf54fbdfeec0a51f70faec37"/><file name="Soldat.php" hash="bce89097e6540818f153b2df5b71b0b5"/><file name="Transmission.php" hash="e438b16dc2040d8676c7ba2c1448b6ef"/><file name="Truecrypt.php" hash="f4838a69d9eda202a5d64e8bb8ced36c"/><file name="Utorrent.php" hash="14119c01579d58a01f6489a0865855f7"/></dir><dir name="Lang"><file name="de.php" hash="e313cc8346be39d62607278bd986af23"/><file name="en.php" hash="8ee1b778ed29c64e02e3e1f118016f82"/><file name="fi.php" hash="10d10cd954719a7cee69d5bfbf67889c"/><file name="fr.php" hash="6edcf8ee5251dee98ee39f84fdd52647"/><file name="it.php" hash="d65c5225fa3ef16fd2966137c18e83f4"/><file name="pl.php" hash="2d9b92e225acf0461540d1224a0141f5"/><file name="pt.php" hash="9dd24ee347278edc24f589f6e3f12c58"/><file name="zh.php" hash="2f9ae1cfcf4e5a80127200bf9c9d0b8b"/></dir><dir name="OS"><file name="BSDcommon.php" hash="3b6c83b58e56e0a0eac250f70451be5a"/><file name="Darwin.php" hash="fc45b3648d75c96596d8c7a8559d2d74"/><file name="DragonFly.php" hash="c5ffffe8e6899a0f8352c1fd0f763135"/><file name="FreeBSD.php" hash="f07d480ebda610153b5f6d42d0143f37"/><file name="Linux.php" hash="5e36caf50252aa24fab289ae4239a591"/><file name="Minix.php" hash="22c19a5e45c4715cfcb0db1f42fd5793"/><file name="NetBSD.php" hash="f576ac8083757848bbd179420c182aeb"/><file name="OS.php" hash="49f2a6e9b1e3e56815896f0364049bef"/><file name="OpenBSD.php" hash="cd6b1bd659a30465903ebc913382b223"/><file name="SunOS.php" hash="2cfa3e63e51ca1d8928f2f521be26b3d"/><file name="Unixcommon.php" hash="9981cca8d8805302983ebe20dc2ef04d"/><file name="Windows.php" hash="f73cd25acaf3774da31b922ab3287038"/></dir><dir name="Meta"><file name="Errors.php" hash="e614a650fd523918b010b4297c4c2acd"/><file name="Timer.php" hash="ea244a5a388fa8cc470799cbdd96b866"/></dir><dir name="Parsers"><file name="CallExt.php" hash="6a671a39e8debf7e4c950491f45d8ee4"/><file name="Hddtemp.php" hash="3d0007ab7349702042a88f1e9ca23649"/><file name="Hwpci.php" hash="e26d72856736d83470e82916ba78a3ca"/><file name="Mbmon.php" hash="aa3782625c7542059838e475ccb13326"/><file name="Sensord.php" hash="2be994a2c77ba0a35398a6fc96a4c77a"/></dir></dir></dir></target></contents></package>
 
 
 
 
1
  <?xml version="1.0"?>
2
+ <package><name>Neklo_Monitor</name><version>1.2.1</version><stability>stable</stability><license>License</license><channel>community</channel><extends></extends><summary>New Release</summary><description>Connector for Magento Monitor Application</description><notes>Notifications on new orders - on all or exceptional only (payment amount exceeded, number of items exceeded).
3
+
4
+ Notifications on inventory changes with the possibility to set value for each attribute set - a product becomes out of stock or drops to low inventory.
5
+
6
+ Daily sales report notifications - every day at the time pointed a notification comes with information gathered during the previous day.</notes><authors><author><name>NEKLO</name><user>NEKLO</user><email>info@neklo.com</email></author></authors><date>2016-06-10</date><time>6:41:45</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Neklo_Core.xml" hash="335032ff690c5272626dca9106642680"/><file name="Neklo_Monitor.xml" hash="e93ded9f7368552a843959e953a2bf10"/></dir></dir><dir name="code"><dir name="community"><dir name="Neklo"><dir name="Monitor"><file name="Autoload.php" hash="612c4e0d0a4db5be84c29650655085f6"/><dir name="etc"><file name="adminhtml.xml" hash="897debfe836ca9d58971b44b2232187e"/><file name="config.xml" hash="489e7003d1531e77d52a5a5a35e68e19"/><file name="system.xml" hash="c99ed6a7ac945fab0fb803d7ac5b820b"/></dir><dir name="controllers"><file name="AuthController.php" hash="2173469565e9822a873dd11d88fd12c3"/><file name="CustomerController.php" hash="c3da1ec819d0da56c76ad28960979083"/><file name="DashboardController.php" hash="767a8b778586e2d4069f1db2730d33ea"/><file name="InfoController.php" hash="3e58cb421d2d68dabf79dc4d477f12e4"/><file name="OrderController.php" hash="9383692d3ce5b22d22afee32ddfae10b"/><file name="ProductController.php" hash="95ab32749b2eb4ab21cc79a0ba0f9edc"/><dir name="State"><file name="CacheController.php" hash="efb77eeae42be795d7618c620270d0d7"/><file name="IndexerController.php" hash="fa23622aabd0f1d40d4d03de692ae0a2"/></dir><dir name="Var"><file name="LogController.php" hash="b0c9fb0510dd81d3de890d1050d8ac18"/><file name="ReportController.php" hash="5e871965109e78c57252fd221c8e3a9b"/></dir><dir name="Report"><file name="SalesController.php" hash="700675ceeb05054ff3be6155d37cd37c"/></dir></dir><dir name="Controller"><file name="Abstract.php" hash="af6434938fe89b1b375e279449cc219b"/></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Frontend"><file name="Label.php" hash="bd831c28818a1b998dda55df056b28b4"/><file name="Status.php" hash="6c00cedcb46f4886476f2fda6757e692"/></dir></dir></dir></dir></dir><dir name="sql"><dir name="neklo_monitor_setup"><file name="mysql4-install-1.0.0.php" hash="3a5ee59cda3ec27eca737f515eec4a71"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="bba6559d5040c937d775a76df6611b77"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="f3bbc768ae43e1b45009de02c519dcd7"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="0a03caae9eb41f5f8bcf1a2a8476a13a"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="27ea9bdb83ecf08c68a1c9ccc8cb4dac"/><file name="mysql4-upgrade-1.1.3-1.2.0.php" hash="df93eef9daca7e21724f9c045d3852c0"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="ac36e19a977757ee9dc9f31ea5cef017"/></dir></dir><dir name="Model"><file name="Linfo.php" hash="77af1f86a0379d4d6ed86db3f770f2c8"/><file name="Minfo.php" hash="eaab8efeb41a9d2dd073093b869fe440"/><file name="Observer.php" hash="f15fbce459d0986c2eb82e44fbb4c798"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Server"><file name="Type.php" hash="0886c1a5bbf98e3d2cc5c0e3ea39b7e1"/></dir></dir><dir name="Backend"><file name="Empty.php" hash="556343bcf15ea8b294a15e77f6662cf8"/><file name="Token.php" hash="7669597367cd26bd848d0d8251feb4b7"/></dir></dir></dir><dir name="Cron"><file name="Abstract.php" hash="7183a30f5a456ee29a3e58f814999e87"/><file name="Server.php" hash="b2d82dedce8d53e8145335b417295696"/><file name="Store.php" hash="ad2f68426668cb34f59d383242de886a"/></dir><dir name="Resource"><file name="Changelog.php" hash="1a97f31fe6c54c26ad319d2dccab0f39"/><dir name="Minfo"><file name="Daily.php" hash="b73a98f954e4b0dfa1950dae98ef0af7"/><file name="Log.php" hash="54f05d3ced0a1aee770177265695eac9"/><file name="Report.php" hash="acb9c02688a9403a67904fda72c57533"/><dir name="Log"><file name="Collection.php" hash="fc6cbcd4c15227046cb7e85dfdad614d"/></dir><dir name="Daily"><file name="ReportsOrderCollection.php" hash="0f6155f7d0a1f6de0f6d1a326dd05ba8"/></dir><dir name="Report"><file name="Collection.php" hash="a9c74ab52be17dec7c4fafb883bda732"/></dir></dir><dir name="Gateway"><file name="Queue.php" hash="eb77ef4c7d62a4190a83538f7305916f"/><dir name="Queue"><file name="Collection.php" hash="bd857fa79a53887c3eedc27a94ecd0a7"/></dir></dir></dir><dir name="Minfo"><file name="Log.php" hash="d787eeaab4cae6f3d9fe7e696c427014"/><file name="Parser.php" hash="8d13a7d90fbd381f84299a674f556239"/><file name="Report.php" hash="d97960716a8c152d1614b8d0c752e064"/></dir><dir name="Linfo"><dir name="Os"><file name="Linux.php" hash="e61e9aceb9723b5c8e72200274b7f6ab"/></dir></dir><dir name="Gateway"><file name="Connector.php" hash="28cd6a63283f09ca51e7279f6f5bbb05"/><file name="Queue.php" hash="2d4178daa3efbfe728f96276ee99d34b"/></dir></dir><dir name="Helper"><file name="Config.php" hash="f4113d1a1538abe62bc21d5e5ae8212a"/><file name="Country.php" hash="15176ed5b48639f8c50242b126e9dea4"/><file name="Data.php" hash="a5a4c393c5c87b3e9c71d05e0ae755f5"/><file name="Date.php" hash="0aa9fb8caa33c51ba224bd1336724704"/><file name="Flat.php" hash="2b62a8f954c82c8d4ad8a11acc5283c8"/><file name="Request.php" hash="161f965554d69616f208125b27509a11"/><dir name="Request"><file name="Validator.php" hash="16375fad2da02f6732fefd465a388774"/></dir></dir></dir><dir name="Core"><dir name="etc"><file name="adminhtml.xml" hash="68b00ad4118462d74b0c0a7126063462"/><file name="config.xml" hash="dba97e16300307cae724d784309ec72d"/><file name="system.xml" hash="f9ee62f79b22584cc6180ec5e8049539"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Neklo"><dir name="Core"><file name="ContactController.php" hash="fe735a9c3c0ad9c4ecb88edd009059a9"/><file name="NewsletterController.php" hash="b9342c80bf94c29a463251b1c7b02705"/></dir></dir></dir></dir><dir name="Block"><dir name="System"><file name="Contact.php" hash="a0e89ca48de64bb8526c35598f99802b"/><file name="Extension.php" hash="8cd6609bd4f00bf8a8f5913d20e98e65"/><dir name="Contact"><file name="Header.php" hash="a6c4f8dbf002a0d2f6be0ea37445a562"/><file name="Send.php" hash="333d3059033faa826ef3781946676b16"/><dir name="Send"><file name="Button.php" hash="c94e2ae59246a968d7eb2e89e63485c8"/></dir></dir><dir name="Newsletter"><file name="Subscribe.php" hash="1015b8e49758e40c829667e94bb06220"/><dir name="Subscribe"><file name="Button.php" hash="98162d3c3280bdc3da75c90c45fc9500"/></dir></dir><dir name="Extension"><file name="List.php" hash="0006ff459c6b19de9349fa31c8be6b2b"/></dir></dir></dir><dir name="Model"><file name="Feed.php" hash="b5e0d2343b2c9db1f4d86ca0e8b3a922"/><file name="Observer.php" hash="dfc8c917e3f3882d1d99c734831c6e0b"/><dir name="Source"><file name="Reason.php" hash="02eb3c4cfe3433e5a8194862aef636c4"/><dir name="Subscription"><file name="Type.php" hash="616c3f7e7e4ebe3e42e16d54d159d378"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Empty.php" hash="2af2d53c7c56b9ea4a148a2862da224b"/></dir></dir></dir><dir name="Feed"><file name="Extension.php" hash="1ff201b02db7827df350b11c19902fa2"/></dir></dir><dir name="Helper"><file name="Config.php" hash="42eff18ca97b961e1186a790abcb8690"/><file name="Data.php" hash="5492cb13c72b737d85e9009f0f623336"/><file name="Extension.php" hash="c0c987bd848e5270ec31544460438eab"/></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="neklo"><file name="core.xml" hash="8851b2c111c8e0745fb78af2bb57e6a6"/></dir></dir><dir name="template"><dir name="neklo"><dir name="core"><dir name="system"><dir name="contact"><file name="button.phtml" hash="f7b5f21ddb974aa32c888c29f3057d18"/><file name="header.phtml" hash="3c0a401955a9b2bac799aa65b5bf7a81"/></dir><dir name="extension"><file name="list.phtml" hash="29378800cc0a7488badb2698a02220d7"/></dir><dir name="subscribe"><file name="button.phtml" hash="865b84befba4d00e6a1e4de2b989776e"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="Neklo_Core.csv" hash="c6abfbb8be878de9c02339e2ecfc4e16"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="neklo"><dir name="core"><dir name="images"><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir><dir name="css"><file name="style.css" hash="77e35507d6f2e748afc08f11f322120d"/></dir></dir><dir name="monitor"><dir name="css"><file name="styles.css" hash="ab8dc36c3c18794064b0ea8b8c8334fb"/></dir></dir></dir></dir></dir></dir></dir><dir name="lib"><dir name="Linfo"><file name="Common.php" hash="3d55bb51d9de7438c044a012ae50175b"/><file name="Linfo.php" hash="d26c95e093e3c4d5eb456c6c5dfa1579"/><dir name="Output"><file name="Html.php" hash="5ec70c500dda56a561d188dd6e908e49"/><file name="Json.php" hash="4616bcc1ddd3eaa312ef2235e7da1586"/><file name="Ncurses.php" hash="60dbe6e0b2eb00dedccc972271a712fa"/><file name="Output.php" hash="34ef640283d567d93300a2b9c107d276"/><file name="Serialized.php" hash="aa749737127da4bb25c941557d1cfb81"/><file name="Xml.php" hash="7fb392ee95df014c30dd52130e9db45c"/></dir><dir name="Exceptions"><file name="FatalException.php" hash="ac7ae108aa403bc300ba9086410cf0a9"/></dir><dir name="Extension"><file name="Apcaccess.php" hash="8e274bd0036006e064c0cd85fbd732a9"/><file name="Cups.php" hash="25bb7dfe794d5ff211c9862615e2192b"/><file name="Dhcpd3_leases.php" hash="40ffcf2c2ec8618ff8155d197c15bbf1"/><file name="Dnsmasq_dhcpd.php" hash="bc751a49a09f06d8e4492f7ddf432cea"/><file name="Extension.php" hash="d09316ce5276805b702fdc1115b4adc3"/><file name="Ipmi.php" hash="5536abf11a4f06e0b91852f5e17b77bc"/><file name="Libvirt.php" hash="889dcd93239aecb42d6f80b2618e87b1"/><file name="Smb.php" hash="d6d4e995bf54fbdfeec0a51f70faec37"/><file name="Soldat.php" hash="bce89097e6540818f153b2df5b71b0b5"/><file name="Transmission.php" hash="e438b16dc2040d8676c7ba2c1448b6ef"/><file name="Truecrypt.php" hash="f4838a69d9eda202a5d64e8bb8ced36c"/><file name="Utorrent.php" hash="14119c01579d58a01f6489a0865855f7"/></dir><dir name="Lang"><file name="de.php" hash="e313cc8346be39d62607278bd986af23"/><file name="en.php" hash="8ee1b778ed29c64e02e3e1f118016f82"/><file name="fi.php" hash="10d10cd954719a7cee69d5bfbf67889c"/><file name="fr.php" hash="6edcf8ee5251dee98ee39f84fdd52647"/><file name="it.php" hash="d65c5225fa3ef16fd2966137c18e83f4"/><file name="pl.php" hash="2d9b92e225acf0461540d1224a0141f5"/><file name="pt.php" hash="9dd24ee347278edc24f589f6e3f12c58"/><file name="zh.php" hash="2f9ae1cfcf4e5a80127200bf9c9d0b8b"/></dir><dir name="OS"><file name="BSDcommon.php" hash="3b6c83b58e56e0a0eac250f70451be5a"/><file name="Darwin.php" hash="fc45b3648d75c96596d8c7a8559d2d74"/><file name="DragonFly.php" hash="c5ffffe8e6899a0f8352c1fd0f763135"/><file name="FreeBSD.php" hash="f07d480ebda610153b5f6d42d0143f37"/><file name="Linux.php" hash="5e36caf50252aa24fab289ae4239a591"/><file name="Minix.php" hash="22c19a5e45c4715cfcb0db1f42fd5793"/><file name="NetBSD.php" hash="f576ac8083757848bbd179420c182aeb"/><file name="OS.php" hash="49f2a6e9b1e3e56815896f0364049bef"/><file name="OpenBSD.php" hash="cd6b1bd659a30465903ebc913382b223"/><file name="SunOS.php" hash="2cfa3e63e51ca1d8928f2f521be26b3d"/><file name="Unixcommon.php" hash="9981cca8d8805302983ebe20dc2ef04d"/><file name="Windows.php" hash="f73cd25acaf3774da31b922ab3287038"/></dir><dir name="Meta"><file name="Errors.php" hash="e614a650fd523918b010b4297c4c2acd"/><file name="Timer.php" hash="ea244a5a388fa8cc470799cbdd96b866"/></dir><dir name="Parsers"><file name="CallExt.php" hash="6a671a39e8debf7e4c950491f45d8ee4"/><file name="Hddtemp.php" hash="3d0007ab7349702042a88f1e9ca23649"/><file name="Hwpci.php" hash="e26d72856736d83470e82916ba78a3ca"/><file name="Mbmon.php" hash="aa3782625c7542059838e475ccb13326"/><file name="Sensord.php" hash="2be994a2c77ba0a35398a6fc96a4c77a"/></dir></dir></dir></target></contents></package>