我想自定义字段(HTML文本框)添加到产品页面管理部分。我下面一些在这个论坛上,并从谷歌的答案。
这是我在override/classes/Product.php
类代码:
class Product extends ProductCore{
public $product_modal;
function __construct( $id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null ) {
Product::$definition['fields']['product_modal'] = array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString');
parent::__construct( $id_product, $full, $id_lang, $id_shop, $context );
}
这是informations.tpl
文件:
<div class="form-group">
<label class="control-label col-lg-3" for="product_modal">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Product modal'}">
{$bullet_common_field} {l s='Product modal'}
</span>
</label>
<div class="col-lg-3">
<input type="text" id="product_modal" name="product_modal" value="{$product->product_modal|escape:'html':'UTF-8'}" />
</div>
</div>
我看到在产品管理页面中的新领域,但是当我尝试保存我得到这个错误:
在更新对象时发生错误。产品()
我怎样才能在产品页面添加一个新的领域,是有标准的PrestaShop方法,使像描述字段文本框该字段或我需要第三方的jQuery插件,为的例子吗?
郎字段不与该台ps_product
相关,郎领域都涉及到表ps_product_lang
,那是你的问题。