2011-02-04 80 views
3

我正在設計Magento 1.4.2中的管理模塊。我正在開發顯示產品詳細信息(產品名稱,SKU,價格,特價,數量)的網格佈局,我顯示了所有列。我無法弄清楚如何在一列中顯示特價。我無法檢索特價。幫我解決這個問題。在magento的管理面板中添加特殊價格的新列

我使用此代碼獲取價格。

$collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId()); 

此代碼我用於爲價格添加一列。

$this->addColumn('price', array(
      'header' => Mage::helper('catalog')->__('Price'), 
      'type' => 'number', 
      'width'  => '1', 
      'currency_code' =(string)Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE), 
      'index'  => 'price', 
     'editable' =>true 
      )); 

但我不能這樣做的特殊價格。

+4

也請告訴你如何準備集合此網格。 – clockworkgeek 2011-02-04 11:46:47

回答

6
 $collection->joinAttribute('special_price', 'catalog_product/special_price', 'entity_id', null, 'left', $store->getId()); 

再補充一點:

$this->addColumn('special_price', 
     array(
      'header'=> Mage::helper('catalog')->__('Special Price'), 
      'type' => 'price', 
      'currency_code' => $store->getBaseCurrency()->getCode(), 
      'index' => 'special_price', 
    ));