strife's devLog

prestashop-logoHow to Add a New Custom Field in Prestashop

I’ve figured out how to add new field to database using Prestashop (1.4.3, but I think for the newer versions would be the same). This solution gives you new field in database and you will be able to edit / save data to this field in your admin panel, for my example I needed a field which was called “number of photos”. Below you can see how it works.

When you want to get it you should make some improvements. First of all just create a new field in your database it will be called “nb_photos” in my case.

And then:

1. Open AdminProducts.php file (/[admin_panel]/tabs/AdminProducts.php) and add this line (line 2194):

2. Open Product.php (classes/Product.php) and add:

Line 130

Line 231

Line 340

And that’s all.

If you need some more information about it just let me know using comments box :)


56 ResponsesLeave one →

  1. Miguel Rojas

     /  March 16, 2012

    hello, great job !!!

    any question… for modify ?????

  2. Miguel Rojas

     /  March 16, 2012

    but if field is a text field ???
    ‘my_new_field’ => ‘isUnsignedInt’, // this field ?????
    ‘my_new_field’ => ‘isText’ OR I NEED Tools:GetValue() ????????

  3. Giacomo

     /  April 2, 2012

    Thank a lot for your guide!

    and to display this value in front office?

    • Hi,

      I think you’ve already found the solution for it but let me anwer (maybe somebody else will need this information).

      In frontend you should use something like that:


      Let me know if it’s working or if you have any questions.


  4. sepahan

     /  April 10, 2012

    how to show this field in fo????

  5. pradyuman

     /  April 20, 2012

    Thank You very much…
    I have used your instruction and it is working fine.

  6. pradyuman

     /  April 24, 2012

    Now I have just inserted a field as wholesaler price at admin panel and that is inserted at product table but how the wholesaler price will go to product page and how when a wholesaler will login at that time how he/she can buy their product with their wholesaler price not the retailer price.
    I have already tried for grouping but grouping is not fullfilling my requirements then how will I do?
    Please help me asap…I expect help from you.

    • I assume the issue is after getting a payment I am right? You want to put the new price instead of old one? :>

      The ugly solution for this is … to make changes in the model. You can simply go to the model and put the condition if person is a wholesaler and then return the appropriate price.

      Does it make sense?
      Let me know if it’s still ready to solve :)


  7. so how to make new field for ‘dollar price’, i use prestashop v.1.3.6.
    please help me

    thanks before

    • Hi,

      That’s pretty simple if I understand well what you’ve said. What you’re gonna do is go to the product details and click to the “Prices” tab. And then you’ll see what you wanna get.

      However, I am not sure if this is what you wanted. In other words it’s not necessary to make a new field for this dollar price coz you can configure it already (All products can have a specific price for each currency).

      How I see that

      Even though, if you really want to create a new field you can just do it in the way that I wrote and print it out in the frontend this way (

      Let me know if this helps or not :)


  8. VERO20

     /  July 31, 2012

    Hello! how would you do that for text?

    • Hi VERO20,

      You can do it by the same token as you’re doing it for integer. Check the whole Product.php and try to find any text fields and copy it. If you had problems let me know.


  9. zounars

     /  August 7, 2012

    Thank you for your tutorial.
    How can I add a datepicker to the custom field?

  10. Julius

     /  August 11, 2012


    Try to use jquery ui datepicker. It is very easy to integrate.

  11. antony

     /  August 27, 2012

    add custom field in Combination tab

  12. arnold

     /  September 5, 2012


    I tried your tutorial, the only difference is that custom field is an ENUM just like condition, with Prestashop 1.4.9 i’m getting:
    An error occurred while updating object. product (), did anyone encounter this?

    • Hi arnold,

      That’s interesting. Thanks for this spot. Do you have any more errors occurred? It’s quite less information to help you without working on your version …


  13. Hernan

     /  September 5, 2012


    where insertion is performed on data, ie , the data insert.
    in what php document or is in the same product.php

  14. Hello every one, I am trying to integrate a date picker in order-carrier.php
    But don’t it don’t seems to work. It is as if the css is not taken into consideration.
    Any help will be welcome.
    Thank you

  15. Lucas

     /  September 17, 2012


    Im in big need of adding a text field to the check out-process. I need them to write a number (for identification) and I need to receive it.

    Can I use any of your code for this?


  16. strife

     /  December 6, 2012

    Sorry for late reply.
    Yes sure you can do whatever you do with this.


  17. RBucci

     /  December 12, 2012


    I’m really grateful for your tutorial, however taking a closer look, I was wondering if you could give me a hand with what I need to do;

    I’m creating a cart for a company that doesn’t have clients but employees. The employees are salesmen that will be connected to the website via a tablet each time they visit a client in order to send the order to the main office. The problem is that they need to be able to have the main price as well as a blank field in which they can input the price with which they agreed on with the final customer.

    I’m in need to enable a blank textfield (modifiable by the employees) under the price in all the products pages before the “Add to Cart” button so that afterwards, in the Shopping Cart Summary it will behave like the normal price (adding the total to the bottom) and storing it as a record for the employees to keep track of their comissions in the order history. And if possible, including those prices in the confirmation email.

    If there’s any way to do this, I will be able to sleep at night once again.. I’ve been trying very hard to do this but so far I got nowhere near..

    Thank you so much for your time!!!

  18. Hi RBucci,

    Ok. So I can suggest you to modify the model in the Prestashop. What you need to do is:

    Find the model for products and modify it in the way that enables you to affect to the price. I think you can use sessions because each of employers would put the price manually.

    I mean something like this:

    < ?php function getPrice() { // and here you can check if something is in the sessions // and replace it instead of actual product price } ?>

    I don’t know if you want to replace the current price or just only add the new field above/below it. However, I understand that you want to replace it. And this solution should fix your problem. If not let me know.

    Any questions feel free to ask.


    • RBucci

       /  December 12, 2012

      I really don’t understand what you mean with that code, Maciej. Maybe you could exemplify?


  19. carlos soratto

     /  February 8, 2013


  20. Bruna

     /  February 27, 2013

    Congratulation for your tutorial, it work very well!

    You save my day Strife, thanks a lot!

    (VERO20) FOR TEXT:

    Instead of adding this:

    ‘nb_photos’ => ‘isUnsignedInt’, // this field

    add this:

    ‘nb_photos’ => ‘isString’, // this field

    and on the first step you need to alter the data type(INT for VARCHAR(100) or char(50))


  21. Bruna

     /  March 4, 2013

    Hi how can i add fields in a module tpl?


  22. muhsin

     /  April 4, 2013

    i am new to prestashop and now i am creating custom API for a mobile app.
    i want a custom sql query to get cart and cart products of a loged customer.

  23. Recox

     /  July 29, 2013

    Can you explain , how can we import/export csv the new fields that we created in the products table???

  24. hey nice work,

    I want to add tag field in manufacturer page…
    You have any idea what i have to do for that…
    Also in tag field array generate so how i insert it in db.


    manufacturer name ashish
    tag field aish, aashish, asish

    So how i insert it in db ?
    Thank you

  25. Nelson

     /  November 25, 2013


    Great help.

    I just have one question. I need the field to be a Link, instead of text.

    Basically i want the field to be called “Manufacturers URL”, insert the product link for the manufacturers webpage in the backoffice and in the front office the client can click on “Manufacturers URL” to get into manufacturers page.

  26. Nelson

     /  November 25, 2013

    I am having difficulties with this on 1.5.6.

    I don’t find the AdminProducts.php, only AdminProductsController.php, under /Controllers/Admin

    is this file?

    Also, in product.php my file does not have this type strings anywere

    $fields[‘ean13′] = pSQL($this->ean13);
    $fields[‘nb_photos’] = pSQL($this->nb_photos);
    $fields[‘upc’] = pSQL($this->upc);

    Nevertheless i’ve tried to do this in this files, and the backoffice product page stops working. I had to put back the original files

  27. Roland

     /  December 12, 2013

    Thankyou. Is perfect

  28. Patrick

     /  January 6, 2014


    In Prestashop, there are only tow lines for the customer address.

    Some times, 2 lines is not enough to write a precise address, that can include a building n°, a stair n° and so on.
    On some well known sites, I could see up to 4 lines to write the customer address.

    Would you know how to add a field to the customer address, both when he orders as a registered customer or as a guest.

    Thank you in advance for any help in this matter.


  29. Hi,

    Can you alter this code so an extra text field for various comments is shown in each order seperately?


  30. Faran ALi

     /  February 28, 2014

    Where have to place this

    $fields[‘nb_photos’] = pSQL($this->nb_photos);

    not working on classes/product.php
    line 340

  31. Hi,
    If i want to add a label with check field to show a icon (like best offers) inside a product image in frontend what can i do?

    Thank you in advance for your help

  32. Roberto

     /  April 11, 2014

    I think coding will be tough for a non-technical person, mos website owners will not have that expertise to code it, here a forum thread from prestashop that talks about a module that allows you to add custom checkout fields

  33. strife

     /  April 11, 2014

    Hi there,

    Thank you all for comments.

    @Roberto – It looks pretty nice but you have to pay for this module. Might I should write something for free for the community. There are lots of feedbacks about this post on Google and ppl really want to have it.

    Thank you once again. I will keep you posted guys.

  34. Marie

     /  September 15, 2014


    Sorry for my bad English.

    I want to add extra fields on my checkout page like I want to add “refer to friend”, ID card number & Blood group. how I can add?

  35. asdfjklm

     /  January 23, 2015

    Hey! I don’t know the right solution. But its bad idea to modify the core of prestashop. Because, If you upgrade prestashop to newer version, changes may be lost. You should try to override the classes by putting in override directory of your theme. :)

  36. You’re right. It’s ugly solution. I will update this post soon to provide more elegant solution for this problem.



  37. Amelia

     /  July 15, 2015

    Hi, I was just looking to add some field on checkout page of my shop at checkout step#4, in fact adding a text box there. I looked on your tutorial but it seems out dated as depicted in comments. I also looked for modules to get solution for my site and found one.
    I have to ask from you that you are going to update the tutorial or I will go for a paid solution.
    Thanks in advance

  38. Ahaa, its pleasant conversation on the topic of thos pos here at this blog,
    I have readd all that, so nnow me also commenting here.

  39. How to add file type fields in registration ?

  40. Say we want to upload the customer image in the same table. The field name will be Upload Your Profile Picture. How to do that in prestashop ?

  41. Thanks for another magnificent post. Where else may just anyone get that type of information in such
    an ideal means of writing? I’ve a presentation next week, and I’m at the look for such

  42. 5 Blogging Tips To Start Internet Home Business

  43. boris

     /  June 18, 2021
  1. Add costum field to product PrestaShop - PrestaShop Türkiye
  2. how i can add custom fields in product on prestashop 1.5.3? - PrestaShop Türkiye
  3. how add custom field in products prestashop 1.5.4 - PrestaShop Türkiye
  4. Additional Fields on Checkout Page –

Leave a Reply