Magento Reports
One of the more advanced areas in Magento development is creating reports. But because the classes involved in creating reports are scattered throughout multiple modules within Magento Core, it is also one of the most challenging areas for Magento users.
In truth, the reports do not have a single framework codebase, but instead are customized variations of the standard Grid tool used throughout the Magento Admin. The difficulty in creating reports is knowing how to implement or edit the report collection model so that it displays the data in the correct order and format as well as using the correct report filters.
The major components within a single report are:
- etc
- config.xml
- adminhtml.xml
- Controller(s)
- Blocks for:
- Grid (report data)
- Blocks for Grid Container
- Filter
- Mysql4 or Resource Models
- Report Item Collection
- Aggregated Table Classes (optional)
- Helper (standard empty helper is OK)
- app/design/adminhtml/default/default/
- Layout
- Template
Reports can be to display additional data using default Magento attributes, a report that extends a default Magento Report with custom fields, or a report that is distinct from default Magento by displaying custom data.
There are actually two distinct types of “reports”. One that uses the period to sort the report data by “daily”, “monthly,” or “yearly”, and another type of report that uses the more traditional grid you see when managing products, customers, etc.
Before you start your report, you need to decide if the report data will be separated by a time period or if the report always displays all of the data. A few examples of the second kind of report are:
- Sales > PayPal Settlements Report
- Shopping Cart > Products in Carts (no filters)
- Products > Low Stock
Magento Reports: Cost
The purpose of this report is to display the average cost of a product when it was sold compared to the sold price. It will display both average profit amount and total profit per product.
All product data which is stored in this table is copied at the time the order was placed instead of the current value. This means we have a record of the historical cost associated with the product.
The Product Cost report will use the “Period” filters and will display all products sold within a particular period (“Daily”, “Monthly” or “Yearly”). The report will count all “sold” items and will not consider items that are canceled or returned. The report will have the following fields:
- Period
- Product Name
- Original Price
- Avg Sold Each
- Avg Cost Each
- Avg Profit Each
- Quantity
- Total Sold
- Total Cost
- Total Profit
While the product cost report is separated by each product sold, the Sales report will summarize much of the same data with the focus on overall orders for the selected report period.
This is a basic overview of developing reports in Magento. If you need more assistance, or have further questions about Magento reports, contact one of our Magento experts today. Our team of experts is standing by to assist you with all of your Magento needs.