有很多教程和建議,其中包括:安裝如何在magento訂單網格中正確添加shipping_description列?
我已經用下面的代碼修改Grid.php加入shipping_description精細基於各種技巧和竅門自定義擴展等,但是當涉及到分類整理通過價格或狀態它引發錯誤:
SQLSTATE [23000]:完整性約束違規:1052列中的「狀態」 where子句是模棱兩可 或 SQLSTATE [23000]:完整性約束違規:1052列在「increment_id」 where clause is ambiguous
它可以通過計費nd航運名稱。
下面的代碼添加到Grid.php:
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$tableName = Mage::getSingleton("core/resource")->getTableName('sales_flat_order');
$collection->getSelect()->join($tableName, "main_table.entity_id = $tableName.entity_id",array("shipping_description"));
$this->setCollection($collection);
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumnAfter('shipping_description', array(
'header' => Mage::helper('sales')->__('Delivery'),
'width' => '180px',
'type' => 'text',
'index' => 'shipping_description'
),'shipping_name');
return parent::_prepareColumns();
}
任何想法,意見,將不勝感激!
嗨liyakat,不幸的是你的解決方案沒有奏效。它仍然將我重定向到儀表板併發出上述SQLSTATE [23000]錯誤... – mike