Jump to content

Bug in module Statsnewsletter


Recommended Posts

In statistic Newsletter is bug. Bug is in file modules>statsnewsletter/statsnewsletter.php

"
Unknown column 'n.date_add' in 'where clause'

SELECT COUNT(*) as visitors
FROM ps_newsletter n
WHERE n.`date_add` BETWEEN '2009-01-01 00:00:00' AND '2009-12-31 23:59:59'

"

old code:

    private function getTotals()
   {
       $result1 = Db::getInstance()->getRow('
       SELECT COUNT(*) as customers
       FROM `'._DB_PREFIX_.'customer` c
       WHERE c.`newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween());
       $result2 = Db::getInstance()->getRow('
       SELECT COUNT(*) as visitors
       FROM '._DB_PREFIX_.'newsletter n
       WHERE n.`date_add` BETWEEN '.ModuleGraph::getDateBetween());
       return array('customers' => $result1['customers'], 'visitors' => $result2['visitors'], 'both' => $result1['customers'] + $result2['visitors']);
   }




new code:

    private function getTotals()
   {
       $result1 = Db::getInstance()->getRow('
       SELECT COUNT(*) as customers
       FROM `'._DB_PREFIX_.'customer` c
       WHERE c.`newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween());
       $result2 = Db::getInstance()->getRow('
       SELECT COUNT(*) as visitors
       FROM '._DB_PREFIX_.'newsletter n
       WHERE n.`newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween());
       return array('customers' => $result1['customers'], 'visitors' => $result2['visitors'], 'both' => $result1['customers'] + $result2['visitors']);
   }

Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...