giwrgos Posted January 11, 2013 Share Posted January 11, 2013 Hello i want to add 2 extra custom fields on the product's page. i used this tutorial on the pass when i was on 1.4 http://strife.pl/2011/12/how-to-add-new-custom-field-in-prestashop/ put now this tutorial is not working for 1.5.3 because is not any AdminProducts.php in /[admin_panel]/tabs/AdminProducts.php Does any one know how i can do it? i'm looking an english solution. Thank you Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted January 11, 2013 Share Posted January 11, 2013 Hi, Please, take a look at our Product Tabs module. It may be interesting for you. The module is compatible with PrestaShop 1.5.3. and provides multilingual support. Feel free to reply with any other questions or concerns. Best regards. Link to comment Share on other sites More sharing options...
giwrgos Posted January 22, 2013 Author Share Posted January 22, 2013 Hi, Please, take a look at our Product Tabs module. It may be interesting for you. The module is compatible with PrestaShop 1.5.3. and provides multilingual support. Feel free to reply with any other questions or concerns. Best regards. i dont want to addd tab on my products. I just want to add an extra field Link to comment Share on other sites More sharing options...
El Patron Posted January 22, 2013 Share Posted January 22, 2013 back office-->catalog-->products edit a product click customizaton Enter number of text fields you want click save and stay Define the label(s) of the text fields and if required save it now visit the product in your front office Link to comment Share on other sites More sharing options...
PhiLho Posted January 22, 2013 Share Posted January 22, 2013 The equivalent to AdminProducts.php is now admin/themes/default/template/controllers/products/informations.tpl or similar (depending on which sub-tab you want to add your field). v.1.5 relies more on Smarty to generate these pages. 1 Link to comment Share on other sites More sharing options...
kiranrathod Posted February 9, 2013 Share Posted February 9, 2013 (edited) any idea of adding extra field in product combination tab. i am using prestashop 1.4.7.3 i did in product info tab it is working but in combination tab it is not inserting value in database.. please help me out i am fed up of this issue i have done like this for product info tab but i have problem with adding extra field in combination tab http://strife.pl/2011/12/how-to-add-new-custom-field-in-prestashop/ Edited February 9, 2013 by kiranrathod (see edit history) Link to comment Share on other sites More sharing options...
kiranrathod Posted February 9, 2013 Share Posted February 9, 2013 any idea of adding extra field in product combination tab. i am using prestashop 1.4.7.3 i did in product info tab it is working but in combination tab it is not inserting value in database.. please help me out i am fed up of this issue i have done like this for product info tab but i have problem with adding extra field in combination tab http://strife.pl/201...-in-prestashop/ 1 Link to comment Share on other sites More sharing options...
toninovak66 Posted March 29, 2013 Share Posted March 29, 2013 Is it possible to add more than just a text or file upload field to the product customizations? That really doesn't do much to customize the product. I'm looking for a way to add drop down boxes like in the attributes section so customers can pick styles for embroidery. But I want them to show up in the customization tab, not in the options section. 1 Link to comment Share on other sites More sharing options...
nspinheiro Posted November 25, 2013 Share Posted November 25, 2013 Hi I am gathering this topic back because i've also tried to add a new field based on http://strife.pl/2011/12/how-to-add-new-custom-field-in-prestashop/ instructions, but in 1.5.6 without success. I've you managed to put this to work? Link to comment Share on other sites More sharing options...
vekia Posted November 25, 2013 Share Posted November 25, 2013 check this, is based on 1.5.6: prestashop new product field 1 Link to comment Share on other sites More sharing options...
nspinheiro Posted November 25, 2013 Share Posted November 25, 2013 check this, is based on 1.5.6: prestashop new product field ADMIN_DIR/themes/default/template/controllers/products/informations.tpl I only have this file in Default theme, but i am not using this theme. Will this be a problem? In my theme i don't have a file with that name Link to comment Share on other sites More sharing options...
El Patron Posted November 25, 2013 Share Posted November 25, 2013 add a simple field to PrestaShop, from a development standpoint, i.e. implementable installable module is horrible...it's really to bad as so many nice and cool features could be done...now it's forced that we add an additional tab...otherwise...we have to hack it.... for example, it would take 'nothinga ' to add a mrsp module..but do we really want need to add a new tab or otherwise create something as described that could 'not' today be accepted in addon's... thanks in advance for letting me explain my view of current ps and backoffice module writing... Link to comment Share on other sites More sharing options...
nspinheiro Posted November 25, 2013 Share Posted November 25, 2013 (edited) ADMIN_DIR/themes/default/template/controllers/products/informations.tpl I only have this file in Default theme, but i am not using this theme. Will this be a problem? In my theme i don't have a file with that name Forget This I was being dumb. It worked fine. EDIT: Nevertheless i am having a problem. The Field that i've added is like a "Recommended Street Retail price" So i've added in product.php In object: /** @var float pvpr */ public $pvpr = 0; In Definition: 'pvpr' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'), in prices.tpl i've added <tr> <td class="col-left"> <label>{l s='PVPr c/IVA:'}</label> </td> <td style="padding-bottom:5px;"> <input type="text" id="pvpr" name="pvpr" value="{$product->pvpr|default:''}"/> </td> </tr> <br /> However in the backoffice when i try to input the value, i receive this error: Edited November 25, 2013 by nspinheiro (see edit history) Link to comment Share on other sites More sharing options...
nspinheiro Posted November 25, 2013 Share Posted November 25, 2013 (edited) [Adicional information... i've replaced with my original backup files and dropped the field in the table... and the problem persists... After that i've dropped my db and put back an backup from this morning, before doing anything. problem persists. Is it possible that it is a totally different issue?] Forget this Edited November 25, 2013 by nspinheiro (see edit history) Link to comment Share on other sites More sharing options...
nspinheiro Posted November 25, 2013 Share Posted November 25, 2013 Problem is in product.php code: So i've added in product.php In object: /** @var float pvpr */ public $pvpr = 0; In Definition: 'pvpr' => array('type' => self::TYPE_FLOAT, 'shop' => true, 'validate' => 'isPrice'), I've noticed i was not using the correct backup file, when i used it all became normal. Can someone give me an idea we're is the problem in this code? Link to comment Share on other sites More sharing options...
nspinheiro Posted November 26, 2013 Share Posted November 26, 2013 Solved. I've just done everything has explained without changing anything. I though i had to adapt the code for being a price Link to comment Share on other sites More sharing options...
mauinsons Posted December 31, 2013 Share Posted December 31, 2013 Hi nspinheiro, I've followed the instructions and I got the same error "An error occurred while updating an object. product ()when I tried to save the changes. May I know what have you change to solve this? in my information.tpl I've added <!-- added warranty field --> <tr> <td class="col-left"> <label>{l s='Warranty:'}</label> </td> <td style="padding-bottom:5px;"> <input type="text" id="warranty" name="warranty" size="80" value="{$product->warranty|default:''}"/> </td> </tr> <!-- added warranty field --> in Product.php I've added: /** @var string Warranty */ public $warranty; 'fields' => array( // Classic fields 'warranty' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'), Link to comment Share on other sites More sharing options...
mauinsons Posted December 31, 2013 Share Posted December 31, 2013 Never mind i solved it. Noticed that I've edited the wrong table. Sorry Link to comment Share on other sites More sharing options...
NemoPS Posted April 22, 2014 Share Posted April 22, 2014 You can try out mine as well! http://nemops.com/extending-prestashop-objects/#.U1Y-XPna6r0 1 Link to comment Share on other sites More sharing options...
Keron83 Posted July 3, 2014 Share Posted July 3, 2014 (edited) I've got a question about Vekia's tutorial. What do I need to change to let it work for a dropdown box?I used the same method as condition (but does not work)Getting the error: "An error occurred while updating an object. product ()when I tried to save the changes. //Product.php 'name_category_gg' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('option a', 'option b'), 'default' => 'option a'), and in my informations.tpl file: //informations.tpl <td style="padding-bottom:5px;"> <select name="name_category_gg" id="name_category_gg"> <option value="option a" {if $product->name_category_gg == 'option a'}selected="selected"{/if}> option a </option> <option value="option b" {if $product->name_category_gg == 'option b'}selected="selected"{/if}> option b </option> </select> </td> Hope someone can help. Edited July 3, 2014 by Keron83 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 4, 2014 Share Posted July 4, 2014 turn on debug mode, perhaps it will spawn some more detailed info Link to comment Share on other sites More sharing options...
Keron83 Posted July 4, 2014 Share Posted July 4, 2014 (edited) oops.. saw the error and fixed it.. sorry for being noobish thanks! Edited July 4, 2014 by Keron83 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 4, 2014 Share Posted July 4, 2014 hello thank you for cofnirmation may i know where the error was? and how you fixed it? Link to comment Share on other sites More sharing options...
Keron83 Posted July 4, 2014 Share Posted July 4, 2014 (edited) Sure. Error: Column: name_category_gg did not exist. I created an extra column (name_category_gg) in table product not in table product_shop. So went back to my product.php and edit this line: //product.php 'name_category_gg' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('option a', 'option b'), 'default' => 'option a') to: 'name_category_gg' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'values' => array('option a', 'option b'), 'default' => 'option a') Now it's working. Edited July 4, 2014 by Keron83 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 5, 2014 Share Posted July 5, 2014 i thought that there was an information about creating new field in database thank you for information how you solved it. with regards, Milos Link to comment Share on other sites More sharing options...
TheWolf Posted March 14, 2015 Share Posted March 14, 2015 (edited) You can try out mine as well! http://nemops.com/extending-prestashop-objects/#.U1Y-XPna6r0 Hello! I tried following this manual in order to add a new field called : "Warranty" in order to add terms of warranty to the product page but i get errors all the time, I think it is related to this line in your manual that i didn't understand and did not know what to do with it: "always be sure the extra field is added to the definitions list before calling the parent constructor" Can you explain to me what does this mean and what do i need to edit in order to add the warranty field i added in the ps_product table to the definitions list? This wasn't clear in your manual. Thank you p.s. I'm using Prestashop 1.6.0.11 Edited March 14, 2015 by TheWolf (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted March 16, 2015 Share Posted March 16, 2015 It refers to the code, see that line where you extend the definitions property? It must be written before parent::constructAlso, turn on error reporting as described in my signature Link to comment Share on other sites More sharing options...
kirubanidhi Posted July 31, 2017 Share Posted July 31, 2017 (edited) For ex, I created a dropdown box field. I clicked “yes” option to all created field then go to click save button. Refer in my page, value is not set in my product page. Dropdown value is not updated in the database. code: classes/product.php: public $hazmat_fees; public $poison_pack; public $refrigerated_fees; prestashop/themes/default/template/controllers/products/information.tpl <div class="form-group"> <div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="hazmat_fees" type="default"}</span></div> <label class="control-label col-lg-2" for="hazmat_fees"> {l s='Hazmat Fees:'}</label> </label> <div class="col-lg-3"> <select name="hazmat_fees" id="hazmat_fees"> <option value="1" {if $product->hazmat_fees == '1'}selected="selected"{/if} >{l s='Yes'}</option> <option value="0" {if $product->hazmat_fees == '0'}selected="selected"{/if} >{l s='No'}</option> </select> </div> </div> <div class="form-group"> <div class="col-lg-1"><span class="pull-right"> {include file="controllers/products/multishop/checkbox.tpl" field="poison_pack" type="default"}</span></div> <label class="control-label col-lg-2" for="poison_pack">{l s='Poison Pack:'}</label> <div class="col-lg-3"> <select name="poison_pack" id="poison_pack"> <option value="1" {if $product->poison_pack == '1'}selected="selected"{/if} >{l s='Yes'}</option> <option value="0" {if $product->poison_pack == '0'}selected="selected"{/if} >{l s='No'}</option> </select> </div> </div> <div class="form-group"> <div class="col-lg-1"><span class="pull-right"> {include file="controllers/products/multishop/checkbox.tpl" field="refrigerated_fees" type="default"}</span></div> <label class="control-label col-lg-2" for="refrigerated_fees">{l s='Refrigerated Fees:'}</label> <div class="col-lg-3"> <select name="refrigerated_fees" id="refrigerated_fees"> <option value="1" {if $product->refrigerated_fees == '1'}selected="selected"{/if} >{l s='Yes'}</option> <option value="0" {if $product->refrigerated_fees == '0'}selected="selected"{/if} >{l s='No'}</option> </select> </div> </div> Edited July 31, 2017 by kirubanidhi (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted July 31, 2017 Share Posted July 31, 2017 Did you extend the class as well, as described here?http://nemops.com/extending-prestashop-objects/#.WX7_t4iGOUk Link to comment Share on other sites More sharing options...
kirubanidhi Posted July 31, 2017 Share Posted July 31, 2017 @nemops, I created three variable in a group.php file and I forget to add those variable in the database. This problem is solved. Link to comment Share on other sites More sharing options...
Recommended Posts