質問

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.

役に立ちましたか?

解決

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);
                        }
                    }
                }

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top