// Context part 19

This commit is contained in:
tDidierjean
2011-07-25 16:42:48 +00:00
parent 2c4f27f1be
commit a96064b13d
4 changed files with 38 additions and 41 deletions
+6 -8
View File
@@ -134,12 +134,10 @@ class StatsCatalog extends Module
public function hookAdminStatsModules($params)
{
global $cookie;
$context = Context::getContext();
$categories = Category::getCategories((int)($cookie->id_lang), true, false);
$productToken = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee));
$currency = Currency::getCurrency(Configuration::get('PS_CURRENCY_DEFAULT'));
$link = new Link();
$categories = Category::getCategories($context->language->id, true, false);
$productToken = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id);
$irow = 0;
if ($id_category = (int)(Tools::getValue('id_category')))
@@ -155,7 +153,7 @@ class StatsCatalog extends Module
$totalPictures = $result1['images'];
$averagePictures = $total ? $totalPictures / $total : 0;
$neverBought = $this->getProductsNB((int)($cookie->id_lang));
$neverBought = $this->getProductsNB($context->language->id);
$totalNB = $neverBought['total'];
$productsNB = $neverBought['result'];
@@ -189,7 +187,7 @@ class StatsCatalog extends Module
<div class="clear space"></div>
<table>
'.$this->returnLine($this->l('Products available:'), (int)($total)).'
'.$this->returnLine($this->l('Average price (base price):'), Tools::displayPrice($averagePrice, $currency)).'
'.$this->returnLine($this->l('Average price (base price):'), Tools::displayPrice($averagePrice, $context->currency)).'
'.$this->returnLine($this->l('Product pages viewed:'), (int)($totalPageViewed)).'
'.$this->returnLine($this->l('Products bought:'), (int)($totalBought)).'
'.$this->returnLine($this->l('Average number of page visits:'), number_format((float)($averageViewed), 2, '.', '')).'
@@ -219,7 +217,7 @@ class StatsCatalog extends Module
<td style="width: 400px;">'.$product['name'].'</td>
<td style="text-align: right">
<a href="index.php?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.$productToken.'" target="_blank"><img src="../modules/'.$this->name.'/page_edit.png" /></a>
<a href="'.$link->getProductLink($product['id_product'], $product['link_rewrite']).'" target="_blank"><img src="../modules/'.$this->name.'/application_home.png" /></a>
<a href="'.$context->link->getProductLink($product['id_product'], $product['link_rewrite']).'" target="_blank"><img src="../modules/'.$this->name.'/application_home.png" /></a>
</td>
</tr>';
$html .= '