//StoresController : Refacto done

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8865 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2011-09-29 08:59:11 +00:00
parent 6a96dd1371
commit 5f02dc0d0e
+19 -12
View File
@@ -107,10 +107,7 @@ class StoresControllerCore extends FrontController
)); ));
} }
/** public function getStores()
* Assign template vars for classical stores
*/
protected function assignStores()
{ {
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT'); $distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
if (!in_array($distanceUnit, array('km', 'mi'))) if (!in_array($distanceUnit, array('km', 'mi')))
@@ -152,25 +149,35 @@ class StoresControllerCore extends FrontController
ORDER BY distance ASC ORDER BY distance ASC
LIMIT 0,20'); LIMIT 0,20');
} }
return $stores;
}
/**
* Assign template vars for classical stores
*/
protected function assignStores()
{
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/logo_stores.gif'));
if ($this->ajax) $distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
$this->displayXmlMaps($stores); if (!in_array($distanceUnit, array('km', 'mi')))
else $distanceUnit = 'km';
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/logo_stores.gif'));
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'distance_unit' => $distanceUnit, 'distance_unit' => $distanceUnit,
'simplifiedStoresDiplay' => false, 'simplifiedStoresDiplay' => false,
'stores' => $stores 'stores' => $this->getStores()
)); ));
} }
/** /**
* Display the Xml for showing the nodes in the google map * Display the Xml for showing the nodes in the google map
*/ */
protected function displayXmlMaps($stores) protected function displayAjax()
{ {
$stores = $this->getStores();
$dom = new DOMDocument('1.0'); $dom = new DOMDocument('1.0');
$node = $dom->createElement('markers'); $node = $dom->createElement('markers');
$parnode = $dom->appendChild($node); $parnode = $dom->appendChild($node);