2012-01-09 1 views
1

私は、拡張カスタムオプションがあります。 注文/グリッド内のすべての商品に関連するオプションを表示したいと考えています。MAGENTOカスタムオプショングリッド

これは私が使用するコードです:

protected function _prepareCollection() 
{ 
$collection = Mage::getResourceModel('sales/order_grid_collection'); 

$collection->getSelect()->join 
(
'sales_flat_order_item', 
'sales_flat_order_item.order_id = main_table.entity_id', 
array 
(
'price' => new Zend_Db_Expr('group_concat(sales_flat_order_item.price SEPARATOR "<br><br><hr>")'), 
'proname' => new Zend_Db_Expr('group_concat(sales_flat_order_item.name SEPARATOR "<br><hr>")'), 
'proptions' => new Zend_Db_Expr('group_concat(sales_flat_order_item.product_options SEPARATOR "<br><hr>")'), 
) 
    ); 

    $collection->getSelect()->group('main_table.entity_id'); 
    $this->setCollection($collection); 

    return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection(); 
} 

私が得る結果は、製品に関連する製品オプションの不完全な配列です。

どのように私は(proptions)lables /タイトルを得ることができますか?

答えて

0

あなたreturnの文の上に次の行を追加し、私に出力を与えることはできますか?あなたが部分的な応答を得ているなら、SQLクエリ自体に関連しているかもしれないという気持ちがあります。あなたはまた、代わりに、内部のショットをleftJoin与えてみてください

Mage::log($collection->getSelect()->__toString()); 

は、クエリの構造に応じて、$collection->getSelect()->leftJoin()を使用して参加します。