tom3k_21 Posted September 16, 2014 Share Posted September 16, 2014 (edited) Hello, I have a problem with adding extra field on product page based on tutoriale http://mypresta.eu/en/art/developer/new-field-product-backoffice.html I have created table 'custom_field1' in ps_product in class/Product.php added public $custom_field1; and in public static $definition = array( 'custom_field1' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'), in admin7543\themes\default\template\controllers\products\features.php <td class="col-left"> <label>{l s='Feature1:'}</label> </td> <td style="padding-bottom:5px;"> <input type="text" id="custom_field1" name="custom_field1" value="{$product->custom_field1|default:''}"/> </td> field is showing but it doesent saving data only getting blank error: Wystąpił błąd podczas aktualizacji obiektu. product () what else i have to chagne to save data and show the information on product page? Edited September 16, 2014 by tom3k_21 (see edit history) Link to comment Share on other sites More sharing options...
gabrielchiron Posted September 16, 2014 Share Posted September 16, 2014 (edited) In the class: 'custom_field1' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString', 'size' => 255), And: public $custom_field1; In the TPL: <td style="padding-bottom:5px;"> <input size="55" maxlength="255" type="text" name="custom_field1" value="{$product->custom_field1|htmlentitiesUTF8}" style="width: 150px; margin-right: 5px;" /> </td> And I recommend you put the class and the controller in override folder ^^ Edited September 16, 2014 by gabrielchiron (see edit history) Link to comment Share on other sites More sharing options...
gchansc Posted April 13, 2015 Share Posted April 13, 2015 I am also having trouble with getting and updating values into the custom field in Mysql too. Can anyone know what to do to make it work in Prestashop V1.6? Thanks! Link to comment Share on other sites More sharing options...
beshop Posted July 15, 2015 Share Posted July 15, 2015 Same problem. can anyone help me? thanks Link to comment Share on other sites More sharing options...
Alex01d Posted November 3, 2015 Share Posted November 3, 2015 Solution: https://www.prestashop.com/forums/topic/352590-free-extra-product-tabs-override/?do=findComment&comment=2180792 Link to comment Share on other sites More sharing options...
Astar86 Posted July 18, 2017 Share Posted July 18, 2017 In the class: 'custom_field1' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString', 'size' => 255), And: public $custom_field1; In the TPL: <td style="padding-bottom:5px;"> <input size="55" maxlength="255" type="text" name="custom_field1" value="{$product->custom_field1|htmlentitiesUTF8}" style="width: 150px; margin-right: 5px;" /> </td> And I recommend you put the class and the controller in override folder ^^ Hi, I recently installed prestashop 1.7 and would like to add/delete/modify some product fields. But your suggestions do not work on my prestashop version. The "\adminFolder\themes\default\template\controller\products\features.php" file does not exist. There is also no template related products. How do I make these changes? Link to comment Share on other sites More sharing options...
TBWE Posted February 22, 2018 Share Posted February 22, 2018 The solution is working properly for one variable only, but if I would use two variables it doesn't work I use Prestashop 1.6.x and I see an error as above. Any solution? My code in Product.php override is: <?php class Product extends ProductCore { public $manufacturer_price; public $out_of_offer = false; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['manufacturer_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isString', 'shop' => true); self::$definition['fields']['out_of_offer'] = array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } The variable $out_of_offer would be also without "= false" but it doesn't work also Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now