From ee98e2835fc10272f4c4081bf55990eab32cf6ec Mon Sep 17 00:00:00 2001 From: bMancone Date: Tue, 13 Mar 2012 14:59:21 +0000 Subject: [PATCH] // Added mobile device management in stores controller --- controllers/front/StoresController.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/controllers/front/StoresController.php b/controllers/front/StoresController.php index d4e5506f6..192887ad9 100644 --- a/controllers/front/StoresController.php +++ b/controllers/front/StoresController.php @@ -175,8 +175,18 @@ class StoresControllerCore extends FrontController */ protected function displayAjax() { - $stores = $this->getStores(); + if ($this->context->getMobileDevice() == true) + { + $stores = $this->getStores(); + foreach ($stores as &$store) + { + if (file_exists(_PS_STORE_IMG_DIR_.(int)$store['id_store'].'.jpg')) + $store['picture'] = (int)$store['id_store'].'.jpg'; + } + die(Tools::jsonEncode($stores)); + } + $stores = $this->getStores(); $dom = new DOMDocument('1.0'); $node = $dom->createElement('markers'); $parnode = $dom->appendChild($node); @@ -259,9 +269,17 @@ class StoresControllerCore extends FrontController public function setMedia() { parent::setMedia(); - $this->addCSS(_THEME_CSS_DIR_.'stores.css'); - if (!Configuration::get('PS_STORES_SIMPLIFIED')) - $this->addJS(_THEME_JS_DIR_.'stores.js'); + $this->addJS('http://maps.google.com/maps/api/js?sensor=true'); + if ($this->context->getMobileDevice() == false) + { + $this->addCSS(_THEME_CSS_DIR_.'stores.css'); + if (!Configuration::get('PS_STORES_SIMPLIFIED')) + $this->addJS(_THEME_JS_DIR_.'stores.js'); + } + else // mobile device + $this->addJS(array( + _THEME_MOBILE_JS_DIR_.'stores.js' + )); } }