I am facing a strange issue.
Bestseller yearly report in admin is showing product twice for the year in "to" field.
If I am changing the year from 2012 to 2013 then issue is for product listing for year 2013 only and if year in to field is 2014 then issue is with product listing for year 2014 only and so on.
For daily and monthly it is working fine.
Please help me in fixing this issue.
2 Answers
In file app/code/core/Mage/Sales/Model/Mysql4/Report/Bestsellers/Collection.php
under function _beforeLoad()
I have commented code in below condition to fix it.
if ($periodTo) {
// not the last day of the year
if ($periodTo->toValue(Zend_Date::MONTH) != 12 || $periodTo->toValue(Zend_Date::DAY) != 31) {
$dtFrom = $periodTo->getDate()->setMonth(1)->setDay(1); // first day of the year
$dtTo = $periodTo->getDate();
if (!$periodFrom || $dtFrom->isLater($periodFrom)) {
// $selectUnions[] = $this->_makeBoundarySelect(
// $dtFrom->toString($dtFormat), $dtTo->toString($dtFormat)
// );
// last day of the previous year
$this->_to = $periodTo->getDate()
->subYear(1)
->setMonth(12)
->setDay(31)
->toString($dtFormat);
}
}
}
-
Please donot code at code files and plz rewrite the class– Amit Bera ♦Commented Dec 31, 2015 at 9:21
-
@AmitBera : Yes, I have overriden this class into my custom class. Just to keep the answer brief I have not explained the overridden part. Commented Dec 31, 2015 at 9:25
i have same issue it is because of re-indexing requires.
you have to re-index data.
or if you want custom module you can visit bellow link:
http://inchoo.net/magento/bestseller-products-in-magento/
clear cache is required.
and other solution is:
Re-run the compilation process (System -> Tools -> Compilation)
Clear Cache
Refresh Statistics (Reports -> Refresh Statistics)
I hope this will help you.