SQL magento query sales report in reports

I want to add attributes like color, size, etc. and other attributes in the next query I don't know what an attribute query is. Please help me find out.

$form = Start Date 
$to = End Date
$this->_reset();
$this->getSelect()        
    ->joinInner(array(
          '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`)'));

enter image description here

Thanks Jitendra

+4
source share
1 answer

The sales order item table does not store every attribute of each product sold. Therefore, you need to decide whether you want to add these attributes to the table of sales order items when creating a sales order - or - if you want to simply view them in the product catalog.

The problem with adopting the first approach is that you will not be able to get data for orders made to date, and now only orders.

, , . , , ? - . , , , .

, , Magento. .

script, .

, . .

Magento, , . , , , '412' , . "". , .

, , "" (, ) .

, , , , Magento superattribute .

/. , , , .

0

Source: https://habr.com/ru/post/1529747/


All Articles