How to select specific fields with aliases using joinTable or joinField in Magento

前端 未结 3 1282
迷失自我
迷失自我 2021-02-15 06:29

I want to pre-filter* data in the invoice grid visible in Magento\'s admin panel.

Here is a question that I asked earlier, and this one is related to the solution prese

3条回答
  •  滥情空心
    2021-02-15 06:51

    Here is the total of my test script. To use put it in a file at the Magento root and type it's URL directly in your browser, it is not handled by Magento's controllers. This is a good way of experimenting as it is not as influenced by other modules, page layouts, etc.

    getSelect()->reset('columns');        
    $collection->joinTable('sales/order_grid', 'customer_id=entity_id', array('order_entity_id' => 'entity_id'));
    $collection->joinTable('sales/invoice_grid', 'order_id=order_entity_id', array('*'));
    
    foreach ($collection as $invoice)
        print_r($invoice->debug());
    
    ?>

    As with your previous question I choose to reset the initial columns because I don't believe in giving the database more work than necessary. However it's not essential, the test still succeeds without it.

    If this doesn't work in your installation then we need to consider what that outside influence could be.

提交回复
热议问题