2013-06-12 31 views

回答

1

有3个步骤。

第一:找到该文件:

应用程序/代码/核心/法师/ Adminhtml /座/销售/订单/创建/搜索/ Grid.php

并复制于:

应用程序/代码/本地/法师/ Adminhtml /座/销售/订单/创建/搜索/ Grid.php

这将有助于确保您不覆盖核心文件,而是创建不受升级影响的本地版本。

二:在新文件中,_prepareCollection()函数将有这样的代码:

$collection = Mage::getModel('catalog/product')->getCollection(); 
    $collection 
     ->setStore($this->getStore()) 
     ->addAttributeToSelect($attributes) 
     ->addStoreFilter() 
     ->addAttributeToFilter('type_id', array_keys(
      Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray() 
     )) 
     ->addAttributeToSelect('gift_message_available'); 

将此代码添加到该块:

 ->joinField('qty2', 
      'cataloginventory/stock_item', 
      'qty','product_id=entity_id','{{table}}.stock_id=1','left') 

,以保证最终版本看起来例如:

$collection = Mage::getModel('catalog/product')->getCollection(); 
    $collection 
     ->setStore($this->getStore()) 
     ->addAttributeToSelect($attributes) 
     ->joinField('qty2', 
      'cataloginventory/stock_item', 
      'qty','product_id=entity_id','{{table}}.stock_id=1','left') 
     ->addStoreFilter() 
     ->addAttributeToFilter('type_id', array_keys(
      Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray() 
     )) 
     ->addAttributeToSelect('gift_message_available'); 

第三:还是在新文件中,找到_prepareColumns()函数,并添加以下代码:

$this->addColumn('qty2', array(
     'header' => Mage::helper('sales')->__('Stock Level'), 
     'width'  => '20', 
     'type'  => 'number', 
     'index'  => 'qty2' 
    )); 

当您添加上面的代码块到_prepareColumns()函数将确定在“股票的顺序级别“列将显示在网格上。

就是这样。