Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
按网格magento的顺序在joinLeft中描述排序信息_Magento - Fatal编程技术网

按网格magento的顺序在joinLeft中描述排序信息

按网格magento的顺序在joinLeft中描述排序信息,magento,Magento,我想添加“销售\公寓\订单\状态\历史记录”表中的最后一条评论 $collection->getSelect()->joinLeft('sales_flat_order_status_history', 'main_table.entity_id = sales_flat_order_status_history.parent_id', array('comment'=> new Zend_Db_Expr( '(SELECT group_concat( `sales_flat_

我想添加“销售\公寓\订单\状态\历史记录”表中的最后一条评论

$collection->getSelect()->joinLeft('sales_flat_order_status_history',
'main_table.entity_id = sales_flat_order_status_history.parent_id',
array('comment'=> new Zend_Db_Expr(
'(SELECT group_concat( `sales_flat_order_status_history`.comment SEPARATOR ",")
FROM `sales_flat_order_status_history` As `sales_flat_order_status_history`  
WHERE `main_table`.`entity_id` = `sales_flat_order_status_history`.`parent_id` )')));

但这不是工作。有人能帮我吗?

经过几天的尝试,我找到了答案:

$collection->getSelect()->joinLeft('
sales_flat_order_status_history', 'main_table.entity_id = 
sales_flat_order_status_history.parent_id',array('
comment'=> new Zend_Db_Expr('(
SELECT `sales_flat_order_status_history`.comment 
FROM `sales_flat_order_status_history` 
As `sales_flat_order_status_history`
WHERE `main_table`.`entity_id` = `sales_flat_order_status_history`.`parent_id`
ORDER BY `sales_flat_order_status_history`.entity_id DESC LIMIT 0,1)')));
也许这对某人有用