简体   繁体   中英

Magento $collection->join - Multiple

I'm currently extending the Magento Invoice Grid to display some additional columns. I've got the data that I need for most, but I'm struggling to get more than 1 Column from the same Database Table.

This is what I have in my _prepareCollection

$collection->join('invoice','main_table.entity_id=invoice.entity_id','subtotal');
$collection->join('invoice','main_table.entity_id=invoice.entity_id','discount_description');

I assume I need to drop the second line and put them into somekind of array, I'm just not sure on how to do that as I don't work with PHP too much.

Thanks.

Oh, this was much more simple than I was expecting, I managed to work it out with the following:

    $collection->join('invoice', 'main_table.entity_id = invoice.entity_id', array(
        'subtotal',
        'discount_description'
    ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM