Version Notes
--
Download this release
Release Info
Developer | Wladyslaw Brodsky |
Extension | Shoppimon_Monitor |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Shoppimon/Monitor/Helper/Data.php +15 -0
- app/code/community/Shoppimon/Monitor/Model/Analyzer.php +227 -0
- app/code/community/Shoppimon/Monitor/Model/Observer.php +57 -0
- app/code/community/Shoppimon/Monitor/controllers/MonitorController.php +59 -0
- app/code/community/Shoppimon/Monitor/etc/adminhtml.xml +51 -0
- app/code/community/Shoppimon/Monitor/etc/config.xml +66 -0
- app/code/community/Shoppimon/Monitor/etc/system.xml +53 -0
- app/design/adminhtml/default/default/layout/shoppimon.xml +14 -0
- app/design/adminhtml/default/default/template/shoppimon/dashboard.phtml +15 -0
- app/etc/modules/Shoppimon_Monitor.xml +15 -0
- package.xml +30 -0
- readme_shoppimon.txt +29 -0
app/code/community/Shoppimon/Monitor/Helper/Data.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* (c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
*
|
5 |
+
* @author wladyslaw@shoppimon.com
|
6 |
+
* @license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Shoppimon_Monitor_Helper_Data
|
11 |
+
*/
|
12 |
+
class Shoppimon_Monitor_Helper_Data extends Mage_Core_Helper_Abstract
|
13 |
+
{
|
14 |
+
|
15 |
+
}
|
app/code/community/Shoppimon/Monitor/Model/Analyzer.php
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* (c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
*
|
5 |
+
* @author wladyslaw@shoppimon.com
|
6 |
+
* @license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Shoppimon_Monitor_Model_Analyzer
|
11 |
+
*/
|
12 |
+
class Shoppimon_Monitor_Model_Analyzer extends Mage_Core_Model_Abstract
|
13 |
+
{
|
14 |
+
const SHOPPIMON_BASE_URL = 'https://api.shoppimon.com/';
|
15 |
+
const SHOPPIMON_STATIC_FILES = 'https://assets.shoppimon.com/mage-ext/v1/';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Get metadata for store
|
19 |
+
*
|
20 |
+
* @return array
|
21 |
+
*/
|
22 |
+
public function getStoreMetadata()
|
23 |
+
{
|
24 |
+
$data = [];
|
25 |
+
|
26 |
+
$data['store_base_url'] = Mage::getBaseUrl(); //store domain
|
27 |
+
|
28 |
+
$websites = Mage::app()->getWebsites(true); //all storefronts
|
29 |
+
foreach ($websites as $website) {
|
30 |
+
$data['websites'][] = $website->getData();
|
31 |
+
}
|
32 |
+
$data['magento_version'] = Mage::getVersion(); //magento version
|
33 |
+
$data['extensions'] = Mage::app()->getConfig()->getNode('modules'); //extension types
|
34 |
+
$data['php_version'] = phpversion(); //php version
|
35 |
+
$data['php_modules'] = get_loaded_extensions(); //php modules loaded
|
36 |
+
$data['payment_options'] = $this->getActivePaymentMethods(); //payment methods
|
37 |
+
|
38 |
+
return $data;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Get general bussiness info
|
43 |
+
*
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function getBIInfo()
|
47 |
+
{
|
48 |
+
$data = [];
|
49 |
+
//BI information
|
50 |
+
$productModel = Mage::getModel('catalog/product');
|
51 |
+
$data['products'] = [];
|
52 |
+
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
53 |
+
->getItems();
|
54 |
+
foreach ($attributes as $attribute) {
|
55 |
+
$data['attributes'][] = $attribute->getData();
|
56 |
+
}
|
57 |
+
$productCollection = $productModel->getCollection()
|
58 |
+
->addAttributeToSelect('price')
|
59 |
+
->addAttributeToSelect('name')
|
60 |
+
->addAttributeToSelect('image')
|
61 |
+
->addAttributeToSelect('url_path')
|
62 |
+
->addAttributeToSelect('status')
|
63 |
+
->addAttributeToSelect('visibility')
|
64 |
+
->addAttributeToSelect('is_salable')
|
65 |
+
->addAttributeToSelect('is_in_stock');
|
66 |
+
$products = $productCollection->getItems();
|
67 |
+
foreach ($products as $product) {
|
68 |
+
$productData = $product->getData();
|
69 |
+
unset($productData['stock_item']);
|
70 |
+
$data['products'][] = $productData;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
$categoryModel = Mage::getModel('catalog/category');
|
75 |
+
$categories = $categoryModel->getCollection()->getItems();
|
76 |
+
foreach ($categories as $category) {
|
77 |
+
$categoryData = [];
|
78 |
+
$categoryData['id'] = $category['entity_id'];
|
79 |
+
$categoryData['parent_id'] = $category['parent_id'];
|
80 |
+
$categoryData['created_at'] = $category['created_at'];
|
81 |
+
$categoryData['updated_at'] = $category['updated_at'];
|
82 |
+
$categoryData['position'] = $category['position'];
|
83 |
+
$categoryData['path'] = $category['path'];
|
84 |
+
$data['categories'][] = $categoryData;
|
85 |
+
}
|
86 |
+
|
87 |
+
$bestsellers = Mage::getResourceModel('sales/report_bestsellers_collection')->getItems();
|
88 |
+
for ($i=0;$i<2;$i++) {
|
89 |
+
$data['bestsellers'][] = $bestsellers[$i]->getData();
|
90 |
+
}
|
91 |
+
|
92 |
+
$fromDate = date('Y-m-d H:i:s', strtotime(time()-26*60*60)); //yesterday's midnight
|
93 |
+
$toDate = date('Y-m-d H:i:s', strtotime(time()-2*60*60)); //trying to get midnight from supposed time of running
|
94 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
95 |
+
->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
|
96 |
+
->addAttributeToFilter('status', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
|
97 |
+
$ordersCount = $orders->getSize();
|
98 |
+
$data['orders'] = [];
|
99 |
+
if ($ordersCount > 0) {
|
100 |
+
$price = 0;
|
101 |
+
$median = [];
|
102 |
+
$data['orders']['qty'] = $ordersCount;
|
103 |
+
foreach ($orders->getItems() as $item) {
|
104 |
+
$dataItem = $item->getData();
|
105 |
+
$price += $dataItem['grand_total'];
|
106 |
+
$median[] = $price;
|
107 |
+
}
|
108 |
+
$median[] = 650;
|
109 |
+
$data['orders']['average'] = $price/$ordersCount;
|
110 |
+
rsort($median);
|
111 |
+
$middle = intval(round(count($median) / 2));
|
112 |
+
$data['orders']['median'] = $median[$middle-1];
|
113 |
+
}
|
114 |
+
|
115 |
+
return $data;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get technical data
|
120 |
+
*
|
121 |
+
* @return array
|
122 |
+
*/
|
123 |
+
protected function getTechnicalData()
|
124 |
+
{
|
125 |
+
$data = [];
|
126 |
+
|
127 |
+
$data['shoppimon_ext_version'] = Mage::getConfig()->getModuleConfig('Shoppimon_Monitor')->version;
|
128 |
+
|
129 |
+
return $data;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* get available payment methods
|
134 |
+
*
|
135 |
+
* @return array
|
136 |
+
*/
|
137 |
+
protected function getActivePaymentMethods()
|
138 |
+
{
|
139 |
+
$methods = [];
|
140 |
+
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
|
141 |
+
foreach ($payments as $paymentCode => $paymentModel) {
|
142 |
+
$paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title');
|
143 |
+
$methods[$paymentCode] = [
|
144 |
+
'label' => $paymentTitle
|
145 |
+
];
|
146 |
+
}
|
147 |
+
|
148 |
+
return $methods;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Check for website id and if not connected, get it and save in config data
|
153 |
+
*/
|
154 |
+
public function checkWebsiteId()
|
155 |
+
{
|
156 |
+
if (!Mage::getStoreConfig('shoppimon/settings/website_id')) {
|
157 |
+
$ch = curl_init();
|
158 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
159 |
+
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
160 |
+
$url = self::SHOPPIMON_BASE_URL . 'website?base_url=' . $baseUrl;
|
161 |
+
$headers = [
|
162 |
+
'Content-Type: application/json',
|
163 |
+
'Authorization: Bearer ' . Mage::getSingleton('admin/session')->getShoppimonToken()
|
164 |
+
];
|
165 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
166 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
167 |
+
$websiteCollection = curl_exec($ch);
|
168 |
+
|
169 |
+
if ($websiteCollection) {
|
170 |
+
$websiteCollection = json_decode($websiteCollection);
|
171 |
+
if (
|
172 |
+
isset($websiteCollection->_embedded) &&
|
173 |
+
isset($websiteCollection->_embedded->website) &&
|
174 |
+
1 == count($websiteCollection->_embedded->website)
|
175 |
+
) {
|
176 |
+
$websiteId = $websiteCollection->_embedded->website[0]->id;
|
177 |
+
Mage::getConfig()->saveConfig('shoppimon/settings/website_id', $websiteId, 'default', 0);
|
178 |
+
Mage::app()->getStore()->resetConfig();
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Get new oauth token and insert into session
|
186 |
+
*/
|
187 |
+
public function installToken()
|
188 |
+
{
|
189 |
+
$headers = [
|
190 |
+
'Content-Type: application/json'
|
191 |
+
];
|
192 |
+
$url = self::SHOPPIMON_BASE_URL . 'oauth';
|
193 |
+
if (
|
194 |
+
empty(Mage::getStoreConfig('shoppimon/settings/api_key')) ||
|
195 |
+
empty(Mage::getStoreConfig('shoppimon/settings/api_secret'))
|
196 |
+
) {
|
197 |
+
throw new Exception(
|
198 |
+
'Hi there! It looks like your API Key and API Secret Code still need to be installed. ' .
|
199 |
+
'For full instructions see the FAQ here: https://shoppimon.zendesk.com/hc/en-us'
|
200 |
+
);
|
201 |
+
}
|
202 |
+
$fields = [
|
203 |
+
'client_id' => Mage::getStoreConfig('shoppimon/settings/api_key'),
|
204 |
+
'client_secret' => Mage::getStoreConfig('shoppimon/settings/api_secret'),
|
205 |
+
'grant_type' => 'client_credentials'
|
206 |
+
];
|
207 |
+
$ch = curl_init();
|
208 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
209 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
210 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
211 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
|
212 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
213 |
+
|
214 |
+
$newToken = curl_exec($ch);
|
215 |
+
$newToken = json_decode($newToken);
|
216 |
+
|
217 |
+
if (isset($newToken->access_token) && isset($newToken->expires_in)) {
|
218 |
+
Mage::getSingleton('admin/session')->setShoppimonToken($newToken->access_token);
|
219 |
+
Mage::getSingleton('admin/session')->setShoppimonTokenExpire(time() + $newToken->expires_in);
|
220 |
+
} else {
|
221 |
+
throw new Exception(
|
222 |
+
'Uh oh! Looks like you need a Session Token. Please contact the Shoppimon team ' .
|
223 |
+
'at support@shoppimon.com so we get one for you away.'
|
224 |
+
);
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
app/code/community/Shoppimon/Monitor/Model/Observer.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* (c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
*
|
5 |
+
* @author wladyslaw@shoppimon.com
|
6 |
+
* @license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Shoppimon_Monitor_Model_Observer
|
11 |
+
*/
|
12 |
+
class Shoppimon_Monitor_Model_Observer
|
13 |
+
{
|
14 |
+
|
15 |
+
public function analyzeData(Varien_Event_Observer $observer)
|
16 |
+
{
|
17 |
+
$pushUrl = Mage::getStoreConfig('shoppimon/settings/push_url');
|
18 |
+
if (strlen($pushUrl) > 0) {
|
19 |
+
$resultData = [];
|
20 |
+
$analyzeModel = Mage::getModel('Shoppimon_Monitor/Analyzer');
|
21 |
+
|
22 |
+
$analyzeModel->checkWebsiteId();
|
23 |
+
|
24 |
+
$resultData['metadata'] = $analyzeModel->getStoreMetadata();
|
25 |
+
$resultData['instrumentation'] = $analyzeModel->getInstrumentation();
|
26 |
+
$resultData['bi'] = $analyzeModel->getBIInfo();
|
27 |
+
$resultData['techs'] = $analyzeModel->getTechnicalData();
|
28 |
+
|
29 |
+
$websiteId = Mage::getStoreConfig('shoppimon/settings/website_id'); //default config option chosen
|
30 |
+
$data = [
|
31 |
+
'website_id' => $websiteId,
|
32 |
+
'base_url' => Mage::getBaseUrl(),
|
33 |
+
'data' => $resultData
|
34 |
+
];
|
35 |
+
|
36 |
+
$ch = curl_init();
|
37 |
+
curl_setopt(
|
38 |
+
$ch,
|
39 |
+
CURLOPT_URL,
|
40 |
+
Shoppimon_Monitor_Model_Analyzer::SHOPPIMON_BASE_URL . $pushUrl
|
41 |
+
);
|
42 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
43 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
44 |
+
curl_setopt(
|
45 |
+
$ch,
|
46 |
+
CURLOPT_HEADER,
|
47 |
+
'Content-type: application/shoppimon-magento-ver' . $resultData['techs']['shoppimon_ext_version'] . '+json'
|
48 |
+
);
|
49 |
+
$result = curl_exec($ch);
|
50 |
+
|
51 |
+
if (!$result) {
|
52 |
+
$e = new Exception('We were unable to push data to Shoppimon. Please contact Shoppimon support');
|
53 |
+
Mage::logException($e);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Shoppimon/Monitor/controllers/MonitorController.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* (c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
*
|
5 |
+
* @author wladyslaw@shoppimon.com
|
6 |
+
* @license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Shoppimon_Monitor_MonitorController
|
11 |
+
*/
|
12 |
+
class Shoppimon_Monitor_MonitorController extends Mage_Adminhtml_Controller_Action
|
13 |
+
{
|
14 |
+
|
15 |
+
public function indexAction()
|
16 |
+
{
|
17 |
+
$model = Mage::getModel('Shoppimon_Monitor/Analyzer');
|
18 |
+
//token section
|
19 |
+
$token = Mage::getSingleton('admin/session')->getShoppimonToken();
|
20 |
+
$expireTime = Mage::getSingleton('admin/session')->getShoppimonTokenExpire();
|
21 |
+
if ( !$token || !$expireTime || $expireTime < time()) {
|
22 |
+
try {
|
23 |
+
$model->installToken();
|
24 |
+
} catch (Exception $e) {
|
25 |
+
Mage::logException($e);
|
26 |
+
Mage::getSingleton('adminhtml/session')->addWarning(
|
27 |
+
$e->getMessage()
|
28 |
+
);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
$this->loadLayout();
|
33 |
+
if ( Mage::getSingleton('admin/session')->getShoppimonToken()){
|
34 |
+
$model->checkWebsiteId();
|
35 |
+
|
36 |
+
//load the dashboard
|
37 |
+
$url = Shoppimon_Monitor_Model_Analyzer::SHOPPIMON_STATIC_FILES . 'shoppimon-magento-extension.html';
|
38 |
+
|
39 |
+
$ch = curl_init();
|
40 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
41 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
42 |
+
$content = curl_exec($ch);
|
43 |
+
|
44 |
+
if (!$content || strpos($content, 'shoppimon-extension-container') === false) {
|
45 |
+
$e = new Exception(
|
46 |
+
'Uh oh! Looks like there are some missing files. Please contact the Shoppimon team ' .
|
47 |
+
'at support@shoppimon.com so we can get you up and running right away.'
|
48 |
+
);
|
49 |
+
Mage::logException($e);
|
50 |
+
Mage::getSingleton('adminhtml/session')->addWarning(
|
51 |
+
$e->getMessage()
|
52 |
+
);
|
53 |
+
}
|
54 |
+
$this->getLayout()->getBlock('shoppimon_monitor_dashboard')
|
55 |
+
->setData('content', $content);
|
56 |
+
}
|
57 |
+
$this->renderLayout();
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Shoppimon/Monitor/etc/adminhtml.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
(c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
|
5 |
+
@author wladyslaw@shoppimon.com
|
6 |
+
@license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<menu>
|
10 |
+
<shoppimon translate="title" module="Shoppimon_Monitor">
|
11 |
+
<title>Shoppimon</title>
|
12 |
+
<sort_order>1000</sort_order>
|
13 |
+
<children>
|
14 |
+
<monitor>
|
15 |
+
<title>Business Monitoring</title>
|
16 |
+
<sort_order>1</sort_order>
|
17 |
+
<action>adminhtml/monitor/index</action>
|
18 |
+
</monitor>
|
19 |
+
</children>
|
20 |
+
<depends>
|
21 |
+
<config>shoppimon/settings/show_dashboard</config>
|
22 |
+
</depends>
|
23 |
+
</shoppimon>
|
24 |
+
</menu>
|
25 |
+
<acl>
|
26 |
+
<resources>
|
27 |
+
<all>
|
28 |
+
<title>Allow Everything</title>
|
29 |
+
</all>
|
30 |
+
<admin>
|
31 |
+
<children>
|
32 |
+
<shoppimon translate="title" module="Shoppimon_Monitor">
|
33 |
+
<title>Shoppimon Business Monitoring Menu Item</title>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
</shoppimon>
|
36 |
+
<system>
|
37 |
+
<children>
|
38 |
+
<config>
|
39 |
+
<children>
|
40 |
+
<shoppimon>
|
41 |
+
<title>Shoppimon - All</title>
|
42 |
+
</shoppimon>
|
43 |
+
</children>
|
44 |
+
</config>
|
45 |
+
</children>
|
46 |
+
</system>
|
47 |
+
</children>
|
48 |
+
</admin>
|
49 |
+
</resources>
|
50 |
+
</acl>
|
51 |
+
</config>
|
app/code/community/Shoppimon/Monitor/etc/config.xml
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
(c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
|
5 |
+
@author wladyslaw@shoppimon.com
|
6 |
+
@license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<Shoppimon_Monitor>
|
11 |
+
<version>1.0.0</version>
|
12 |
+
</Shoppimon_Monitor>
|
13 |
+
</modules>
|
14 |
+
<global>
|
15 |
+
<helpers>
|
16 |
+
<Shoppimon_Monitor>
|
17 |
+
<class>Shoppimon_Monitor_Helper</class>
|
18 |
+
</Shoppimon_Monitor>
|
19 |
+
</helpers>
|
20 |
+
<models>
|
21 |
+
<Shoppimon_Monitor>
|
22 |
+
<class>Shoppimon_Monitor_Model</class>
|
23 |
+
</Shoppimon_Monitor>
|
24 |
+
</models>
|
25 |
+
</global>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<adminhtml>
|
29 |
+
<args>
|
30 |
+
<modules>
|
31 |
+
<Shoppimon_Monitor after="Mage_Adminhtml">Shoppimon_Monitor</Shoppimon_Monitor>
|
32 |
+
</modules>
|
33 |
+
</args>
|
34 |
+
</adminhtml>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<Shoppimon_Monitor>
|
41 |
+
<file>shoppimon.xml</file>
|
42 |
+
</Shoppimon_Monitor>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
</adminhtml>
|
46 |
+
<crontab>
|
47 |
+
<jobs>
|
48 |
+
<shoppimon_data_processor>
|
49 |
+
<schedule>
|
50 |
+
<cron_expr>0 2 * * *</cron_expr>
|
51 |
+
</schedule>
|
52 |
+
<run>
|
53 |
+
<model>shoppimon_monitor/observer::analyzeData</model>
|
54 |
+
</run>
|
55 |
+
</shoppimon_data_processor>
|
56 |
+
</jobs>
|
57 |
+
</crontab>
|
58 |
+
<defaults>
|
59 |
+
<shoppimon>
|
60 |
+
<settings>
|
61 |
+
<show_dashboard>1</show_dashboard>
|
62 |
+
<push_url>https://collect.shoppimon.com/magento/site-data</push_url>
|
63 |
+
</settings>
|
64 |
+
</shoppimon>
|
65 |
+
</defaults>
|
66 |
+
</config>
|
app/code/community/Shoppimon/Monitor/etc/system.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
(c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
|
5 |
+
@author wladyslaw@shoppimon.com
|
6 |
+
@license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<tabs>
|
10 |
+
<shoppimon translate="label" module="Shoppimon_Monitor">
|
11 |
+
<label>Shoppimon</label>
|
12 |
+
<sort_order>100</sort_order>
|
13 |
+
</shoppimon>
|
14 |
+
</tabs>
|
15 |
+
<sections>
|
16 |
+
<shoppimon translate="label" module="Shoppimon_Monitor">
|
17 |
+
<label>Shoppimon</label>
|
18 |
+
<tab>shoppimon</tab>
|
19 |
+
<sort_order>10</sort_order>
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>1</show_in_website>
|
22 |
+
<show_in_store>1</show_in_store>
|
23 |
+
<groups>
|
24 |
+
<settings translate="label" module="Shoppimon_Monitor">
|
25 |
+
<label>Shoppimon Settings</label>
|
26 |
+
<frontend_type>text</frontend_type>
|
27 |
+
<sort_order>1</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>1</show_in_store>
|
31 |
+
<fields>
|
32 |
+
<api_key translate="label">
|
33 |
+
<label>Api Key</label>
|
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 |
+
</api_key>
|
40 |
+
<api_secret translate="label">
|
41 |
+
<label>Api Secret</label>
|
42 |
+
<frontend_type>text</frontend_type>
|
43 |
+
<sort_order>2</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
</api_secret>
|
48 |
+
</fields>
|
49 |
+
</settings>
|
50 |
+
</groups>
|
51 |
+
</shoppimon>
|
52 |
+
</sections>
|
53 |
+
</config>
|
app/design/adminhtml/default/default/layout/shoppimon.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
(c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
|
5 |
+
@author wladyslaw@shoppimon.com
|
6 |
+
@license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
-->
|
8 |
+
<layout>
|
9 |
+
<adminhtml_monitor_index>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="core/template" name="shoppimon_monitor_dashboard" template="shoppimon/dashboard.phtml" />
|
12 |
+
</reference>
|
13 |
+
</adminhtml_monitor_index>
|
14 |
+
</layout>
|
app/design/adminhtml/default/default/template/shoppimon/dashboard.phtml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* (c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
*
|
5 |
+
* @author wladyslaw@shoppimon.com
|
6 |
+
* @license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<script>
|
10 |
+
var shoppimonWebsiteId = '<?php echo Mage::getStoreConfig('shoppimon/settings/website_id'); ?>';
|
11 |
+
var shoppimonAuthToken = '<?php echo Mage::getSingleton('admin/session')->getShoppimonToken(); ?>';
|
12 |
+
</script>
|
13 |
+
<div id="shoppimon_dashboard">
|
14 |
+
<?php echo $this->content; ?>
|
15 |
+
</div>
|
app/etc/modules/Shoppimon_Monitor.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
(c) 2016 Shoppimon LTD, all rights reserved
|
4 |
+
|
5 |
+
@author wladyslaw@shoppimon.com
|
6 |
+
@license https://www.shoppimon.com/terms-of-use.html
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<Shoppimon_Monitor>
|
11 |
+
<active>true</active>
|
12 |
+
<codePool>community</codePool>
|
13 |
+
</Shoppimon_Monitor>
|
14 |
+
</modules>
|
15 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Shoppimon_Monitor</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="https://www.shoppimon.com/terms-of-use.html">Shoppimon's Terms Of Use</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Find and fix issues, faster than ever before. Get Shoppimon performance insights in your Magento dashboard.</summary>
|
10 |
+
<description><h2>Monitoring Your Magento Business</h2>
|
11 |
+

|
12 |
+
Monitoring by Shoppimon gives you all the necessary performance insights into your store directly from the Magento dashboard. Get key store health trends, and real-time alerts on any issues impacting your business's health. 
|
13 |
+

|
14 |
+
<strong><a href"https://www.shoppimon.com/#sign-up">Sign up for Shoppimon</a> today, it's free!</strong>
|
15 |
+

|
16 |
+
<h2>Benefits & Advantages of Monitoring by Shoppimon</h2>
|
17 |
+
<ul>
|
18 |
+
<li>Integrate your Shoppimon account with your Magento dashboard</li>
|
19 |
+
<li>Get 24/7/365 real-time alerts on any issues preventing customers from completing store purchases</li> 
|
20 |
+
<li>Understand how your store is performing, compared to the competition</li>
|
21 |
+
<li>Get straight to the root cause of store issues to fix them immediately</li>
|
22 |
+
</ul></description>
|
23 |
+
<notes>--</notes>
|
24 |
+
<authors><author><name>Wladyslaw Brodsky</name><user>wladyslaw</user><email>wladyslaw@shoppimon.com</email></author><author><name>Danny Berger</name><user>danny</user><email>danny@shoppimon.com</email></author></authors>
|
25 |
+
<date>2016-05-05</date>
|
26 |
+
<time>11:44:06</time>
|
27 |
+
<contents><target name="magecommunity"><dir name="Shoppimon"><dir name="Monitor"><dir name="Helper"><file name="Data.php" hash="c09df032388b57260d16101d2570bfe7"/></dir><dir name="Model"><file name="Analyzer.php" hash="e1cb0309cb0ca988138a91228e4a3678"/><file name="Observer.php" hash="2a7a6fdb85c17061c8097d9dd9b3ec52"/></dir><dir name="controllers"><file name="MonitorController.php" hash="276f3510c4aa2a2210bf9aff3964dc99"/></dir><dir name="etc"><file name="adminhtml.xml" hash="186d3dfd6eb04ea6d4ddca27b518aef8"/><file name="config.xml" hash="e26e045aa7038e4915afa7539ddb78ea"/><file name="system.xml" hash="bf62b70683cf1975eebd8feb9db509df"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Shoppimon_Monitor.xml" hash="e8101cd81eb5684ab28cda50aea3da67"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="shoppimon.xml" hash="241e0b3addafc769d880893507af8371"/></dir><dir name="template"><dir name="shoppimon"><file name="dashboard.phtml" hash="aa97c7aec006f79f274e54b93a778f35"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="readme_shoppimon.txt" hash="40efbfb7b7741dbbe37eeea28275a133"/></dir></target></contents>
|
28 |
+
<compatible/>
|
29 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
+
</package>
|
readme_shoppimon.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This extension is an addition to Shoppimon monitoring application, and allows user to access his Shoppimon monitoring dashboard inside Magento Admin panel, as well as enhances data collection by Shoppimon.
|
2 |
+
|
3 |
+
How do I install the Monitoring by Shoppimon extension in my Magento admin panel?
|
4 |
+
|
5 |
+
In order to install the Monitoring by Shoppimon dashboard, you must first be a registered Shoppimon user. If you are not yet registered, just go to https://www.shoppimon.com/#sign-up to sign up. It will only take a moment.
|
6 |
+
Once you have a registered account, please follow these steps:
|
7 |
+
1. Log in to your Shoppimon Account
|
8 |
+
2. Go to the API Tab in your Shoppimon Account Settings
|
9 |
+
3. Click on the Generate API Key button
|
10 |
+
4. Copy the API Keys (both Client ID and Client Secret)
|
11 |
+
5. Log in to your Magento Admin Panel
|
12 |
+
6. From your Magento Admin Panel Menu select System and Configuration.
|
13 |
+
7. Find the Shoppimon tab and paste the API keys
|
14 |
+
8. Once you’ve entered the API keys. Go to System and Cache Management, then press the ‘Flush Magento Cache’ button
|
15 |
+
9. Log out from your Magento Admin Panel and log back in
|
16 |
+
10. Shoppimon should now appear in your admin panel menu
|
17 |
+
11. Hover over Shoppimon and select Business Monitoring to see your new dashboard
|
18 |
+
|
19 |
+
If you’d like any additional information, or if you have any questions, feel free to contact us at support@shoppimon.com.
|
20 |
+
|
21 |
+
=================================================
|
22 |
+
Do I have to add the dashboard to my Magento Admin, or is it possible to use the extension only to pull additional real-time data and insights into my Shoppimon account?
|
23 |
+
|
24 |
+
Yes, it is absolutely possible. If you wish to use the extension only to pull additional real-time data into your Shoppimon account, without adding another dashboard to your Magento admin, just follow these steps:
|
25 |
+
1. Go to your Magento Database
|
26 |
+
2. In the core_configure_data table, identify the field where the "path" column is equal to ‘shoppimon/settings/show_dashboard’
|
27 |
+
3. You can then change the "value" of that field 1 to 0, where 1 shows the dashboard in your Magento admin, and 0 means data will be pulled to your Shoppimon account, without adding the dashboard
|
28 |
+
|
29 |
+
If you’d like any additional information, or if you have any questions, feel free to contact us at support@shoppimon.com.
|