// Fix admin referrers for multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8120 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-19 13:07:23 +00:00
parent 13849fc2c8
commit c7d4290206
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -58,11 +58,14 @@ class AdminReferrers extends AdminTab
$this->view = true;
$this->edit = true;
$this->delete = true;
parent::__construct();
$this->_select = 'SUM(sa.cache_visitors) AS cache_visitors, SUM(sa.cache_visits) AS cache_visits, SUM(sa.cache_pages) AS cache_pages,
SUM(sa.cache_registrations) AS cache_registrations, SUM(sa.cache_orders) AS cache_orders, SUM(sa.cache_sales) AS cache_sales,
IF(sa.cache_orders > 0, ROUND(sa.cache_sales/sa.cache_orders, 2), 0) as cart, (sa.cache_visits*click_fee) as fee0,
(sa.cache_orders*base_fee) as fee1, (sa.cache_sales*percent_fee/100) as fee2';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'referrer_shop` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', $this->context->shop->getListOfID()).'))';
$this->_group = 'GROUP BY sa.id_referrer';
$this->fieldsDisplay = array(
'id_referrer' => array('title' => $this->l('ID'), 'width' => 25, 'align' => 'center'),
@@ -79,8 +82,6 @@ class AdminReferrers extends AdminTab
'fee0' => array('title' => $this->l('Click'), 'width' => 30, 'align' => 'right', 'price' => true),
'fee1' => array('title' => $this->l('Base'), 'width' => 30, 'align' => 'right', 'price' => true),
'fee2' => array('title' => $this->l('Percent'), 'width' => 30, 'align' => 'right', 'price' => true));
parent::__construct();
}
private function enableCalendar()
+1 -1
View File
@@ -1310,7 +1310,7 @@ abstract class AdminTabCore
else if (!preg_match('#(\s|,)\s*a\.`?'.pSQL($this->identifier).'`?(\s|,|$)#', $this->_group))
$this->_group .= ', a.'.pSQL($this->identifier);
if (Shop::isMultiShopActivated() && Context::shop() == Shop::CONTEXT_ALL)
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_'.$filterKey).'`? *sa#', $this->_join))
$filterShop = 'JOIN `'._DB_PREFIX_.$this->table.'_'.$filterKey.'` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filterKey.' IN ('.implode(', ', $idenfierShop).'))';
}