user1990
user1990

Reputation: 1067

How can I add new custom field with products in prestashop?

I want to add a new custom field at products in back office and validate it with integer only. What have I done:

  1. Firstly, I have added a new column in ps_product table named as member_id with default value 0.

  2. Second, I put html in 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>
    

Now, what can I do? What are the next steps?

Upvotes: 0

Views: 4824

Answers (1)

Garry Cooper
Garry Cooper

Reputation: 206

First, use Prestashop overrides to add your custom code: http://doc.prestashop.com/display/PS16/Overriding+default+behaviors

To override admin templates, use: http://doc.prestashop.com/display/PS15/Using+helpers+to+overload+a+back-office+template

Next step is to add your custom field in an override Product class (declare and add to definition array).

Don't forget to remove cache/class_index.php after each override.

Upvotes: 1

Related Questions