0

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. enter image description here Please help me in fixing this issue.

2 Answers 2

1

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);
                        }
                    }
                }
2
  • 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
0

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:

  1. Re-run the compilation process (System -> Tools -> Compilation)

  2. Clear Cache

  3. Refresh Statistics (Reports -> Refresh Statistics)

I hope this will help you.

2
  • you have to also re-run complilation once. Commented Dec 29, 2015 at 10:14
  • Tried, but didn't help. Commented Dec 29, 2015 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.