//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
));
}
/**
* Assign template vars for classical stores
*/
protected function assignStores()
public function getStores()
{
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
if (!in_array($distanceUnit, array('km', 'mi')))
@@ -152,25 +149,35 @@ class StoresControllerCore extends FrontController
ORDER BY distance ASC
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)
$this->displayXmlMaps($stores);
else
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/logo_stores.gif'));
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
if (!in_array($distanceUnit, array('km', 'mi')))
$distanceUnit = 'km';
$this->context->smarty->assign(array(
'distance_unit' => $distanceUnit,
'simplifiedStoresDiplay' => false,
'stores' => $stores
'stores' => $this->getStores()
));
}
/**
* 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');
$node = $dom->createElement('markers');
$parnode = $dom->appendChild($node);