created function for getting page alias
This commit is contained in:
@@ -128,4 +128,20 @@ class PageCore extends ObjectModel
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public static function getPageTypeAlias($pageName)
|
||||
{
|
||||
$pageTypeAlias = array(
|
||||
'index' => 'home',
|
||||
'category' => 'hotel',
|
||||
'product' => 'room-type',
|
||||
'orderopc' => 'checkout'
|
||||
);
|
||||
|
||||
if (isset($pageTypeAlias[$pageName])) {
|
||||
return $pageTypeAlias[$pageName];
|
||||
} else {
|
||||
return $pageName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,12 +45,6 @@ class StatsLive extends Module
|
||||
$this->displayName = $this->l('Visitors online');
|
||||
$this->description = $this->l('Adds a list of customers and visitors who are currently online to the Stats dashboard.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99');
|
||||
$this->page_map = array(
|
||||
'index' => 'home',
|
||||
'category' => 'hotel',
|
||||
'product' => 'room-type',
|
||||
'orderopc' => 'checkout'
|
||||
);
|
||||
}
|
||||
|
||||
public function install()
|
||||
@@ -95,7 +89,7 @@ class StatsLive extends Module
|
||||
ORDER BY u.firstname, u.lastname';
|
||||
}
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$this->updatePageName($results);
|
||||
$this->updatePageTypeAlias($results);
|
||||
|
||||
return array($results, Db::getInstance()->NumRows());
|
||||
}
|
||||
@@ -137,18 +131,16 @@ class StatsLive extends Module
|
||||
}
|
||||
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$this->updatePageName($results);
|
||||
$this->updatePageTypeAlias($results);
|
||||
|
||||
return array($results, Db::getInstance()->NumRows());
|
||||
}
|
||||
|
||||
public function updatePageName(&$result)
|
||||
public function updatePageTypeAlias(&$result)
|
||||
{
|
||||
if (count($result)) {
|
||||
foreach ($result as &$customer) {
|
||||
if (isset($this->page_map[$customer['page']])) {
|
||||
$customer['page'] = $this->page_map[$customer['page']];
|
||||
}
|
||||
$customer['page'] = Page::getPageTypeAlias($customer['page']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user