';
return $this->_html;
}
public function setOption($option)
{
}
public function getData()
{
$this->_query = '
SELECT SQL_CALC_FOUND_ROWS c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`,
COUNT(co.`id_connections`) as totalVisits,
IFNULL((
SELECT ROUND(SUM(IFNULL(o.`total_paid_real`, 0) / cu.conversion_rate), 2)
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'currency` cu ON o.id_currency = cu.id_currency
WHERE o.id_customer = c.id_customer
AND o.invoice_date BETWEEN '.$this->getDate().'
AND o.valid
), 0) as totalMoneySpent
FROM `'._DB_PREFIX_.'customer` c
LEFT JOIN `'._DB_PREFIX_.'guest` g ON c.`id_customer` = g.`id_customer`
LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.`id_guest` = co.`id_guest`
WHERE co.date_add BETWEEN '.$this->getDate().'
GROUP BY c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`';
if (Validate::IsName($this->_sort))
{
$this->_query .= ' ORDER BY `'.$this->_sort.'`';
if (isset($this->_direction) AND Validate::IsSortDirection($this->_direction))
$this->_query .= ' '.$this->_direction;
}
if (($this->_start === 0 OR Validate::IsUnsignedInt($this->_start)) AND Validate::IsUnsignedInt($this->_limit))
$this->_query .= ' LIMIT '.$this->_start.', '.($this->_limit);
$this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query);
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
}
}