[英]Magento $collection->join - Multiple
I'm currently extending the Magento Invoice Grid to display some additional columns. 我目前正在扩展Magento发票网格以显示一些其他列。 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. 我已经获得了最需要的数据,但是我很难从同一个数据库表中获得1列以上的数据。
This is what I have in my _prepareCollection
这就是我的_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. 我认为我需要删除第二行并将它们放入某种数组中,我不确定如何做到这一点,因为我对PHP的使用不太多。
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'
));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.