0

I'm working on some report customization and I can see report collections has different behavior on the base of isTotals() parameter.

  • What is the meaning of isTotals() ?
  • any relation with the backend report page ( is it a value that can be submitted )?

1 Answer 1

2

The reports usually have 2 sections.
Some lines per period or other fields that you can filter when you want to view a report, and one "totals" line.
This "totals" line is retrieved via a query also. The isTotals tells magento to modify the select of the collection if it is used for rendering the totals line.
See for example what isTotals does in Mage_Reports_Model_Resource_Report_Product_Viewed_Collection::_beforeLoad

        if ($this->isTotals()) {
            // calculate total
            $cloneSelect = clone $this->getSelect();
            $this->getSelect()->reset()->from($cloneSelect, $this->getAggregatedColumns());
        } else {
            // add sorting
            $this->getSelect()->order(array('period ASC', 'views_num DESC'));
        }

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.