i'm following this tutorial to create the grid for custom report, and to get the collection there's a function which accept the from date and to date like this:

public function setDateRange($from, $to) {
                'i' => $this->getTable('sales/order_item')),
                'i.order_id = main_table.entity_id'
            ->where('i.parent_item_id is null')
            ->where("i.created_at BETWEEN '".$from."' AND '".$to."'")
            ->where('main_table.state = \'complete\'')
            ->columns(array('ordered_qty' => 'count(distinct `main_table`.`entity_id`)'));
      //  uncomment next line to get the query log:
      //  Mage::log('SQL: '.$this->getSelect()->__toString(),null,'query.log');
       return $this;

the problem is i need to create a custom collection, to load the customer data, including the product item data which customer already ordered like this:



Your Answer

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

Browse other questions tagged or ask your own question.