2013-02-07 113 views
0

我知道這篇文章是類似於其他人發佈在這裏在Stackoverflow,但真的,我嘗試給出的解決方案,並不適合我。Magento 1.7.2 - 添加自定義字段在管理,銷售,訂單

我正在關注本教程:http://www.excellencemagentoblog.com/magento-create-custom-payment-method。在第2步結束時,我應該在Admin => Sales => Order中看到我的字段,但我什麼都看不到。

在sales_flat_quote_payment中,我可以看到「telefono_no」字段和sales_flat_order_payment。當我買東西時,Magento將電話數據(telefono_no)保存在數據庫中。無論如何,我的mysql4安裝-0.1.0.php是:

$install = $this; 
$install->startSetup(); 

$install->run(" 
    ALTER TABLE `".$install->getTable('sales/quote_payment')."` ADD `telefono_no` VARCHAR(7) NOT NULL DEFAULT '0000000'; 
    ALTER TABLE `".$install->getTable('sales/order_payment')."` ADD `telefono_no` VARCHAR(7) NOT NULL DEFAULT '0000000'; 
"); 

$install->endSetup(); 

而在我的config.xml中我有:

<?xml version="1.0"?> 
<config> 
    <modules> 
     <Xs_Pago> 
      <version>0.1.0</version> 
     </Xs_Pago> 
    </modules> 
    <global> 
     <fieldsets> 
      <sales_convert_quote_payment> 
       <telefono_no> 
        <to_order_payment>*</to_order_payment> 
       </telefono_no> 
      </sales_convert_quote_payment> 
     </fieldsets> 
    </global> 
</config> 

我真的不知道發生了什麼錯誤。

回答

0

有關代碼應只添加字段到數據庫,並在訂單發生時將值從quote_payment複製到order_payment。

的代碼將不會顯示任何信息,該信息是在你提到的例子中顯示的原因是因爲Mage_Payment_Block_Info

<?php 
class Excellence_Pay_Block_Info_Pay extends Mage_Payment_Block_Info 
{ 
    protected function _prepareSpecificInformation($transport = null) 
    { 
     if (null !== $this->_paymentSpecificInformation) { 
      return $this->_paymentSpecificInformation; 
     } 
     $info = $this->getInfo(); 
     $transport = new Varien_Object(); 
     $transport = parent::_prepareSpecificInformation($transport); 
     $transport->addData(array(
      Mage::helper('payment')->__('Check No#') => $info->getCheckNo(), 
      Mage::helper('payment')->__('Check Date') => $info->getCheckDate() 
     )); 
     return $transport; 
    } 
} 

看看@Magento custom "order" attribute/admin input and display

+0

若我明白你的答案,你告訴我,我遵循的示例是不完整的,並且在表「sales-order」中添加一列的唯一方法是創建一個新模板? 您發佈的代碼是幹什麼用的?我必須把它放在哪裏?在我的目錄「塊」? 我跟着你的鏈接,但沒有澄清任何東西。 – Javier

相關問題