Version Notes
- Solve certificate issue to send notification
Download this release
Release Info
Developer | Biztech |
Extension | magento_mobile_assistant_manager |
Version | 0.2.4 |
Comparing to | |
See all releases |
Code changes from version 0.2.3 to 0.2.4
- MageMobAdmin.pdf +0 -0
- app/code/local/Biztech/Authentication/controllers/IndexController.php +1 -1
- app/code/local/Biztech/Authentication/controllers/IndexController_10-3-2016.php +199 -0
- app/code/local/Biztech/Mobileassistant/Block/Adminhtml/Config/Form/Renderer/Website.php +39 -0
- app/code/local/Biztech/Mobileassistant/Block/Adminhtml/Enabledisable.php +32 -0
- app/code/local/Biztech/Mobileassistant/Block/Config/Baseurl.php +14 -0
- app/code/local/Biztech/Mobileassistant/Helper/Data.php +304 -164
- app/code/local/Biztech/Mobileassistant/Model/Observer.php +25 -4
- app/code/local/Biztech/Mobileassistant/Model/System/Config/Notification.php +4 -0
- app/code/local/Biztech/Mobileassistant/Model/System/Config/Notification_30-1-2016.php +23 -0
- app/code/local/Biztech/Mobileassistant/controllers/CustomerController.php +1 -1
- app/code/local/Biztech/Mobileassistant/controllers/DashboardController.php +25 -1
- app/code/local/Biztech/Mobileassistant/controllers/IndexController.php +170 -184
- app/code/local/Biztech/Mobileassistant/controllers/OrderController.php +4 -1
- app/code/local/Biztech/Mobileassistant/controllers/ProductController.php +360 -363
- app/code/local/Biztech/Mobileassistant/etc/config.xml +25 -6
- app/code/local/Biztech/Mobileassistant/etc/system.xml +51 -2
- app/design/adminhtml/default/default/template/mobileassistant/system/config/barcode.phtml +1 -1
- package.xml +5 -5
MageMobAdmin.pdf
DELETED
Binary file
|
app/code/local/Biztech/Authentication/controllers/IndexController.php
CHANGED
@@ -162,7 +162,7 @@ class Biztech_Authentication_IndexController extends Mage_Core_Controller_Front_
|
|
162 |
$currency_code = Mage::getModel('core/store')->load($storeId)->getCurrentCurrencyCode();
|
163 |
|
164 |
$isPos = 0;
|
165 |
-
$resultArr = array('logo' => $logo, 'currency_symbol' => Mage::app()->getLocale()->currency($currency_code)->getSymbol(), 'is_pos' => $isPos, '
|
166 |
$result = Mage::helper('core')->jsonEncode($resultArr);
|
167 |
return Mage::app()->getResponse()->setBody($result);
|
168 |
}
|
162 |
$currency_code = Mage::getModel('core/store')->load($storeId)->getCurrentCurrencyCode();
|
163 |
|
164 |
$isPos = 0;
|
165 |
+
$resultArr = array('logo' => $logo, 'currency_symbol' => Mage::app()->getLocale()->currency($currency_code)->getSymbol(), 'is_pos' => $isPos, 'is_Mobileassistantpro' => 1);
|
166 |
$result = Mage::helper('core')->jsonEncode($resultArr);
|
167 |
return Mage::app()->getResponse()->setBody($result);
|
168 |
}
|
app/code/local/Biztech/Authentication/controllers/IndexController_10-3-2016.php
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_Authentication_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
if (Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')) {
|
7 |
+
|
8 |
+
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
9 |
+
$validate_url = false;
|
10 |
+
if ($isSecure) {
|
11 |
+
if (Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) {
|
12 |
+
$validate_url = true;
|
13 |
+
}
|
14 |
+
} else {
|
15 |
+
if (Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) {
|
16 |
+
$validate_url = true;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
if ($validate_url) {
|
21 |
+
|
22 |
+
$details = Mage::app()->getRequest()->getParams();
|
23 |
+
|
24 |
+
$username = $details['userapi'];
|
25 |
+
$password = $details['keyapi'];
|
26 |
+
$deviceToken = $details['token'];
|
27 |
+
$flag = $details['notification_flag'];
|
28 |
+
$device_type = $details['device_type'];
|
29 |
+
|
30 |
+
Mage::register('isSecureArea', true);
|
31 |
+
|
32 |
+
$config = Mage::getStoreConfigFlag('admin/security/use_case_sensitive_login');
|
33 |
+
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
|
34 |
+
$user = Mage::getModel('admin/user')->loadByUsername($username);
|
35 |
+
|
36 |
+
$sensitive = ($config) ? $username == $user->getUsername() : true;
|
37 |
+
|
38 |
+
if ($sensitive && $user->getId() && Mage::helper('core')->validateHash($password, $user->getPassword())) {
|
39 |
+
if ($user->getIsActive() != '1') {
|
40 |
+
$result['error'] = Mage::helper('adminhtml')->__('This account is inactive.');
|
41 |
+
}
|
42 |
+
if (!$user->hasAssigned2Role($user->getId())) {
|
43 |
+
$result['error'] = Mage::helper('adminhtml')->__('Access denied.');
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
$result['error'] = $this->__('Invalid User Name or Password.');
|
47 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
48 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
49 |
+
}
|
50 |
+
if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
|
51 |
+
Mage::getSingleton('adminhtml/url')->renewSecretUrls();
|
52 |
+
}
|
53 |
+
$session = Mage::getSingleton('admin/session');
|
54 |
+
|
55 |
+
$session->setIsFirstVisit(true);
|
56 |
+
$session->setUser($user);
|
57 |
+
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
|
58 |
+
$session_id = $user->getId() . '_' . md5($username);
|
59 |
+
|
60 |
+
Mage::dispatchEvent('admin_session_user_login_success', array('user' => $user));
|
61 |
+
|
62 |
+
Mage::unregister('isSecureArea');
|
63 |
+
|
64 |
+
if ($session_id) {
|
65 |
+
$data = array('username' => $username, 'password' => $user->getPassword(), 'devicetoken' => $deviceToken, 'session_id' => $session_id, 'notification_flag' => $flag, 'device_type' => $device_type, 'is_logout' => 0);
|
66 |
+
$result = Mage::helper('mobileassistant')->create($data);
|
67 |
+
|
68 |
+
|
69 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
70 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
$result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store). Please check & if issue persists, Contact our Support Team.');
|
74 |
+
}
|
75 |
+
} else {
|
76 |
+
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
|
77 |
+
}
|
78 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
79 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
80 |
+
}
|
81 |
+
|
82 |
+
public function testModuleAction() {
|
83 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
84 |
+
$url = $post_data['magento_url'];
|
85 |
+
$url_info = parse_url($url);
|
86 |
+
|
87 |
+
if (Mage::getConfig()->getModuleConfig('Biztech_Mobileassistant')->is('active', 'true') && Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')) {
|
88 |
+
|
89 |
+
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
90 |
+
$validate_url = false;
|
91 |
+
if ($isSecure) {
|
92 |
+
if (Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) {
|
93 |
+
$validate_url = true;
|
94 |
+
}
|
95 |
+
|
96 |
+
if ($url_info['scheme'] == 'http') {
|
97 |
+
$result['error'] = $this->__('It seems you use secure url for your store. So please use "https". ');
|
98 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
99 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
100 |
+
}
|
101 |
+
} else {
|
102 |
+
if (Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) {
|
103 |
+
$validate_url = true;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
if ($validate_url) {
|
107 |
+
|
108 |
+
$is_index = Mage::getStoreConfig('web/seo/use_rewrites');
|
109 |
+
if (!$is_index && basename($url) != 'index.php') {
|
110 |
+
$result['error'] = $this->__('Please add "index.php" after your url.');
|
111 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
112 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
113 |
+
}
|
114 |
+
|
115 |
+
$result['success'] = $this->__('Hurray! The connection with the Magento Site worked out fine & you can start using the App.');
|
116 |
+
} else {
|
117 |
+
$result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store). Please check & if issue persists, Contact our Support Team.');
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
|
121 |
+
}
|
122 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
123 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
124 |
+
}
|
125 |
+
|
126 |
+
public function changeSettingsAction() {
|
127 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
128 |
+
$user = $post_data['userapi'];
|
129 |
+
$deviceToken = $post_data['token'];
|
130 |
+
$flag = $post_data['notification_flag'];
|
131 |
+
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()->addFieldToFilter('username', Array('eq' => $user))->addFieldToFilter('device_token', Array('eq' => $deviceToken));
|
132 |
+
$count = count($collections);
|
133 |
+
|
134 |
+
foreach ($collections as $user) {
|
135 |
+
$user_id = $user->getUserId();
|
136 |
+
}
|
137 |
+
if ($count == 1) {
|
138 |
+
try {
|
139 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
140 |
+
$connection->beginTransaction();
|
141 |
+
$fields = array();
|
142 |
+
$fields['notification_flag'] = $flag;
|
143 |
+
$where = $connection->quoteInto('user_id =?', $user_id);
|
144 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
145 |
+
$connection->update($prefix . 'mobileassistant', $fields, $where);
|
146 |
+
$connection->commit();
|
147 |
+
} catch (Exception $e) {
|
148 |
+
return $e->getMessage();
|
149 |
+
}
|
150 |
+
$successArr[] = array('success_msg' => 'Settings updated sucessfully');
|
151 |
+
$result = Mage::helper('core')->jsonEncode($successArr);
|
152 |
+
return Mage::app()->getResponse()->setBody($result);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
public function getLogoAndCurrencyAction() {
|
157 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
158 |
+
$storeId = $post_data['storeid'];
|
159 |
+
$block = new Mage_Page_Block_Html_Header();
|
160 |
+
$logo = $block->getLogoSrc();
|
161 |
+
|
162 |
+
$currency_code = Mage::getModel('core/store')->load($storeId)->getCurrentCurrencyCode();
|
163 |
+
|
164 |
+
$isPos = 0;
|
165 |
+
$resultArr = array('logo' => $logo, 'currency_symbol' => Mage::app()->getLocale()->currency($currency_code)->getSymbol(), 'is_pos' => $isPos, 'is_inventory'=>1);
|
166 |
+
$result = Mage::helper('core')->jsonEncode($resultArr);
|
167 |
+
return Mage::app()->getResponse()->setBody($result);
|
168 |
+
}
|
169 |
+
|
170 |
+
public function logoutAction() {
|
171 |
+
|
172 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
173 |
+
$user = $post_data['userapi'];
|
174 |
+
$deviceToken = $post_data['token'];
|
175 |
+
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()->addFieldToFilter('device_token', Array('eq' => $deviceToken));
|
176 |
+
$count = count($collections);
|
177 |
+
|
178 |
+
foreach ($collections as $user) {
|
179 |
+
$device_token = $user->getDeviceToken();
|
180 |
+
|
181 |
+
try {
|
182 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
183 |
+
$connection->beginTransaction();
|
184 |
+
$fields = array();
|
185 |
+
$fields['is_logout'] = 1;
|
186 |
+
$where = $connection->quoteInto('device_token =?', $device_token);
|
187 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
188 |
+
$connection->update($prefix . 'mobileassistant', $fields, $where);
|
189 |
+
$connection->commit();
|
190 |
+
} catch (Exception $e) {
|
191 |
+
return $e->getMessage();
|
192 |
+
}
|
193 |
+
$successArr[] = array('success_msg' => 'User logout successfully.');
|
194 |
+
$result = Mage::helper('core')->jsonEncode($successArr);
|
195 |
+
return Mage::app()->getResponse()->setBody($result);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
app/code/local/Biztech/Mobileassistant/Block/Adminhtml/Config/Form/Renderer/Website.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Biztech_Mobileassistant_Block_Adminhtml_Config_Form_Renderer_Website extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
$html = '';
|
7 |
+
$data = Mage::getStoreConfig('mobileassistant/activation/data');
|
8 |
+
$ele_value = explode(',', str_replace($data, '', Mage::helper('core')->decrypt($element->getValue())));
|
9 |
+
$ele_name = $element->getName();
|
10 |
+
$ele_id = $element->getId();
|
11 |
+
$element->setName($ele_name . '[]');
|
12 |
+
$data_info = Mage::helper('mobileassistant')->getDataInfo();
|
13 |
+
if(isset($data_info['dom']) && intval($data_info['c']) > 0 && intval($data_info['suc']) == 1){
|
14 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
15 |
+
$url = $website->getConfig('web/unsecure/base_url');
|
16 |
+
$url = Mage::helper('mobileassistant')->getFormatUrl(trim(preg_replace('/^.*?\/\/(.*)?\//', '$1', $url)));
|
17 |
+
foreach($data_info['dom'] as $web){
|
18 |
+
if($web['dom'] == $url && $web['suc'] == 1) {
|
19 |
+
$element->setChecked(false);
|
20 |
+
$id = $website->getId();
|
21 |
+
|
22 |
+
$name = $website->getName();
|
23 |
+
$element->setId($ele_id.'_'.$id);
|
24 |
+
$element->setValue($id);
|
25 |
+
if(in_array($id, $ele_value) !== false){
|
26 |
+
$element->setChecked(true);
|
27 |
+
}
|
28 |
+
if ($id!=0) {
|
29 |
+
$html .= '<div><label>'.$element->getElementHtml().' '.$name.' </label></div>';
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}else{
|
35 |
+
$html = sprintf('<strong class="required">%s</strong>', $this->__('Please enter a valid key'));
|
36 |
+
}
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
app/code/local/Biztech/Mobileassistant/Block/Adminhtml/Enabledisable.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_Mobileassistant_Block_Adminhtml_Enabledisable extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
6 |
+
$websites = Mage::helper('mobileassistant')->getAllWebsites();
|
7 |
+
if (!empty($websites)) {
|
8 |
+
$website_id = $this->getRequest()->getParam('website');
|
9 |
+
$website = Mage::getModel('core/website')->load($website_id, 'code');
|
10 |
+
if ($website && in_array($website->getWebsiteId(), $websites)) {
|
11 |
+
$html = $element->getElementHtml();
|
12 |
+
} elseif (!$website_id) {
|
13 |
+
$html = $element->getElementHtml();
|
14 |
+
} else {
|
15 |
+
$html = '<strong class="required">' . $this->__('Please buy additional domains') . '</strong>';
|
16 |
+
}
|
17 |
+
} else {
|
18 |
+
$websitecode = Mage::app()->getRequest()->getParam('website');
|
19 |
+
$websiteId = Mage::getModel('core/store')->load($websitecode)->getWebsiteId;
|
20 |
+
$isenabled = Mage::app()->getWebsite($websiteId)->getConfig('mobileassistant/activation/key');
|
21 |
+
if ($isenabled != null || $isenabled != '') {
|
22 |
+
$html = '<strong class="required">' . $this->__(' Please select a website') . '</strong>';
|
23 |
+
$modulestatus = new Mage_Core_Model_Config();
|
24 |
+
$modulestatus->saveConfig('mobileassistant/mobileassistant_general/enabled', 0);
|
25 |
+
} else {
|
26 |
+
$html = '<strong class="required">' . $this->__('Please enter a valid key') . '</strong>';
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return $html;
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/local/Biztech/Mobileassistant/Block/Config/Baseurl.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Biztech_Mobileassistant_Block_Config_Baseurl extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
}
|
9 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
10 |
+
{
|
11 |
+
return Mage::getBaseUrl();
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/local/Biztech/Mobileassistant/Helper/Data.php
CHANGED
@@ -1,196 +1,336 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
if($count == 0){
|
15 |
Mage::getModel("mobileassistant/mobileassistant")
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$flag = $user->getNotificationFlag();
|
28 |
-
}
|
29 |
-
if($flag != $data['notification_flag'] || $data['is_logout'] != 1){
|
30 |
-
try {
|
31 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
32 |
-
$connection->beginTransaction();
|
33 |
-
$fields = array();
|
34 |
-
$fields['notification_flag'] = $data['notification_flag'];
|
35 |
-
$fields['is_logout'] = $data['is_logout'];
|
36 |
-
$where = $connection->quoteInto('user_id =?', $user_id);
|
37 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
38 |
-
$connection->update($prefix.'mobileassistant', $fields, $where);
|
39 |
-
$connection->commit();
|
40 |
-
} catch (Exception $e){
|
41 |
-
return $e->getMessage();
|
42 |
-
}
|
43 |
-
}
|
44 |
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
56 |
}
|
57 |
}
|
58 |
-
$isPos = 0;
|
59 |
-
$result = array('success' => $successArr,'stores' => $storeArr,'is_pos' => $isPos);
|
60 |
-
return $result;
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
$
|
69 |
-
|
70 |
-
|
|
|
|
|
71 |
}
|
72 |
-
$price = strip_tags(Mage::app()->getLocale()->currency($currencyCode)->toCurrency($this->getPriceFormat($price)));
|
73 |
-
return $price;
|
74 |
-
}
|
75 |
-
|
76 |
-
public function getPriceFormat($price)
|
77 |
-
{
|
78 |
-
$price = sprintf("%01.2f", $price);
|
79 |
-
return $price;
|
80 |
}
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
$
|
86 |
-
$
|
87 |
-
|
88 |
-
|
89 |
}
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
$updated_date = date("Y-m-d H:i:s", $timestamp);
|
96 |
-
return $updated_date;
|
97 |
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
|
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
}else if($notification_type == 'order'){
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
$apnsCert = Mage::getBaseDir('lib'). DS. "mobileassistant".DS."pushcert.pem";
|
135 |
-
$ctx = stream_context_create();
|
136 |
-
stream_context_set_option($ctx, 'ssl', 'local_cert', $apnsCert);
|
137 |
-
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
|
138 |
-
$flags = STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT;
|
139 |
-
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err,$errstr, 60, $flags, $ctx);
|
140 |
-
|
141 |
-
foreach($collections as $collection){
|
142 |
-
$deviceType = $collection->getDeviceType();
|
143 |
-
|
144 |
-
if($deviceType == 'ios'){
|
145 |
-
if ($fp){
|
146 |
-
|
147 |
-
$deviceToken = $collection->getDeviceToken();
|
148 |
-
$body['aps'] = array(
|
149 |
-
'alert' => $message,
|
150 |
-
'sound' => 'default',
|
151 |
-
'entity_id' => $entity_id,
|
152 |
-
'type' => $notification_type
|
153 |
-
);
|
154 |
-
|
155 |
-
$payload = json_encode($body);
|
156 |
-
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
|
157 |
-
$result = fwrite($fp, $msg, strlen($msg));
|
158 |
|
159 |
-
|
|
|
160 |
|
161 |
-
|
162 |
-
{
|
163 |
|
164 |
$deviceToken = $collection->getDeviceToken();
|
165 |
-
$
|
166 |
-
|
167 |
-
'
|
168 |
'entity_id' => $entity_id,
|
169 |
-
'type'
|
170 |
);
|
171 |
|
172 |
-
$
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$
|
190 |
-
curl_close( $ch );
|
191 |
}
|
192 |
}
|
193 |
-
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
+
class Biztech_Mobileassistant_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
public function create($data) {
|
6 |
+
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()
|
7 |
+
->addFieldToFilter('username', Array('eq' => $data['username']))
|
8 |
+
->addFieldToFilter('password', Array('eq' => $data['password']))
|
9 |
+
->addFieldToFilter('device_token', Array('eq' => $data['devicetoken']));
|
10 |
+
$count = count($collections);
|
11 |
+
|
12 |
+
|
13 |
+
if ($count == 0) {
|
|
|
14 |
Mage::getModel("mobileassistant/mobileassistant")
|
15 |
+
->setUsername($data['username'])
|
16 |
+
->setPassword($data['password'])
|
17 |
+
->setDeviceToken($data['devicetoken'])
|
18 |
+
->setDeviceType($data['device_type'])
|
19 |
+
->setNotificationFlag($data['notification_flag'])
|
20 |
+
->save();
|
21 |
+
}
|
22 |
+
if ($count == 1) {
|
23 |
+
foreach ($collections as $user) {
|
24 |
+
$user_id = $user->getUserId();
|
25 |
+
$flag = $user->getNotificationFlag();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
+
if ($flag != $data['notification_flag'] || $data['is_logout'] != 1) {
|
28 |
+
try {
|
29 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
30 |
+
$connection->beginTransaction();
|
31 |
+
$fields = array();
|
32 |
+
$fields['notification_flag'] = $data['notification_flag'];
|
33 |
+
$fields['is_logout'] = $data['is_logout'];
|
34 |
+
$where = $connection->quoteInto('user_id =?', $user_id);
|
35 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
36 |
+
$connection->update($prefix . 'mobileassistant', $fields, $where);
|
37 |
+
$connection->commit();
|
38 |
+
} catch (Exception $e) {
|
39 |
+
return $e->getMessage();
|
40 |
}
|
41 |
}
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
+
$successArr[] = array('success_msg' => 'Login sucessfully', 'session_id' => $data['session_id']);
|
45 |
+
|
46 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
47 |
+
foreach ($website->getGroups() as $group) {
|
48 |
+
$stores = $group->getStores();
|
49 |
+
foreach ($stores as $store) {
|
50 |
+
$storeArr[] = array('id' => $store->getId(),
|
51 |
+
'name' => $store->getName()
|
52 |
+
);
|
53 |
+
}
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
+
$isPos = 0;
|
57 |
+
$result = array('success' => $successArr, 'stores' => $storeArr, 'is_pos' => $isPos, 'is_Mobileassistantpro' => 1);
|
58 |
+
return $result;
|
59 |
+
}
|
60 |
|
61 |
+
public function getPrice($price, $storeId, $order_currency) {
|
62 |
+
$currencyCode = $order_currency;
|
63 |
+
if ($order_currency == null) {
|
64 |
+
$store = Mage::getModel('core/store')->load($storeId);
|
65 |
+
$price = $store->roundPrice($store->convertPrice($price));
|
66 |
+
$currencyCode = Mage::app()->getStore($storeId)->getCurrentCurrencyCode();
|
|
|
67 |
}
|
68 |
+
$price = strip_tags(Mage::app()->getLocale()->currency($currencyCode)->toCurrency($this->getPriceFormat($price)));
|
69 |
+
return $price;
|
70 |
+
}
|
71 |
|
72 |
+
public function getPriceFormat($price) {
|
73 |
+
$price = sprintf("%01.2f", $price);
|
74 |
+
return $price;
|
75 |
+
}
|
|
|
|
|
76 |
|
77 |
+
public function getActualDate($updated_date) {
|
78 |
+
$date = Mage::app()->getLocale()->date(strtotime($updated_date));
|
79 |
+
$timestamp = $date->get(Zend_Date::TIMESTAMP) - $date->get(Zend_Date::TIMEZONE_SECS);
|
80 |
+
$updated_date = date("Y-m-d H:i:s", $timestamp);
|
81 |
+
return $updated_date;
|
82 |
+
}
|
83 |
|
84 |
+
public function getActualOrderDate($updated_date) {
|
85 |
+
$date = Mage::app()->getLocale()->date(strtotime($updated_date));
|
86 |
+
$timestamp = $date->get(Zend_Date::TIMESTAMP) + $date->get(Zend_Date::TIMEZONE_SECS);
|
87 |
+
$updated_date = date("Y-m-d H:i:s", $timestamp);
|
88 |
+
return $updated_date;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function isEnable() {
|
92 |
+
$websiteId = Mage::app()->getWebsite()->getId();
|
93 |
+
$isenabled = Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled');
|
94 |
+
if ($isenabled) {
|
95 |
+
if ($websiteId) {
|
96 |
+
$websites = $this->getAllWebsites();
|
97 |
+
$key = Mage::getStoreConfig('mobileassistant/activation/key');
|
98 |
+
if ($key == null || $key == '') {
|
99 |
+
return false;
|
100 |
+
} else {
|
101 |
+
$en = Mage::getStoreConfig('mobileassistant/activation/en');
|
102 |
+
if ($isenabled && $en && in_array($websiteId, $websites)) {
|
103 |
+
return true;
|
104 |
+
} else {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
} else {
|
109 |
+
$en = Mage::getStoreConfig('mobileassistant/activation/en');
|
110 |
+
if ($isenabled && $en) {
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
}
|
114 |
}
|
115 |
+
}
|
116 |
|
117 |
+
public function pushNotification($notification_type, $entity_id, $params = NULL) {
|
118 |
+
$google_api_key = 'AIzaSyAZPkT165oPcjfhUmgJnt5Lcs2OInBFJmE';
|
119 |
+
$passphrase = 'push2magento';
|
120 |
+
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()->addFieldToFilter('notification_flag', Array('eq' => 1))->addFieldToFilter('is_logout', Array('eq' => 0));
|
121 |
|
122 |
+
if ($notification_type == 'customer') {
|
123 |
+
$message = Mage::getStoreConfig('mobileassistant/mobileassistant_general/customer_register_notification_msg');
|
124 |
+
if ($message == null) {
|
125 |
+
$message = Mage::helper('mobileassistant')->__('A New customer has been registered on the Store.');
|
126 |
+
}
|
127 |
+
} else if ($notification_type == 'order') {
|
|
|
128 |
|
129 |
+
$order = Mage::getModel('sales/order')->load($entity_id);
|
130 |
+
$msgString = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification_msg');
|
131 |
+
if ($msgString == null) {
|
132 |
+
$msgString = Mage::helper('mobileassistant')->__('A New order has been received on the Store.');
|
133 |
+
}
|
134 |
+
$message = $msgString . "\nOrder Id: " . $order->getIncrementId() . "\nGrand Total: " . $this->getPrice($order->getGrandTotal(), $order->getStoreId(), $order->getOrderCurrencyCode());
|
135 |
+
} else if ($notification_type == 'product') {
|
136 |
+
$msgString = Mage::getStoreConfig('mobileassistant/mobileassistant_general/product_inventory_notification_msg');
|
137 |
+
if ($msgString == null) {
|
138 |
+
$msgString = Mage::helper('mobileassistant')->__('Product Stock Alert');
|
139 |
+
}
|
140 |
+
$message = $msgString . "\nName: " . $params['name'] . "\nCurrent Qty: " . $params['qty'];
|
141 |
+
} else if ($notification_type == 'review') {
|
142 |
+
$message = Mage::getStoreConfig('mobileassistant/mobileassistant_general/product_review_notification_msg');
|
143 |
+
if ($message == null) {
|
144 |
+
$message = Mage::helper('mobileassistant')->__('A New Review has been added on the store');
|
145 |
+
}
|
146 |
+
}
|
147 |
|
148 |
+
$apnsCert = Mage::getBaseDir('lib') . DS . "mobileassistant" . DS . "pushcert.pem";
|
149 |
+
$ctx = stream_context_create();
|
150 |
+
stream_context_set_option($ctx, 'ssl', 'local_cert', $apnsCert);
|
151 |
+
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
|
152 |
+
$flags = STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT;
|
153 |
+
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, $flags, $ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
foreach ($collections as $collection) {
|
156 |
+
$deviceType = $collection->getDeviceType();
|
157 |
|
158 |
+
if ($deviceType == 'ios') {
|
159 |
+
if ($fp) {
|
160 |
|
161 |
$deviceToken = $collection->getDeviceToken();
|
162 |
+
$body['aps'] = array(
|
163 |
+
'alert' => $message,
|
164 |
+
'sound' => 'default',
|
165 |
'entity_id' => $entity_id,
|
166 |
+
'type' => $notification_type
|
167 |
);
|
168 |
|
169 |
+
$payload = json_encode($body);
|
170 |
+
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
|
171 |
+
$result = fwrite($fp, $msg, strlen($msg));
|
172 |
+
}
|
173 |
+
} elseif ($deviceType == 'android') {
|
174 |
|
175 |
+
$deviceToken = $collection->getDeviceToken();
|
176 |
+
$registrationIds = array($deviceToken);
|
177 |
+
$msg_a = array(
|
178 |
+
'message' => $message,
|
179 |
+
'entity_id' => $entity_id,
|
180 |
+
'type' => $notification_type
|
181 |
+
);
|
182 |
+
|
183 |
+
$fields = array(
|
184 |
+
'registration_ids' => $registrationIds,
|
185 |
+
'data' => $msg_a
|
186 |
+
);
|
187 |
+
|
188 |
+
$headers = array(
|
189 |
+
'Authorization: key=' . $google_api_key,
|
190 |
+
'Content-Type: application/json'
|
191 |
+
);
|
192 |
+
|
193 |
+
$ch = curl_init();
|
194 |
+
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
|
195 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
196 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
197 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
198 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
199 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
|
200 |
+
$result = curl_exec($ch);
|
201 |
+
curl_close($ch);
|
202 |
+
}
|
203 |
+
}
|
204 |
+
fclose($fp);
|
205 |
+
return true;
|
206 |
+
}
|
207 |
+
|
208 |
+
public function checkKey($k, $s = '') {
|
209 |
+
$ch = curl_init();
|
210 |
+
curl_setopt($ch, CURLOPT_URL, sprintf('http://store.biztechconsultancy.com/extension/licence.php'));
|
211 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
212 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, 'key=' . urlencode($k) . '&domains=' . urlencode(implode(',', $this->getAllStoreDomains())) . '&sec=mobileassistant');
|
213 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
214 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
215 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
216 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
217 |
+
$content = curl_exec($ch);
|
218 |
+
$res = Zend_Json::decode($content);
|
219 |
+
$modulestatus = new Mage_Core_Model_Config();
|
220 |
+
$enc = Mage::helper('core');
|
221 |
+
if (empty($res)) {
|
222 |
+
$modulestatus->saveConfig('mobileassistant/activation/key', "");
|
223 |
+
$modulestatus->saveConfig('mobileassistant/mobileassistant_general/enabled', 0);
|
224 |
+
$data = Mage::getStoreConfig('mobileassistant/activation/data');
|
225 |
+
$groups = array(
|
226 |
+
'activation' => array(
|
227 |
+
'fields' => array(
|
228 |
+
'data' => array(
|
229 |
+
'value' => $data
|
230 |
+
),
|
231 |
+
'websites' => array(
|
232 |
+
'value' => ''
|
233 |
+
)
|
234 |
+
)
|
235 |
+
)
|
236 |
+
);
|
237 |
+
Mage::getModel('adminhtml/config_data')
|
238 |
+
->setSection('mobileassistant')
|
239 |
+
->setGroups($groups)
|
240 |
+
->save();
|
241 |
+
Mage::getConfig()->reinit();
|
242 |
+
Mage::app()->reinitStores();
|
243 |
+
return;
|
244 |
+
}
|
245 |
+
$data = '';
|
246 |
+
$web = '';
|
247 |
+
$en = '';
|
248 |
|
249 |
+
if (isset($res['dom']) && intval($res['c']) > 0 && intval($res['suc']) == 1) {
|
250 |
+
$data = $enc->encrypt(base64_encode(Zend_Json::encode($res)));
|
251 |
+
if (!$s) {
|
252 |
+
$params = Mage::app()->getRequest()->getParam('groups');
|
253 |
+
if (isset($params['activation']['fields']['websites']['value'])) {
|
254 |
+
$s = $params['activation']['fields']['websites']['value'];
|
255 |
+
} else if (Mage::app()->getRequest()->getParam('website')) {
|
256 |
+
$s = explode(',', str_replace($data, '', Mage::helper('core')->decrypt(Mage::getStoreConfig('mobileassistant/activation/websites'))));
|
|
|
257 |
}
|
258 |
}
|
259 |
+
$en = $res['suc'];
|
260 |
+
if (isset($s) && $s != null) {
|
261 |
+
$web = $enc->encrypt($data . implode(',', $s) . $data);
|
262 |
+
} else {
|
263 |
+
$web = $enc->encrypt($data . $data);
|
264 |
+
}
|
265 |
+
} else {
|
266 |
+
$modulestatus->saveConfig('mobileassistant/activation/key', "");
|
267 |
+
$modulestatus->saveConfig('mobileassistant/mobileassistant_general/enabled', 0);
|
268 |
+
}
|
269 |
+
$groups = array(
|
270 |
+
'activation' => array(
|
271 |
+
'fields' => array(
|
272 |
+
'data' => array(
|
273 |
+
'value' => $data
|
274 |
+
),
|
275 |
+
'websites' => array(
|
276 |
+
'value' => (string) $web
|
277 |
+
),
|
278 |
+
'en' => array(
|
279 |
+
'value' => $en
|
280 |
+
),
|
281 |
+
'installed' => array(
|
282 |
+
'value' => 1
|
283 |
+
)
|
284 |
+
)
|
285 |
+
)
|
286 |
+
);
|
287 |
+
Mage::getModel('adminhtml/config_data')
|
288 |
+
->setSection('mobileassistant')
|
289 |
+
->setGroups($groups)
|
290 |
+
->save();
|
291 |
+
Mage::getConfig()->reinit();
|
292 |
+
Mage::app()->reinitStores();
|
293 |
+
}
|
294 |
+
|
295 |
+
public function getDataInfo() {
|
296 |
+
$data = Mage::getStoreConfig('mobileassistant/activation/data');
|
297 |
+
return Zend_Json::decode(base64_decode(Mage::helper('core')->decrypt($data)));
|
298 |
+
}
|
299 |
+
|
300 |
+
public function getFormatUrl($url) {
|
301 |
+
$input = trim($url, '/');
|
302 |
+
if (!preg_match('#^http(s)?://#', $input)) {
|
303 |
+
$input = 'http://' . $input;
|
304 |
+
}
|
305 |
+
$urlParts = parse_url($input);
|
306 |
+
$domain = preg_replace('/^www\./', '', $urlParts['host'] . $urlParts['path']);
|
307 |
+
return $domain;
|
308 |
+
}
|
309 |
+
|
310 |
+
public function getAllStoreDomains() {
|
311 |
+
$domains = array();
|
312 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
313 |
+
$url = $website->getConfig('web/unsecure/base_url');
|
314 |
+
if ($domain = trim(preg_replace('/^.*?\/\/(.*)?\//', '$1', $url))) {
|
315 |
+
$domains[] = $domain;
|
316 |
+
}
|
317 |
+
$url = $website->getConfig('web/secure/base_url');
|
318 |
+
if ($domain = trim(preg_replace('/^.*?\/\/(.*)?\//', '$1', $url))) {
|
319 |
+
$domains[] = $domain;
|
320 |
+
}
|
321 |
}
|
322 |
+
return array_unique($domains);
|
323 |
+
}
|
324 |
+
|
325 |
+
public function getAllWebsites() {
|
326 |
+
if (!Mage::getStoreConfig('mobileassistant/activation/installed')) {
|
327 |
+
return array();
|
328 |
+
}
|
329 |
+
$data = Mage::getStoreConfig('mobileassistant/activation/data');
|
330 |
+
$web = Mage::getStoreConfig('mobileassistant/activation/websites');
|
331 |
+
$websites = explode(',', str_replace($data, '', Mage::helper('core')->decrypt($web)));
|
332 |
+
$websites = array_diff($websites, array(""));
|
333 |
+
return $websites;
|
334 |
+
}
|
335 |
+
|
336 |
+
}
|
app/code/local/Biztech/Mobileassistant/Model/Observer.php
CHANGED
@@ -5,6 +5,11 @@ class Biztech_Mobileassistant_Model_Observer {
|
|
5 |
private static $_handleCustomerFirstOrderCounter = 1;
|
6 |
private static $_handleCustomerFirstRegisterNotificationCounter = 1;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
/* inventory status-starts */
|
9 |
|
10 |
public function catalogInventorySave(Varien_Event_Observer $observer) {
|
@@ -81,7 +86,7 @@ class Biztech_Mobileassistant_Model_Observer {
|
|
81 |
return $this;
|
82 |
}
|
83 |
self::$_handleCustomerFirstOrderCounter++;
|
84 |
-
|
85 |
$data = array();
|
86 |
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
87 |
$statuses = explode(",", $data['status']);
|
@@ -114,7 +119,7 @@ class Biztech_Mobileassistant_Model_Observer {
|
|
114 |
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
115 |
$statuses = explode(",", $data['status']);
|
116 |
if (in_array('customer_notification', $statuses)) {
|
117 |
-
|
118 |
}
|
119 |
}
|
120 |
}
|
@@ -125,11 +130,27 @@ class Biztech_Mobileassistant_Model_Observer {
|
|
125 |
if ($customer) {
|
126 |
$customer_id = $customer->getId();
|
127 |
$data = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
129 |
$statuses = explode(",", $data['status']);
|
130 |
-
if (in_array('
|
131 |
-
$result = Mage::helper('mobileassistant')->pushNotification('
|
132 |
}
|
|
|
133 |
}
|
134 |
}
|
135 |
|
5 |
private static $_handleCustomerFirstOrderCounter = 1;
|
6 |
private static $_handleCustomerFirstRegisterNotificationCounter = 1;
|
7 |
|
8 |
+
public function checkKey($observer) {
|
9 |
+
$key = Mage::getStoreConfig('mobileassistant/activation/key');
|
10 |
+
Mage::helper('mobileassistant')->checkKey($key);
|
11 |
+
}
|
12 |
+
|
13 |
/* inventory status-starts */
|
14 |
|
15 |
public function catalogInventorySave(Varien_Event_Observer $observer) {
|
86 |
return $this;
|
87 |
}
|
88 |
self::$_handleCustomerFirstOrderCounter++;
|
89 |
+
|
90 |
$data = array();
|
91 |
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
92 |
$statuses = explode(",", $data['status']);
|
119 |
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
120 |
$statuses = explode(",", $data['status']);
|
121 |
if (in_array('customer_notification', $statuses)) {
|
122 |
+
$result = Mage::helper('mobileassistant')->pushNotification('customer', $customer_id);
|
123 |
}
|
124 |
}
|
125 |
}
|
130 |
if ($customer) {
|
131 |
$customer_id = $customer->getId();
|
132 |
$data = array();
|
133 |
+
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
134 |
+
$statuses = explode(",", $data['status']);
|
135 |
+
if (in_array('customer_notification', $statuses)) {
|
136 |
+
$result = Mage::helper('mobileassistant')->pushNotification('customer', $customer_id);
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
public function reviewNotification(Varien_Event_Observer $observer) {
|
142 |
+
$object = $observer->getEvent()->getObject();
|
143 |
+
$statusId = $object->getStatusId();
|
144 |
+
$action = Mage::app()->getFrontController()->getAction();
|
145 |
+
if ($action->getFullActionName() == 'review_product_post') {
|
146 |
+
if ($statusId) {
|
147 |
+
$data = array();
|
148 |
$data['status'] = Mage::getStoreConfig('mobileassistant/mobileassistant_general/notification');
|
149 |
$statuses = explode(",", $data['status']);
|
150 |
+
if (in_array('review_notification', $statuses)) {
|
151 |
+
$result = Mage::helper('mobileassistant')->pushNotification('review', $statusId);
|
152 |
}
|
153 |
+
}
|
154 |
}
|
155 |
}
|
156 |
|
app/code/local/Biztech/Mobileassistant/Model/System/Config/Notification.php
CHANGED
@@ -15,6 +15,10 @@ class Biztech_Mobileassistant_Model_System_Config_Notification {
|
|
15 |
array(
|
16 |
'value' => 'customer_notification',
|
17 |
'label' => 'Customer Notification',
|
|
|
|
|
|
|
|
|
18 |
));
|
19 |
|
20 |
return $optionArray;
|
15 |
array(
|
16 |
'value' => 'customer_notification',
|
17 |
'label' => 'Customer Notification',
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
'value' => 'review_notification',
|
21 |
+
'label' => 'Review Notification',
|
22 |
));
|
23 |
|
24 |
return $optionArray;
|
app/code/local/Biztech/Mobileassistant/Model/System/Config/Notification_30-1-2016.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_Mobileassistant_Model_System_Config_Notification {
|
4 |
+
|
5 |
+
public function toOptionArray() {
|
6 |
+
$optionArray = array(
|
7 |
+
array(
|
8 |
+
'value' => 'order_notification',
|
9 |
+
'label' => 'Order Notification',
|
10 |
+
),
|
11 |
+
array(
|
12 |
+
'value' => 'product_notification',
|
13 |
+
'label' => 'Product Notification',
|
14 |
+
),
|
15 |
+
array(
|
16 |
+
'value' => 'customer_notification',
|
17 |
+
'label' => 'Customer Notification',
|
18 |
+
));
|
19 |
+
|
20 |
+
return $optionArray;
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/local/Biztech/Mobileassistant/controllers/CustomerController.php
CHANGED
@@ -48,7 +48,7 @@ class Biztech_Mobileassistant_CustomerController extends Mage_Core_Controller_Fr
|
|
48 |
$min_fetch_customer = $post_data['min_fetch_customer'];
|
49 |
}
|
50 |
$last_updated = Mage::helper('mobileassistant')->getActualDate($post_data['last_updated']);
|
51 |
-
$customers->getSelect()->where("(e.entity_id BETWEEN '" . $min_fetch_customer . "'AND '" . $last_fetch_customer
|
52 |
}
|
53 |
|
54 |
$customers->getSelect()->limit($limit);
|
48 |
$min_fetch_customer = $post_data['min_fetch_customer'];
|
49 |
}
|
50 |
$last_updated = Mage::helper('mobileassistant')->getActualDate($post_data['last_updated']);
|
51 |
+
$customers->getSelect()->where("(e.entity_id BETWEEN '" . $min_fetch_customer . "'AND '" . $last_fetch_customer . "') OR e.entity_id >'" . $last_fetch_customer . "'");
|
52 |
}
|
53 |
|
54 |
$customers->getSelect()->limit($limit);
|
app/code/local/Biztech/Mobileassistant/controllers/DashboardController.php
CHANGED
@@ -152,7 +152,31 @@ class Biztech_Mobileassistant_DashboardController extends Mage_Core_Controller_F
|
|
152 |
$lifeTimeSales = strip_tags(Mage::app()->getLocale()->currency($baseCurrencyCode)->toCurrency(round(Mage::getResourceModel('reports/order_collection')->addFieldToFilter('store_id', $storeId)->calculateSales()->load()->getFirstItem()->getLifetime(), 2)));
|
153 |
$averageOrder = strip_tags(Mage::app()->getLocale()->currency($baseCurrencyCode)->toCurrency(round(Mage::getResourceModel('reports/order_collection')->addFieldToFilter('store_id', $storeId)->calculateSales()->load()->getFirstItem()->getAverage(), 2)));
|
154 |
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
$orderDashboardResult = Mage::helper('core')->jsonEncode($orderTotalResultArr);
|
157 |
return Mage::app()->getResponse()->setBody($orderDashboardResult);
|
158 |
} else {
|
152 |
$lifeTimeSales = strip_tags(Mage::app()->getLocale()->currency($baseCurrencyCode)->toCurrency(round(Mage::getResourceModel('reports/order_collection')->addFieldToFilter('store_id', $storeId)->calculateSales()->load()->getFirstItem()->getLifetime(), 2)));
|
153 |
$averageOrder = strip_tags(Mage::app()->getLocale()->currency($baseCurrencyCode)->toCurrency(round(Mage::getResourceModel('reports/order_collection')->addFieldToFilter('store_id', $storeId)->calculateSales()->load()->getFirstItem()->getAverage(), 2)));
|
154 |
|
155 |
+
if ($type_id == 7) {
|
156 |
+
$avg_order_count = $total_count / 7;
|
157 |
+
$avg_ordergrandtotal = (array_sum($orderTotalByDate)) / 7;
|
158 |
+
} elseif ($type_id == 30) {
|
159 |
+
$avg_order_count = $total_count / 30;
|
160 |
+
$avg_ordergrandtotal = (array_sum($orderTotalByDate)) / 30;
|
161 |
+
} elseif ($type_id == 90) {
|
162 |
+
$avg_order_count = $total_count / 90;
|
163 |
+
$avg_ordergrandtotal = (array_sum($orderTotalByDate)) / 90;
|
164 |
+
} else if ($type_id == 24) {
|
165 |
+
$avg_order_count = $total_count / 24;
|
166 |
+
$avg_ordergrandtotal = (array_sum($orderTotalByDate)) / 24;
|
167 |
+
} else if ($type_id == 'month') {
|
168 |
+
$avg_order_count = $total_count / count($dates);
|
169 |
+
$avg_ordergrandtotal = (array_sum($orderTotalByDate)) / count($dates);
|
170 |
+
} else if ($type_id == 'year') {
|
171 |
+
$avg_order_count = $total_count / count($months);
|
172 |
+
$avg_ordergrandtotal = (array_sum($orderTotalByDate)) / count($months);
|
173 |
+
}
|
174 |
+
|
175 |
+
$avg_order_count = number_format($avg_order_count, 2, '.', ',');
|
176 |
+
$avg_ordergrandtotal = strip_tags(Mage::app()->getLocale()->currency($baseCurrencyCode)->toCurrency($avg_ordergrandtotal));
|
177 |
+
|
178 |
+
|
179 |
+
$orderTotalResultArr = array('dashboard_result' => array('ordertotalbydate' => $orderTotalByDate, 'ordergrandtotal' => $orderGrandTotal, 'totalordercount' => $total_count, 'lifetimesales' => $lifeTimeSales, 'averageorder' => $averageOrder, 'avg_order_count' => $avg_order_count, 'avg_order_grandtotal' => $avg_ordergrandtotal));
|
180 |
$orderDashboardResult = Mage::helper('core')->jsonEncode($orderTotalResultArr);
|
181 |
return Mage::app()->getResponse()->setBody($orderDashboardResult);
|
182 |
} else {
|
app/code/local/Biztech/Mobileassistant/controllers/IndexController.php
CHANGED
@@ -1,213 +1,199 @@
|
|
1 |
<?php
|
2 |
-
class Biztech_Mobileassistant_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function indexAction()
|
5 |
-
{
|
6 |
-
if(Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')){
|
7 |
-
|
8 |
-
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
9 |
-
$validate_url = false;
|
10 |
-
if($isSecure)
|
11 |
-
{
|
12 |
-
if(Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')){
|
13 |
-
$validate_url = true;
|
14 |
-
}
|
15 |
-
}else
|
16 |
-
{
|
17 |
-
if(Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')){
|
18 |
-
$validate_url = true;
|
19 |
-
}
|
20 |
-
}
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
}
|
44 |
-
if (!$user->hasAssigned2Role($user->getId())) {
|
45 |
-
$result['error'] = Mage::helper('adminhtml')->__('Access denied.');
|
46 |
-
}
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
52 |
}
|
53 |
-
if (
|
54 |
-
Mage::
|
55 |
}
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
}
|
78 |
-
}else{
|
79 |
-
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
|
80 |
}
|
81 |
-
|
82 |
-
|
83 |
}
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
if($url_info['scheme'] == 'http')
|
103 |
-
{
|
104 |
-
$result['error'] = $this->__('It seems you use secure url for your store. So please use "https". ');
|
105 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
106 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
107 |
-
}
|
108 |
-
|
109 |
-
}else{
|
110 |
-
if(Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')){
|
111 |
-
$validate_url = true;
|
112 |
-
}
|
113 |
}
|
114 |
-
if($validate_url){
|
115 |
-
|
116 |
-
$is_index = Mage::getStoreConfig('web/seo/use_rewrites');
|
117 |
-
if(!$is_index && basename($url) != 'index.php')
|
118 |
-
{
|
119 |
-
$result['error'] = $this->__('Please add "index.php" after your url.');
|
120 |
-
$jsonData = Mage::helper('core')->jsonEncode($result);
|
121 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
122 |
-
}
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
$
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
-
}else{
|
129 |
-
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
|
130 |
}
|
131 |
-
|
132 |
-
return Mage::app()->getResponse()->setBody($jsonData);
|
133 |
-
}
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$flag = $post_data['notification_flag'];
|
141 |
-
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()->addFieldToFilter('username',Array('eq'=>$user))->addFieldToFilter('device_token',Array('eq'=>$deviceToken));
|
142 |
-
$count = count($collections);
|
143 |
-
|
144 |
-
foreach($collections as $user)
|
145 |
-
{
|
146 |
-
$user_id = $user->getUserId();
|
147 |
-
}
|
148 |
-
if($count == 1)
|
149 |
-
{
|
150 |
-
try {
|
151 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
152 |
-
$connection->beginTransaction();
|
153 |
-
$fields = array();
|
154 |
-
$fields['notification_flag'] = $flag;
|
155 |
-
$where = $connection->quoteInto('user_id =?', $user_id);
|
156 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
157 |
-
$connection->update($prefix.'mobileassistant', $fields, $where);
|
158 |
-
$connection->commit();
|
159 |
-
} catch (Exception $e){
|
160 |
-
return $e->getMessage();
|
161 |
}
|
162 |
-
|
163 |
-
$result
|
164 |
-
|
|
|
165 |
}
|
|
|
|
|
166 |
}
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
return Mage::app()->getResponse()->setBody($result);
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
class Biztech_Mobileassistant_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
|
5 |
+
public function indexAction() {
|
6 |
+
if (Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')) {
|
7 |
|
8 |
+
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
9 |
+
$validate_url = false;
|
10 |
+
if ($isSecure) {
|
11 |
+
if (Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) {
|
12 |
+
$validate_url = true;
|
13 |
+
}
|
14 |
+
} else {
|
15 |
+
if (Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) {
|
16 |
+
$validate_url = true;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
if ($validate_url) {
|
21 |
|
22 |
+
$details = Mage::app()->getRequest()->getParams();
|
23 |
|
24 |
+
$username = $details['userapi'];
|
25 |
+
$password = $details['keyapi'];
|
26 |
+
$deviceToken = $details['token'];
|
27 |
+
$flag = $details['notification_flag'];
|
28 |
+
$device_type = $details['device_type'];
|
29 |
|
30 |
+
Mage::register('isSecureArea', true);
|
31 |
|
32 |
+
$config = Mage::getStoreConfigFlag('admin/security/use_case_sensitive_login');
|
33 |
+
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
|
34 |
+
$user = Mage::getModel('admin/user')->loadByUsername($username);
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
$sensitive = ($config) ? $username == $user->getUsername() : true;
|
37 |
+
|
38 |
+
if ($sensitive && $user->getId() && Mage::helper('core')->validateHash($password, $user->getPassword())) {
|
39 |
+
if ($user->getIsActive() != '1') {
|
40 |
+
$result['error'] = Mage::helper('adminhtml')->__('This account is inactive.');
|
41 |
}
|
42 |
+
if (!$user->hasAssigned2Role($user->getId())) {
|
43 |
+
$result['error'] = Mage::helper('adminhtml')->__('Access denied.');
|
44 |
}
|
45 |
+
} else {
|
46 |
+
$result['error'] = $this->__('Invalid User Name or Password.');
|
47 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
48 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
49 |
+
}
|
50 |
+
if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
|
51 |
+
Mage::getSingleton('adminhtml/url')->renewSecretUrls();
|
52 |
+
}
|
53 |
+
$session = Mage::getSingleton('admin/session');
|
54 |
|
55 |
+
$session->setIsFirstVisit(true);
|
56 |
+
$session->setUser($user);
|
57 |
+
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
|
58 |
+
$session_id = $user->getId() . '_' . md5($username);
|
59 |
|
60 |
+
Mage::dispatchEvent('admin_session_user_login_success', array('user' => $user));
|
61 |
|
62 |
+
Mage::unregister('isSecureArea');
|
63 |
|
64 |
+
if ($session_id) {
|
65 |
+
$data = array('username' => $username, 'password' => $user->getPassword(), 'devicetoken' => $deviceToken, 'session_id' => $session_id, 'notification_flag' => $flag, 'device_type' => $device_type, 'is_logout' => 0);
|
66 |
+
$result = Mage::helper('mobileassistant')->create($data);
|
67 |
|
68 |
|
69 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
70 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
$result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store). Please check & if issue persists, Contact our Support Team.');
|
|
|
|
|
|
|
74 |
}
|
75 |
+
} else {
|
76 |
+
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
|
77 |
}
|
78 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
79 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
80 |
+
}
|
81 |
+
|
82 |
+
public function testModuleAction() {
|
83 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
84 |
+
$url = $post_data['magento_url'];
|
85 |
+
$url_info = parse_url($url);
|
86 |
+
|
87 |
+
if (Mage::getConfig()->getModuleConfig('Biztech_Mobileassistant')->is('active', 'true') && Mage::getStoreConfig('mobileassistant/mobileassistant_general/enabled')) {
|
88 |
+
|
89 |
+
$isSecure = Mage::app()->getFrontController()->getRequest()->isSecure();
|
90 |
+
$validate_url = false;
|
91 |
+
if ($isSecure) {
|
92 |
+
if (Mage::getStoreConfig('web/secure/base_url') == Mage::getStoreConfig('web/secure/base_link_url')) {
|
93 |
+
$validate_url = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
+
if ($url_info['scheme'] == 'http') {
|
97 |
+
$result['error'] = $this->__('It seems you use secure url for your store. So please use "https". ');
|
98 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
99 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
100 |
+
}
|
101 |
+
} else {
|
102 |
+
if (Mage::getStoreConfig('web/unsecure/base_url') == Mage::getStoreConfig('web/unsecure/base_link_url')) {
|
103 |
+
$validate_url = true;
|
104 |
}
|
|
|
|
|
105 |
}
|
106 |
+
if ($validate_url) {
|
|
|
|
|
107 |
|
108 |
+
$is_index = Mage::getStoreConfig('web/seo/use_rewrites');
|
109 |
+
if (!$is_index && basename($url) != 'index.php') {
|
110 |
+
$result['error'] = $this->__('Please add "index.php" after your url.');
|
111 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
112 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
+
|
115 |
+
$result['success'] = $this->__('Hurray! The connection with the Magento Site worked out fine & you can start using the App.');
|
116 |
+
} else {
|
117 |
+
$result['error'] = $this->__('There seems some difference between the Based URL & Magento Based URL(on the store). Please check & if issue persists, Contact our Support Team.');
|
118 |
}
|
119 |
+
} else {
|
120 |
+
$result['error'] = $this->__('Please activate the Mobile Assistant Extension on the Magento Store.');
|
121 |
}
|
122 |
+
$jsonData = Mage::helper('core')->jsonEncode($result);
|
123 |
+
return Mage::app()->getResponse()->setBody($jsonData);
|
124 |
+
}
|
125 |
+
|
126 |
+
public function changeSettingsAction() {
|
127 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
128 |
+
$user = $post_data['userapi'];
|
129 |
+
$deviceToken = $post_data['token'];
|
130 |
+
$flag = $post_data['notification_flag'];
|
131 |
+
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()->addFieldToFilter('username', Array('eq' => $user))->addFieldToFilter('device_token', Array('eq' => $deviceToken));
|
132 |
+
$count = count($collections);
|
133 |
+
|
134 |
+
foreach ($collections as $user) {
|
135 |
+
$user_id = $user->getUserId();
|
136 |
+
}
|
137 |
+
if ($count == 1) {
|
138 |
+
try {
|
139 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
140 |
+
$connection->beginTransaction();
|
141 |
+
$fields = array();
|
142 |
+
$fields['notification_flag'] = $flag;
|
143 |
+
$where = $connection->quoteInto('user_id =?', $user_id);
|
144 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
145 |
+
$connection->update($prefix . 'mobileassistant', $fields, $where);
|
146 |
+
$connection->commit();
|
147 |
+
} catch (Exception $e) {
|
148 |
+
return $e->getMessage();
|
149 |
+
}
|
150 |
+
$successArr[] = array('success_msg' => 'Settings updated sucessfully');
|
151 |
+
$result = Mage::helper('core')->jsonEncode($successArr);
|
152 |
return Mage::app()->getResponse()->setBody($result);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
public function getLogoAndCurrencyAction() {
|
157 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
158 |
+
$storeId = $post_data['storeid'];
|
159 |
+
$block = new Mage_Page_Block_Html_Header();
|
160 |
+
$logo = $block->getLogoSrc();
|
161 |
+
|
162 |
+
$currency_code = Mage::getModel('core/store')->load($storeId)->getCurrentCurrencyCode();
|
163 |
+
|
164 |
+
$isPos = 0;
|
165 |
+
$resultArr = array('logo' => $logo, 'currency_symbol' => Mage::app()->getLocale()->currency($currency_code)->getSymbol(), 'is_pos' => $isPos, 'is_Mobileassistantpro' => 1);
|
166 |
+
$result = Mage::helper('core')->jsonEncode($resultArr);
|
167 |
+
return Mage::app()->getResponse()->setBody($result);
|
168 |
+
}
|
169 |
+
|
170 |
+
public function logoutAction() {
|
171 |
+
|
172 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
173 |
+
$user = $post_data['userapi'];
|
174 |
+
$deviceToken = $post_data['token'];
|
175 |
+
$collections = Mage::getModel("mobileassistant/mobileassistant")->getCollection()->addFieldToFilter('device_token', Array('eq' => $deviceToken));
|
176 |
+
$count = count($collections);
|
177 |
+
|
178 |
+
foreach ($collections as $user) {
|
179 |
+
$device_token = $user->getDeviceToken();
|
180 |
+
|
181 |
+
try {
|
182 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
183 |
+
$connection->beginTransaction();
|
184 |
+
$fields = array();
|
185 |
+
$fields['is_logout'] = 1;
|
186 |
+
$where = $connection->quoteInto('device_token =?', $device_token);
|
187 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
188 |
+
$connection->update($prefix . 'mobileassistant', $fields, $where);
|
189 |
+
$connection->commit();
|
190 |
+
} catch (Exception $e) {
|
191 |
+
return $e->getMessage();
|
192 |
}
|
193 |
+
$successArr[] = array('success_msg' => 'User logout successfully.');
|
194 |
+
$result = Mage::helper('core')->jsonEncode($successArr);
|
195 |
+
return Mage::app()->getResponse()->setBody($result);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
app/code/local/Biztech/Mobileassistant/controllers/OrderController.php
CHANGED
@@ -264,7 +264,10 @@ class Biztech_Mobileassistant_OrderController extends Mage_Core_Controller_Front
|
|
264 |
'shipping_address' => $shipping_address_data,
|
265 |
'payment_info' => $payment_info,
|
266 |
'shipping_info' => $shipping_info,
|
267 |
-
'product_detail' => $products_detail
|
|
|
|
|
|
|
268 |
);
|
269 |
$orderDetailResultArr = array('orderlistdata' => $full_order_detail);
|
270 |
$orderDetailResult = Mage::helper('core')->jsonEncode($orderDetailResultArr);
|
264 |
'shipping_address' => $shipping_address_data,
|
265 |
'payment_info' => $payment_info,
|
266 |
'shipping_info' => $shipping_info,
|
267 |
+
'product_detail' => $products_detail,
|
268 |
+
'is_invoice' => $order->canInvoice(),
|
269 |
+
'is_cancel' => $order->canCancel(),
|
270 |
+
'is_email' => !$order->isCanceled()
|
271 |
);
|
272 |
$orderDetailResultArr = array('orderlistdata' => $full_order_detail);
|
273 |
$orderDetailResult = Mage::helper('core')->jsonEncode($orderDetailResultArr);
|
app/code/local/Biztech/Mobileassistant/controllers/ProductController.php
CHANGED
@@ -1,363 +1,360 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Biztech_Mobileassistant_ProductController extends Mage_Core_Controller_Front_Action {
|
4 |
-
|
5 |
-
public function getProductListAction() {
|
6 |
-
if (Mage::helper('mobileassistant')->isEnable()) {
|
7 |
-
|
8 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
9 |
-
$sessionId = '';
|
10 |
-
$offset = '';
|
11 |
-
$limit = '';
|
12 |
-
$new_products = '';
|
13 |
-
$is_refresh = '';
|
14 |
-
$last_fetch_product = '';
|
15 |
-
$min_fetch_product = '';
|
16 |
-
$last_updated = '';
|
17 |
-
|
18 |
-
if (isset($post_data['session'])) {
|
19 |
-
$sessionId = $post_data['session'];
|
20 |
-
}
|
21 |
-
if (!$sessionId || $sessionId == NULL) {
|
22 |
-
echo $this->__("The Login has expired. Please try log in again.");
|
23 |
-
return false;
|
24 |
-
}
|
25 |
-
if (isset($post_data['storeid'])) {
|
26 |
-
$storeId = $post_data['storeid'];
|
27 |
-
}
|
28 |
-
if (isset($post_data['limit'])) {
|
29 |
-
$limit = $post_data['limit'];
|
30 |
-
}
|
31 |
-
if (isset($post_data['offset'])) {
|
32 |
-
$offset = $post_data['offset'];
|
33 |
-
}
|
34 |
-
if (isset($post_data['last_fetch_product'])) {
|
35 |
-
$new_products = $post_data['last_fetch_product'];
|
36 |
-
}
|
37 |
-
if (isset($post_data['is_refresh'])) {
|
38 |
-
$is_refresh = $post_data['is_refresh'];
|
39 |
-
}
|
40 |
-
|
41 |
-
|
42 |
-
$products = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($storeId)->setOrder('entity_id', 'desc');
|
43 |
-
if ($offset != null) {
|
44 |
-
$products->addAttributeToFilter('entity_id', array('lt' => $offset));
|
45 |
-
}
|
46 |
-
|
47 |
-
|
48 |
-
if ($is_refresh == 1) {
|
49 |
-
if (isset($post_data['last_fetch_product'])) {
|
50 |
-
$last_fetch_product = $post_data['last_fetch_product'];
|
51 |
-
}
|
52 |
-
if (isset($post_data['min_fetch_product'])) {
|
53 |
-
$min_fetch_product = $post_data['min_fetch_product'];
|
54 |
-
}
|
55 |
-
if (isset($post_data['last_updated'])) {
|
56 |
-
$last_updated = $post_data['last_updated'];
|
57 |
-
}
|
58 |
-
$products->getSelect()->where("(entity_id BETWEEN '" . $min_fetch_product . "'AND '" . $last_fetch_product . "'
|
59 |
-
}
|
60 |
-
|
61 |
-
$products->getSelect()->limit($limit);
|
62 |
-
|
63 |
-
foreach ($products as $product) {
|
64 |
-
$product_data = Mage::getModel('catalog/product')->load($product->getId());
|
65 |
-
$status = $product_data->getStatus();
|
66 |
-
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_data)->getQty();
|
67 |
-
if ($status == 1) {
|
68 |
-
$status = 'Enabled';
|
69 |
-
} else {
|
70 |
-
$status = 'Disabled';
|
71 |
-
}
|
72 |
-
if ($qty < 0 || $product_data->getIsInStock() == 0) {
|
73 |
-
$qty = 'Out of Stock';
|
74 |
-
}
|
75 |
-
$product_list[] = array(
|
76 |
-
'id' => $product->getId(),
|
77 |
-
'sku' => $product_data->getSku(),
|
78 |
-
'name' => $product_data->getName(),
|
79 |
-
'status' => $status,
|
80 |
-
'qty' => $qty,
|
81 |
-
'price' => Mage::helper('mobileassistant')->getPrice($product_data->getPrice(), $storeId, Mage::app()->getStore()->getCurrentCurrencyCode()),
|
82 |
-
'image' => ($product_data->getImage()) ? Mage::helper('catalog/image')->init($product, 'image', $product_data->getImage())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString() : 'N/A',
|
83 |
-
'type' => $product->getTypeId()
|
84 |
-
);
|
85 |
-
}
|
86 |
-
$updated_time = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
87 |
-
$productResultArr = array('productlistdata' => $product_list, 'updated_time' => $updated_time);
|
88 |
-
$productListResult = Mage::helper('core')->jsonEncode($productResultArr);
|
89 |
-
return Mage::app()->getResponse()->setBody($productListResult);
|
90 |
-
} else {
|
91 |
-
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
92 |
-
return Mage::app()->getResponse()->setBody($isEnable);
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
public function getProductDetailAction() {
|
97 |
-
if (Mage::helper('mobileassistant')->isEnable()) {
|
98 |
-
$post_data = Mage::app()->getRequest()->getParams();
|
99 |
-
|
100 |
-
$storeId = '';
|
101 |
-
$productId = '';
|
102 |
-
$productSku = '';
|
103 |
-
$associated_products = array();
|
104 |
-
$associated_products_list = '';
|
105 |
-
$associated_products_details = '';
|
106 |
-
$images = '';
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
$
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
}
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
$_images = $product_data->getMediaGalleryImages();
|
143 |
-
if ($_images) {
|
144 |
-
foreach ($_images as $_image) {
|
145 |
-
$images[] = Mage::helper('catalog/image')->init($product_data, 'thumbnail', $_image->getFile())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString();
|
146 |
-
}
|
147 |
-
}
|
148 |
-
if ($pro_status == 1) {
|
149 |
-
$pro_status = 'Enabled';
|
150 |
-
} else {
|
151 |
-
$pro_status = 'Disabled';
|
152 |
-
}
|
153 |
-
|
154 |
-
if ($product_data->getTypeId() == 'grouped') {
|
155 |
-
$associated_products = $product_data->getTypeInstance(true)->getAssociatedProducts($product_data);
|
156 |
-
} elseif ($product_data->getTypeId() == 'configurable') {
|
157 |
-
$associated_products = $product_data->getTypeInstance()->getUsedProducts();
|
158 |
-
} elseif ($product_data->getTypeId() == 'bundle') {
|
159 |
-
$associated_products = $product_data->getTypeInstance(true)->getSelectionsCollection($product_data->getTypeInstance(true)->getOptionsIds($product_data), $product_data);
|
160 |
-
}
|
161 |
-
foreach ($associated_products as $associated_product) {
|
162 |
-
$status = $associated_product->getStatus();
|
163 |
-
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($associated_product)->getQty();
|
164 |
-
if ($status == 1) {
|
165 |
-
$status = 'Enabled';
|
166 |
-
} else {
|
167 |
-
$status = 'Disabled';
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
'
|
179 |
-
'
|
180 |
-
'
|
181 |
-
'
|
182 |
-
'
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
'
|
192 |
-
'
|
193 |
-
'
|
194 |
-
'
|
195 |
-
'
|
196 |
-
'
|
197 |
-
'
|
198 |
-
'
|
199 |
-
'
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
);
|
204 |
-
|
205 |
-
|
206 |
-
$
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
}
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$
|
224 |
-
|
225 |
-
$
|
226 |
-
$
|
227 |
-
$
|
228 |
-
$
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
if (isset($post_data['
|
241 |
-
$
|
242 |
-
}
|
243 |
-
if (isset($post_data['
|
244 |
-
$
|
245 |
-
}
|
246 |
-
if (isset($post_data['
|
247 |
-
$
|
248 |
-
}
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
'
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
$qty = $post_data['qty'];
|
275 |
-
$products->addFieldToFilter('qty', Array('
|
276 |
-
} elseif ($filter_by_qty == '
|
277 |
-
$
|
278 |
-
$
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
$
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
$
|
294 |
-
}
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
'
|
300 |
-
'
|
301 |
-
'
|
302 |
-
'
|
303 |
-
'
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
$
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
}
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
$
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
$
|
337 |
-
|
338 |
-
|
339 |
-
$new_status
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
}
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
}
|
362 |
-
|
363 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Biztech_Mobileassistant_ProductController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function getProductListAction() {
|
6 |
+
if (Mage::helper('mobileassistant')->isEnable()) {
|
7 |
+
|
8 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
9 |
+
$sessionId = '';
|
10 |
+
$offset = '';
|
11 |
+
$limit = '';
|
12 |
+
$new_products = '';
|
13 |
+
$is_refresh = '';
|
14 |
+
$last_fetch_product = '';
|
15 |
+
$min_fetch_product = '';
|
16 |
+
$last_updated = '';
|
17 |
+
|
18 |
+
if (isset($post_data['session'])) {
|
19 |
+
$sessionId = $post_data['session'];
|
20 |
+
}
|
21 |
+
if (!$sessionId || $sessionId == NULL) {
|
22 |
+
echo $this->__("The Login has expired. Please try log in again.");
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
if (isset($post_data['storeid'])) {
|
26 |
+
$storeId = $post_data['storeid'];
|
27 |
+
}
|
28 |
+
if (isset($post_data['limit'])) {
|
29 |
+
$limit = $post_data['limit'];
|
30 |
+
}
|
31 |
+
if (isset($post_data['offset'])) {
|
32 |
+
$offset = $post_data['offset'];
|
33 |
+
}
|
34 |
+
if (isset($post_data['last_fetch_product'])) {
|
35 |
+
$new_products = $post_data['last_fetch_product'];
|
36 |
+
}
|
37 |
+
if (isset($post_data['is_refresh'])) {
|
38 |
+
$is_refresh = $post_data['is_refresh'];
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
$products = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($storeId)->setOrder('entity_id', 'desc');
|
43 |
+
if ($offset != null) {
|
44 |
+
$products->addAttributeToFilter('entity_id', array('lt' => $offset));
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
if ($is_refresh == 1) {
|
49 |
+
if (isset($post_data['last_fetch_product'])) {
|
50 |
+
$last_fetch_product = $post_data['last_fetch_product'];
|
51 |
+
}
|
52 |
+
if (isset($post_data['min_fetch_product'])) {
|
53 |
+
$min_fetch_product = $post_data['min_fetch_product'];
|
54 |
+
}
|
55 |
+
if (isset($post_data['last_updated'])) {
|
56 |
+
$last_updated = $post_data['last_updated'];
|
57 |
+
}
|
58 |
+
$products->getSelect()->where("(entity_id BETWEEN '" . $min_fetch_product . "'AND '" . $last_fetch_product . "') OR entity_id >'" . $last_fetch_product . "'");
|
59 |
+
}
|
60 |
+
|
61 |
+
$products->getSelect()->limit($limit);
|
62 |
+
|
63 |
+
foreach ($products as $product) {
|
64 |
+
$product_data = Mage::getModel('catalog/product')->load($product->getId());
|
65 |
+
$status = $product_data->getStatus();
|
66 |
+
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_data)->getQty();
|
67 |
+
if ($status == 1) {
|
68 |
+
$status = 'Enabled';
|
69 |
+
} else {
|
70 |
+
$status = 'Disabled';
|
71 |
+
}
|
72 |
+
if ($qty < 0 || $product_data->getIsInStock() == 0) {
|
73 |
+
$qty = 'Out of Stock';
|
74 |
+
}
|
75 |
+
$product_list[] = array(
|
76 |
+
'id' => $product->getId(),
|
77 |
+
'sku' => $product_data->getSku(),
|
78 |
+
'name' => $product_data->getName(),
|
79 |
+
'status' => $status,
|
80 |
+
'qty' => $qty,
|
81 |
+
'price' => Mage::helper('mobileassistant')->getPrice($product_data->getPrice(), $storeId, Mage::app()->getStore()->getCurrentCurrencyCode()),
|
82 |
+
'image' => ($product_data->getImage()) ? Mage::helper('catalog/image')->init($product, 'image', $product_data->getImage())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString() : 'N/A',
|
83 |
+
'type' => $product->getTypeId()
|
84 |
+
);
|
85 |
+
}
|
86 |
+
$updated_time = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
87 |
+
$productResultArr = array('productlistdata' => $product_list, 'updated_time' => $updated_time);
|
88 |
+
$productListResult = Mage::helper('core')->jsonEncode($productResultArr);
|
89 |
+
return Mage::app()->getResponse()->setBody($productListResult);
|
90 |
+
} else {
|
91 |
+
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
92 |
+
return Mage::app()->getResponse()->setBody($isEnable);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getProductDetailAction() {
|
97 |
+
if (Mage::helper('mobileassistant')->isEnable()) {
|
98 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
99 |
+
|
100 |
+
$storeId = '';
|
101 |
+
$productId = '';
|
102 |
+
$productSku = '';
|
103 |
+
$associated_products = array();
|
104 |
+
$associated_products_list = '';
|
105 |
+
$associated_products_details = '';
|
106 |
+
$images = '';
|
107 |
+
|
108 |
+
if (isset($post_data['session'])) {
|
109 |
+
$sessionId = $post_data['session'];
|
110 |
+
}
|
111 |
+
|
112 |
+
if (!$sessionId || $sessionId == NULL) {
|
113 |
+
echo $this->__("The Login has expired. Please try log in again.");
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
try {
|
117 |
+
if (isset($post_data['storeid'])) {
|
118 |
+
$storeId = $post_data['storeid'];
|
119 |
+
}
|
120 |
+
if (isset($post_data['productid'])) {
|
121 |
+
$productId = $post_data['productid'];
|
122 |
+
}
|
123 |
+
if (isset($post_data['sku'])) {
|
124 |
+
$productSku = $post_data['sku'];
|
125 |
+
}
|
126 |
+
if (isset($productSku) && $productSku != null) {
|
127 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $productSku);
|
128 |
+
if ($product) {
|
129 |
+
$product_data = Mage::getModel('catalog/product')->load($product->getId());
|
130 |
+
} else {
|
131 |
+
$result = Mage::helper('core')->jsonEncode(array('mesage' => 'No product found.'));
|
132 |
+
return Mage::app()->getResponse()->setBody($result);
|
133 |
+
}
|
134 |
+
} else {
|
135 |
+
$product_data = Mage::getModel('catalog/product')->load($productId);
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
$pro_status = $product_data->getStatus();
|
140 |
+
$pro_qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_data)->getQty();
|
141 |
+
|
142 |
+
$_images = $product_data->getMediaGalleryImages();
|
143 |
+
if ($_images) {
|
144 |
+
foreach ($_images as $_image) {
|
145 |
+
$images[] = Mage::helper('catalog/image')->init($product_data, 'thumbnail', $_image->getFile())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString();
|
146 |
+
}
|
147 |
+
}
|
148 |
+
if ($pro_status == 1) {
|
149 |
+
$pro_status = 'Enabled';
|
150 |
+
} else {
|
151 |
+
$pro_status = 'Disabled';
|
152 |
+
}
|
153 |
+
|
154 |
+
if ($product_data->getTypeId() == 'grouped') {
|
155 |
+
$associated_products = $product_data->getTypeInstance(true)->getAssociatedProducts($product_data);
|
156 |
+
} elseif ($product_data->getTypeId() == 'configurable') {
|
157 |
+
$associated_products = $product_data->getTypeInstance()->getUsedProducts();
|
158 |
+
} elseif ($product_data->getTypeId() == 'bundle') {
|
159 |
+
$associated_products = $product_data->getTypeInstance(true)->getSelectionsCollection($product_data->getTypeInstance(true)->getOptionsIds($product_data), $product_data);
|
160 |
+
}
|
161 |
+
foreach ($associated_products as $associated_product) {
|
162 |
+
$status = $associated_product->getStatus();
|
163 |
+
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($associated_product)->getQty();
|
164 |
+
if ($status == 1) {
|
165 |
+
$status = 'Enabled';
|
166 |
+
} else {
|
167 |
+
$status = 'Disabled';
|
168 |
+
}
|
169 |
+
|
170 |
+
$associated_products_details[] = array(
|
171 |
+
'id' => $associated_product->getId(),
|
172 |
+
'sku' => $associated_product->getSku()
|
173 |
+
);
|
174 |
+
|
175 |
+
$associated_products_list[] = array(
|
176 |
+
'id' => $associated_product->getId(),
|
177 |
+
'sku' => $associated_product->getSku(),
|
178 |
+
'name' => $associated_product->getName(),
|
179 |
+
'status' => $status,
|
180 |
+
'qty' => $qty,
|
181 |
+
'is_in_stock' => $associated_product->getIsInStock(),
|
182 |
+
'price' => Mage::helper('mobileassistant')->getPrice($associated_product->getPrice(), $storeId, Mage::app()->getStore()->getCurrentCurrencyCode()),
|
183 |
+
);
|
184 |
+
}
|
185 |
+
|
186 |
+
$product_details[] = array(
|
187 |
+
'id' => $product_data->getId(),
|
188 |
+
'sku' => $product_data->getSku(),
|
189 |
+
'name' => $product_data->getName(),
|
190 |
+
'status' => $pro_status,
|
191 |
+
'qty' => $pro_qty,
|
192 |
+
'is_in_stock' => $product_data->getIsInStock(),
|
193 |
+
'price' => Mage::helper('mobileassistant')->getPrice($product_data->getPrice(), $storeId, Mage::app()->getStore()->getCurrentCurrencyCode()),
|
194 |
+
'desc' => $product_data->getShortDescription(),
|
195 |
+
'type' => $product_data->getTypeId(),
|
196 |
+
'special_price' => Mage::helper('mobileassistant')->getPrice($product_data->getSpecialPrice(), $storeId, Mage::app()->getStore()->getCurrentCurrencyCode()),
|
197 |
+
'image' => ($product_data->getImage()) ? Mage::helper('catalog/image')->init($product_data, 'image', $product_data->getImage())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString() : 'N/A',
|
198 |
+
'associated_skus' => $associated_products_details,
|
199 |
+
'all_images' => $images,
|
200 |
+
);
|
201 |
+
|
202 |
+
$productResultArr = array('productdata' => $product_details, 'associated_products_list' => $associated_products_list);
|
203 |
+
$productDetailResult = Mage::helper('core')->jsonEncode($productResultArr);
|
204 |
+
return Mage::app()->getResponse()->setBody($productDetailResult);
|
205 |
+
} catch (Exception $e) {
|
206 |
+
$product_details = array(
|
207 |
+
'status' => 'error',
|
208 |
+
'message' => $e->getMessage()
|
209 |
+
);
|
210 |
+
return Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($product_details));
|
211 |
+
}
|
212 |
+
} else {
|
213 |
+
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
214 |
+
return Mage::app()->getResponse()->setBody($isEnable);
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
public function filterProductAction() {
|
219 |
+
if (Mage::helper('mobileassistant')->isEnable()) {
|
220 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
221 |
+
|
222 |
+
$sessionId = '';
|
223 |
+
$storeId = '';
|
224 |
+
$filter_by_name = '';
|
225 |
+
$filter_by_type = '';
|
226 |
+
$filter_by_qty = '';
|
227 |
+
$product_list = '';
|
228 |
+
if (isset($post_data['session'])) {
|
229 |
+
$sessionId = $post_data['session'];
|
230 |
+
}
|
231 |
+
|
232 |
+
if (!$sessionId || $sessionId == NULL) {
|
233 |
+
echo $this->__("The Login has expired. Please try log in again.");
|
234 |
+
return false;
|
235 |
+
}
|
236 |
+
try {
|
237 |
+
if (isset($post_data['storeid'])) {
|
238 |
+
$storeId = $post_data['storeid'];
|
239 |
+
}
|
240 |
+
if (isset($post_data['filter_by_name'])) {
|
241 |
+
$filter_by_name = $post_data['filter_by_name'];
|
242 |
+
}
|
243 |
+
if (isset($post_data['product_type'])) {
|
244 |
+
$filter_by_type = $post_data['product_type'];
|
245 |
+
}
|
246 |
+
if (isset($post_data['filter_by_qty'])) {
|
247 |
+
$filter_by_qty = $post_data['filter_by_qty'];
|
248 |
+
}
|
249 |
+
$products = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($storeId)->setOrder('entity_id', 'desc');
|
250 |
+
|
251 |
+
if ($filter_by_name != null) {
|
252 |
+
$products->addAttributeToFilter(array(
|
253 |
+
array(
|
254 |
+
'attribute' => 'name',
|
255 |
+
'like' => '%' . $filter_by_name . '%'
|
256 |
+
),
|
257 |
+
array(
|
258 |
+
'attribute' => 'sku',
|
259 |
+
'like' => '%' . $filter_by_name . '%'
|
260 |
+
)
|
261 |
+
));
|
262 |
+
}
|
263 |
+
|
264 |
+
if ($filter_by_type != null) {
|
265 |
+
$products->addFieldToFilter('type_id', Array('eq' => $filter_by_type));
|
266 |
+
}
|
267 |
+
|
268 |
+
if ($filter_by_qty != null) {
|
269 |
+
$products->joinField('qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
|
270 |
+
if ($filter_by_qty == 'gteq') {
|
271 |
+
$qty = $post_data['qty'];
|
272 |
+
$products->addFieldToFilter('qty', Array('gteq' => $qty));
|
273 |
+
} elseif ($filter_by_qty == 'lteq') {
|
274 |
+
$qty = $post_data['qty'];
|
275 |
+
$products->addFieldToFilter('qty', Array('lteq' => $qty));
|
276 |
+
} elseif ($filter_by_qty == 'btwn') {
|
277 |
+
$from_qty = $post_data['from_qty'];
|
278 |
+
$to_qty = $post_data['to_qty'];
|
279 |
+
$products->addFieldToFilter('qty', array('from' => $from_qty, 'to' => $to_qty));
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
foreach ($products as $product) {
|
284 |
+
$product_data = Mage::getModel('catalog/product')->load($product->getId());
|
285 |
+
$status = $product_data->getStatus();
|
286 |
+
$qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_data)->getQty();
|
287 |
+
if ($status == 1) {
|
288 |
+
$status = 'Enabled';
|
289 |
+
} else {
|
290 |
+
$status = 'Disabled';
|
291 |
+
}
|
292 |
+
if ($qty < 0 || $product_data->getIsInStock() == 0) {
|
293 |
+
$qty = 'Out of Stock';
|
294 |
+
}
|
295 |
+
$product_list[] = array(
|
296 |
+
'id' => $product->getId(),
|
297 |
+
'sku' => $product_data->getSku(),
|
298 |
+
'name' => $product_data->getName(),
|
299 |
+
'status' => $status,
|
300 |
+
'qty' => $qty,
|
301 |
+
'price' => Mage::helper('mobileassistant')->getPrice($product_data->getPrice(), $storeId, Mage::app()->getStore()->getCurrentCurrencyCode()),
|
302 |
+
'type' => $product->getTypeId(),
|
303 |
+
'image' => ($product_data->getImage()) ? Mage::helper('catalog/image')->init($product, 'image', $product_data->getImage())->resize(300, 330)->keepAspectRatio(true)->constrainOnly(true)->__toString() : 'N/A',
|
304 |
+
);
|
305 |
+
}
|
306 |
+
|
307 |
+
$productListResultArr = array('productlistdata' => $product_list);
|
308 |
+
$productListResult = Mage::helper('core')->jsonEncode($productListResultArr);
|
309 |
+
return Mage::app()->getResponse()->setBody($productListResult);
|
310 |
+
} catch (Exception $e) {
|
311 |
+
$product_list = array(
|
312 |
+
'status' => 'error',
|
313 |
+
'message' => $e->getMessage()
|
314 |
+
);
|
315 |
+
return Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($product_list));
|
316 |
+
}
|
317 |
+
} else {
|
318 |
+
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
319 |
+
return Mage::app()->getResponse()->setBody($isEnable);
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
public function ChangeProductStatusAction() {
|
324 |
+
if (Mage::helper('mobileassistant')->isEnable()) {
|
325 |
+
$post_data = Mage::app()->getRequest()->getParams();
|
326 |
+
$sessionId = $post_data['session'];
|
327 |
+
|
328 |
+
if (!$sessionId || $sessionId == NULL) {
|
329 |
+
echo $this->__("The Login has expired. Please try log in again.");
|
330 |
+
return false;
|
331 |
+
}
|
332 |
+
try {
|
333 |
+
$storeId = $post_data['storeid'];
|
334 |
+
$productId = $post_data['productid'];
|
335 |
+
$current_status = $post_data['current_status'];
|
336 |
+
$new_status = $post_data['new_status'];
|
337 |
+
|
338 |
+
|
339 |
+
if ($current_status != $new_status && $new_status == 1) {
|
340 |
+
Mage::getModel('catalog/product_status')->updateProductStatus($productId, $storeId, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
341 |
+
} elseif ($current_status != $new_status && $new_status == 2) {
|
342 |
+
Mage::getModel('catalog/product_status')->updateProductStatus($productId, $storeId, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
|
343 |
+
}
|
344 |
+
$productResultArr = array('message' => 'Product has been successfully updated.');
|
345 |
+
$productDetailResult = Mage::helper('core')->jsonEncode($productResultArr);
|
346 |
+
return Mage::app()->getResponse()->setBody($productDetailResult);
|
347 |
+
} catch (Exception $e) {
|
348 |
+
$product_details = array(
|
349 |
+
'status' => 'error',
|
350 |
+
'message' => $e->getMessage()
|
351 |
+
);
|
352 |
+
return Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($product_details));
|
353 |
+
}
|
354 |
+
} else {
|
355 |
+
$isEnable = Mage::helper('core')->jsonEncode(array('enable' => false));
|
356 |
+
return Mage::app()->getResponse()->setBody($isEnable);
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
}
|
|
|
|
|
|
app/code/local/Biztech/Mobileassistant/etc/config.xml
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Biztech_Mobileassistant>
|
13 |
-
<version>0.2.
|
14 |
</Biztech_Mobileassistant>
|
15 |
</modules>
|
16 |
<frontend>
|
@@ -30,6 +30,24 @@
|
|
30 |
</mobileassistant>
|
31 |
</updates>
|
32 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
</frontend>
|
34 |
<admin>
|
35 |
<routers>
|
@@ -124,14 +142,15 @@
|
|
124 |
</mobileassistant>
|
125 |
</helpers>
|
126 |
<events>
|
127 |
-
<
|
128 |
<observers>
|
129 |
-
<
|
|
|
130 |
<class>mobileassistant/observer</class>
|
131 |
-
<method>
|
132 |
-
</
|
133 |
</observers>
|
134 |
-
</
|
135 |
<customer_register_success>
|
136 |
<observers>
|
137 |
<mobileassistant_customer_notification_checkout>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<Biztech_Mobileassistant>
|
13 |
+
<version>0.2.4</version>
|
14 |
</Biztech_Mobileassistant>
|
15 |
</modules>
|
16 |
<frontend>
|
30 |
</mobileassistant>
|
31 |
</updates>
|
32 |
</layout>
|
33 |
+
<events>
|
34 |
+
<sales_order_save_after>
|
35 |
+
<observers>
|
36 |
+
<mobileassistant>
|
37 |
+
<class>mobileassistant/observer</class>
|
38 |
+
<method>sales_order_save_after</method>
|
39 |
+
</mobileassistant>
|
40 |
+
</observers>
|
41 |
+
</sales_order_save_after>
|
42 |
+
<review_save_after>
|
43 |
+
<observers>
|
44 |
+
<mobileassistant>
|
45 |
+
<class>mobileassistant/observer</class>
|
46 |
+
<method>reviewNotification</method>
|
47 |
+
</mobileassistant>
|
48 |
+
</observers>
|
49 |
+
</review_save_after>
|
50 |
+
</events>
|
51 |
</frontend>
|
52 |
<admin>
|
53 |
<routers>
|
142 |
</mobileassistant>
|
143 |
</helpers>
|
144 |
<events>
|
145 |
+
<admin_system_config_changed_section_mobileassistant>
|
146 |
<observers>
|
147 |
+
<magemobcart>
|
148 |
+
<type>model</type>
|
149 |
<class>mobileassistant/observer</class>
|
150 |
+
<method>checkKey</method>
|
151 |
+
</magemobcart>
|
152 |
</observers>
|
153 |
+
</admin_system_config_changed_section_mobileassistant>
|
154 |
<customer_register_success>
|
155 |
<observers>
|
156 |
<mobileassistant_customer_notification_checkout>
|
app/code/local/Biztech/Mobileassistant/etc/system.xml
CHANGED
@@ -16,6 +16,35 @@
|
|
16 |
<show_in_website>1</show_in_website>
|
17 |
<show_in_store>1</show_in_store>
|
18 |
<groups>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
<mobileassistant_general translate="label">
|
20 |
<label>General</label>
|
21 |
<frontend_type>text</frontend_type>
|
@@ -28,13 +57,14 @@
|
|
28 |
<label>Enabled</label>
|
29 |
<frontend_type>select</frontend_type>
|
30 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
|
|
31 |
<sort_order>1</sort_order>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<show_in_website>1</show_in_website>
|
34 |
<show_in_store>1</show_in_store>
|
35 |
<comment>Select Yes to enable this feature.</comment>
|
36 |
</enabled>
|
37 |
-
|
38 |
<label>Send Notification For</label>
|
39 |
<frontend_type>multiselect</frontend_type>
|
40 |
<source_model>mobileassistant/system_config_notification</source_model>
|
@@ -82,11 +112,30 @@
|
|
82 |
<show_in_store>1</show_in_store>
|
83 |
<comment>Enter your message which will be received on the Mobile app whenever a product qty is lower than or equal to minimum qty.</comment>
|
84 |
</product_inventory_notification_msg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
<barcode_for_url translate="label">
|
86 |
<label>Store Base Url QRcode</label>
|
87 |
<frontend_type>text</frontend_type>
|
88 |
<frontend_model>mobileassistant/config_barcodeurl</frontend_model>
|
89 |
-
<sort_order>
|
90 |
<show_in_default>1</show_in_default>
|
91 |
<show_in_website>1</show_in_website>
|
92 |
<show_in_store>1</show_in_store>
|
16 |
<show_in_website>1</show_in_website>
|
17 |
<show_in_store>1</show_in_store>
|
18 |
<groups>
|
19 |
+
<activation translate="label">
|
20 |
+
<label>Magento Mobile Admin Activation</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<key>
|
28 |
+
<label>Activation Key</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>1</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<validate>required-entry</validate>
|
35 |
+
</key>
|
36 |
+
<websites translate="label">
|
37 |
+
<label>Select Websites</label>
|
38 |
+
<frontend_type>checkbox</frontend_type>
|
39 |
+
<source_model>adminhtml/system_config_source_website</source_model>
|
40 |
+
<frontend_model>mobileassistant/adminhtml_config_form_renderer_website</frontend_model>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</websites>
|
46 |
+
</fields>
|
47 |
+
</activation>
|
48 |
<mobileassistant_general translate="label">
|
49 |
<label>General</label>
|
50 |
<frontend_type>text</frontend_type>
|
57 |
<label>Enabled</label>
|
58 |
<frontend_type>select</frontend_type>
|
59 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
60 |
+
<frontend_model>mobileassistant/adminhtml_enabledisable</frontend_model>
|
61 |
<sort_order>1</sort_order>
|
62 |
<show_in_default>1</show_in_default>
|
63 |
<show_in_website>1</show_in_website>
|
64 |
<show_in_store>1</show_in_store>
|
65 |
<comment>Select Yes to enable this feature.</comment>
|
66 |
</enabled>
|
67 |
+
<notification translate="label">
|
68 |
<label>Send Notification For</label>
|
69 |
<frontend_type>multiselect</frontend_type>
|
70 |
<source_model>mobileassistant/system_config_notification</source_model>
|
112 |
<show_in_store>1</show_in_store>
|
113 |
<comment>Enter your message which will be received on the Mobile app whenever a product qty is lower than or equal to minimum qty.</comment>
|
114 |
</product_inventory_notification_msg>
|
115 |
+
<product_review_notification_msg translate="label">
|
116 |
+
<label>Product Review Notification Message</label>
|
117 |
+
<frontend_type>text</frontend_type>
|
118 |
+
<sort_order>7</sort_order>
|
119 |
+
<show_in_default>1</show_in_default>
|
120 |
+
<show_in_website>1</show_in_website>
|
121 |
+
<show_in_store>1</show_in_store>
|
122 |
+
<comment>Enter your message which will be received on the Mobile app whenever a new product review is added.</comment>
|
123 |
+
</product_review_notification_msg>
|
124 |
+
<base_url translate="label">
|
125 |
+
<label>Store Base Url</label>
|
126 |
+
<frontend_type>text</frontend_type>
|
127 |
+
<frontend_model>mobileassistant/config_baseurl</frontend_model>
|
128 |
+
<sort_order>8</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
<comment>Diaplay Store Base Url.</comment>
|
133 |
+
</base_url>
|
134 |
<barcode_for_url translate="label">
|
135 |
<label>Store Base Url QRcode</label>
|
136 |
<frontend_type>text</frontend_type>
|
137 |
<frontend_model>mobileassistant/config_barcodeurl</frontend_model>
|
138 |
+
<sort_order>9</sort_order>
|
139 |
<show_in_default>1</show_in_default>
|
140 |
<show_in_website>1</show_in_website>
|
141 |
<show_in_store>1</show_in_store>
|
app/design/adminhtml/default/default/template/mobileassistant/system/config/barcode.phtml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
$url = Mage::app()->getStore($storeId)->getUrl();
|
4 |
|
5 |
?>
|
1 |
<?php
|
2 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
3 |
$url = Mage::app()->getStore($storeId)->getUrl();
|
4 |
|
5 |
?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>magento_mobile_assistant_manager</name>
|
4 |
-
<version>0.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -25,11 +25,11 @@ To ensure smooth working of this extension you need to download this extension i
|
|
25 |
Application Download Link:
|
26 |
https://itunes.apple.com/us/app/magentomobilemanager/id695074519?mt=8&ign-mpt=uo%3D4
|
27 |
</description>
|
28 |
-
<notes>-
|
29 |
<authors><author><name>Biztech</name><user>biztechcon</user><email>sales@biztechconsultancy.com</email></author></authors>
|
30 |
-
<date>2016-
|
31 |
-
<time>
|
32 |
-
<contents><target name="magelocal"><dir name="Biztech"><dir name="All"><dir name="Helper"><file name="Data.php" hash="e856726fd089e7f73ca7de450b696419"/></dir><dir name="Model"><file name="All.php" hash="a9aeeb9c6d7be9cf20414f405efc878d"/><dir name="Mysql4"><dir name="All"><file name="Collection.php" hash="a1909236183d126f38e628b85bb57e81"/></dir><file name="All.php" hash="f02542393eb26eadfb9b92d901d2ac12"/></dir><dir name="Source"><dir name="Updates"><file name="Type.php" hash="fa695bf4764c2d93c7436ed54bde89ba"/></dir></dir><file name="Status.php" hash="30a6f0da7d9d45e1082da532d5f8dabc"/><file name="Update.php" hash="8c4c167baf8775736e6861bfceb8e09f"/></dir><dir name="etc"><file name="config.xml" hash="27e403cedb861da03753d28527d9c664"/><file name="system.xml" hash="17262087dc933d934e09ac04cafb4c51"/></dir></dir><dir name="Authentication"><dir name="controllers"><file name="IndexController.php" hash="d5e9bcb327c8b4e41dde53948c16d329"/></dir><dir name="etc"><file name="config.xml" hash="d12ebc10e7781ff82323e54ff7713dae"/></dir></dir><dir name="Mobileassistant"><dir name="Block"><dir name="Config"><file name="Barcodeurl.php" hash="6dc63c4a9f259cb5fb854d39c9057eaa"/></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
33 |
<compatible/>
|
34 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
35 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>magento_mobile_assistant_manager</name>
|
4 |
+
<version>0.2.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
25 |
Application Download Link:
|
26 |
https://itunes.apple.com/us/app/magentomobilemanager/id695074519?mt=8&ign-mpt=uo%3D4
|
27 |
</description>
|
28 |
+
<notes>- Solve certificate issue to send notification</notes>
|
29 |
<authors><author><name>Biztech</name><user>biztechcon</user><email>sales@biztechconsultancy.com</email></author></authors>
|
30 |
+
<date>2016-07-15</date>
|
31 |
+
<time>06:08:45</time>
|
32 |
+
<contents><target name="magelocal"><dir name="Biztech"><dir name="All"><dir name="Helper"><file name="Data.php" hash="e856726fd089e7f73ca7de450b696419"/></dir><dir name="Model"><file name="All.php" hash="a9aeeb9c6d7be9cf20414f405efc878d"/><dir name="Mysql4"><dir name="All"><file name="Collection.php" hash="a1909236183d126f38e628b85bb57e81"/></dir><file name="All.php" hash="f02542393eb26eadfb9b92d901d2ac12"/></dir><dir name="Source"><dir name="Updates"><file name="Type.php" hash="fa695bf4764c2d93c7436ed54bde89ba"/></dir></dir><file name="Status.php" hash="30a6f0da7d9d45e1082da532d5f8dabc"/><file name="Update.php" hash="8c4c167baf8775736e6861bfceb8e09f"/></dir><dir name="etc"><file name="config.xml" hash="27e403cedb861da03753d28527d9c664"/><file name="system.xml" hash="17262087dc933d934e09ac04cafb4c51"/></dir></dir><dir name="Authentication"><dir name="controllers"><file name="IndexController.php" hash="bfc01d24d03410e2d467139ff75ba9ce"/><file name="IndexController_10-3-2016.php" hash="d5e9bcb327c8b4e41dde53948c16d329"/></dir><dir name="etc"><file name="config.xml" hash="d12ebc10e7781ff82323e54ff7713dae"/></dir></dir><dir name="Mobileassistant"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Renderer"><file name="Website.php" hash="0c1e8edeea8f34380803f2ee8caaf0e8"/></dir></dir></dir><file name="Enabledisable.php" hash="3b2fcf73b42be06f35b8661d14c11293"/></dir><dir name="Config"><file name="Barcodeurl.php" hash="6dc63c4a9f259cb5fb854d39c9057eaa"/><file name="Baseurl.php" hash="41dc639e43a561c87ef0f7f314b83543"/></dir></dir><dir name="Helper"><file name="Data.php" hash="951e2c003267660cf66a5110f7c1f0df"/></dir><dir name="Model"><dir name="Mobileassistant"><file name="Api.php" hash="4e8e1f556fc8f1d9e6c2f520a3a84e52"/></dir><file name="Mobileassistant.php" hash="68e160bf752ec8c1facc514389c00849"/><dir name="Mysql4"><dir name="Mobileassistant"><file name="Collection.php" hash="e9319365535ec2c42429ea1d9dbdc097"/></dir><file name="Mobileassistant.php" hash="62dc51f43aa6dff1dc762646b71cd600"/></dir><file name="Observer.php" hash="b40ccaabbc9d2fb2312097dba1f93389"/><dir name="System"><dir name="Config"><file name="Notification.php" hash="fdaacb629e9b200fc4d778ab4173f55a"/><file name="Notification_30-1-2016.php" hash="e534c166867436b3ab6c5d3a9c0e5d45"/></dir></dir></dir><dir name="controllers"><file name="CustomerController.php" hash="43619f8ab81eb651a34e7fab791af613"/><file name="DashboardController.php" hash="74ab167f27cb2a2fb1e5f7a636896668"/><file name="IndexController.php" hash="a3f18e83cd9fd2887ce82e3305c27b28"/><file name="OrderController.php" hash="14e4ef67dc8b5cd4aa0e4a4e4235a966"/><file name="ProductController.php" hash="cbeea2ed1c12baada5b2fb2ba593e78c"/></dir><dir name="etc"><file name="api.xml" hash="7860c9fe0f121148eb2a3a498d1879b1"/><file name="config.xml" hash="728d352e24878516ce118759978b7054"/><file name="system.xml" hash="34bc9949fc3d3dff758ebe6225057b0c"/></dir><dir name="sql"><dir name="mobileassistant_setup"><file name="mysql4-install-0.1.0.php" hash="4f06ae1c3c5362b88fae1b1951a6b02a"/><file name="mysql4-upgrade-0.1.0-0.1.4.php" hash="172e9ecba3b5b385cef1c257b2af4bfa"/><file name="mysql4-upgrade-0.1.10-0.2.0.php" hash="dcb5288e356d3c36838446bbcadf6a2e"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="bd4adba7146d89fed6c548dd46a30a81"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="88ea6198ef876da921faebb1aa067485"/><file name="mysql4-upgrade-0.1.6-0.1.10.php" hash="88ea6198ef876da921faebb1aa067485"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Biztech_All.xml" hash="f4c3b9c029e56da8f09d7d71336c00f7"/><file name="Biztech_Mobileassistant.xml" hash="18d9cf7b8e516db899336adfd8210621"/><file name="Biztech_Authentication.xml" hash="149998e1599f43939f13cbc059123c8f"/></dir></target><target name="mage"><dir name="lib"><dir name="mobileassistant"><file name="pushcert.pem" hash="ae01f2353e11081071f5fa7e06bef9c1"/></dir></dir><dir name="."><file name="MageMobAdmin.pdf" hash=""/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mobileassistant"><dir name="system"><dir name="config"><file name="barcode.phtml" hash="4316de57ba76dc0f3d581fd149830920"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
33 |
<compatible/>
|
34 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
35 |
</package>
|