2015-09-06 98 views
0

我想在後臺的產品中添加一個新的自定義字段並僅使用整數對其進行驗證。我做了什麼:如何使用prestashop中的產品添加新的自定義字段?

  1. 首先,我已經加入ps_product表中的新列命名爲member_id默認值爲0

  2. 其次,我把HTML中prestashop_project_folder\admin\themes\default\template\controllers\products\informations.tpl

    <div class="form-group"> 
        <label class="control-label col-lg-3" for="member_id"> 
          {l s='Enter Member Id'} 
        </label> 
        <div class="col-lg-5"> 
         <input type="text" id="memberId" name="memberId" value="{$product->memberId|default:''}" /> 
        </div> 
    </div> 
    

現在,我該怎麼辦?什麼是下一個步驟?

回答

1

首先,使用的Prestashop覆蓋添加自定義代碼: http://doc.prestashop.com/display/PS16/Overriding+default+behaviors

要覆蓋管理模板,使用說明:http://doc.prestashop.com/display/PS15/Using+helpers+to+overload+a+back-office+template

下一步是加在覆蓋產品類的自定義字段(申報並添加定義數組)。

不要忘記在每次覆蓋後刪除cache/class_index.php。

+0

非常感謝Garry的回覆,但我添加了這樣的新字段:[http://connectonline.in/new-filed-for-product-page-in-prestashop-1-6/][1] 。可否請告訴我是否正確。 [1]:http://connectonline.in/new-filed-for-product-page-in-prestashop-1-6/ – user1990

+0

正確的方法是覆蓋所有更改,您將更新您的prestashop沒有問題。 您的教程很棒,您應該在產品後臺看到您的自定義字段。沒有? 已在此處發佈的問題:http://stackoverflow.com/questions/15475509/add-a-field-in-edit-product-page-of-prestashop-admin –

相關問題