Seekers Posted December 26, 2011 Share Posted December 26, 2011 Hello, Just started messing around with Prestashop (used Oscommerce before), and i like it! :-) I want to add a few fields for myself only in backend -> Catalog -> Productpage (adminproducts.php) So far, i got the field put where i want it, i can put in a value and the value will be updated in the db... Only issue is the field doesnt show the value... (yes, ive checked if its in the database) I added this code in adminproducts.php: $_POST['pricerunner_kat'] = empty($_POST['pricerunner_kat']) ? '0' : str_replace(',', '.', $_POST['pricerunner_kat']); and <tr> <td class="col-left">'.$this->l('Pricerunner:').'</td> <td style="padding-bottom:5px;"> <input size="55" type="text" name="pricerunner_kat" value="'.htmlentities($this->getFieldValue($obj, 'pricerunner_kat'), ENT_COMPAT, 'UTF-8').'" style="width: 130px; margin-right: 44px;" /> <span class="hint" name="help_box">'.$this->l('Special characters allowed:').' .-_#\<span class="hint-pointer"> </span></span> </td> </tr> Ive added this code to classes/products.php: /** @var string pricerunner_kat */ public $pricerunner_kat; And $fields['pricerunner_kat'] = psql($this->pricerunner_kat); And ive created the column pricerunner_kat in products The reason for me doing this, is due to the module i bought that should create a ready to go pricefile for a price comparison website... It is doing it wrong! And while im at it, i migth aswell add a few other fields needed later Spent some hours now google'ing and looking at the code... And it wont work :/ Help much appreciated. Regards, Link to comment Share on other sites More sharing options...
CartExpert.net Posted December 26, 2011 Share Posted December 26, 2011 Hello! You have to add the field into the '$fieldsRequired' and '$fieldsValidate' arrays. Link to comment Share on other sites More sharing options...
Seekers Posted December 26, 2011 Author Share Posted December 26, 2011 Hi CartExpert, Thank you for your reply. Already did this, and it doesnt work I must have forgotten somthing really stupid somewhere. protected $fieldsRequired = array('quantity', 'price', 'pricerunner_kat'); protected $fieldsSize = array('reference' => 32, 'supplier_reference' => 32, 'pricerunner_kat' => 100, 'location' => 64, 'ean13' => 13, 'upc' => 12, 'unity' => 10); protected $fieldsValidate = array( 'id_tax_rules_group' => 'isUnsignedId', 'id_manufacturer' => 'isUnsignedId', 'id_supplier' => 'isUnsignedId', 'id_category_default' => 'isUnsignedId', 'id_color_default' => 'isUnsignedInt', /* unsigned integer because its value could be 0 if the feature is disabled */ 'minimal_quantity' => 'isUnsignedInt', 'price' => 'isPrice', 'additional_shipping_cost' => 'isPrice', 'wholesale_price' => 'isPrice', 'on_sale' => 'isBool', 'online_only' => 'isBool', 'ecotax' => 'isPrice', 'unit_price' => 'isPrice', 'unity' => 'isString', 'reference' => 'isReference', 'supplier_reference' => 'isReference', 'pricerunner_kat' => 'isReference', 'location' => 'isReference', 'width' => 'isUnsignedFloat', 'height' => 'isUnsignedFloat', 'depth' => 'isUnsignedFloat', 'weight' => 'isUnsignedFloat', 'out_of_stock' => 'isUnsignedInt', 'quantity_discount' => 'isBool', 'customizable' => 'isUnsignedInt', 'uploadable_files' => 'isUnsignedInt', 'text_fields' => 'isUnsignedInt', 'active' => 'isBool', 'available_for_order' => 'isBool', 'condition' => 'isGenericName', 'show_price' => 'isBool', 'ean13' => 'isEan13', 'upc' => 'isUpc', 'indexed' => 'isBool', 'cache_is_pack' => 'isBool', 'cache_has_attachments' => 'isBool' ); Guess ill try dream about what i did wrong, hehe. Regards. Link to comment Share on other sites More sharing options...
Seekers Posted December 26, 2011 Author Share Posted December 26, 2011 I have no idea what i did, but its working now... Thanks. Link to comment Share on other sites More sharing options...
Seekers Posted December 27, 2011 Author Share Posted December 27, 2011 Oh well, still doesnt work, so if anyone out there have an idea, feel free to share Link to comment Share on other sites More sharing options...
Seekers Posted December 28, 2011 Author Share Posted December 28, 2011 Found the error... Had made a minor error in the database... Now i only need to find out how to make the field accept these 3 things: < > : Link to comment Share on other sites More sharing options...
CartExpert.net Posted December 28, 2011 Share Posted December 28, 2011 Hello! You need to check/modify the function in the Validate.php file. Link to comment Share on other sites More sharing options...
Seekers Posted December 29, 2011 Author Share Posted December 29, 2011 Actually got everything working now Change the input area to an textarea, added a true in classes/product.php after: $fields[color="#666600"][[/color][color="#008800"]'pricerunner_kat'[/color][color="#666600"]][/color] [color="#666600"]=[/color] psql[color="#666600"]([/color]$this[color="#666600"]->[/color]pricerunner_kat, true[color="#666600"]);[/color] and added stripslashes here: [color="#000088"]<input[/color] [color="#660066"]size[/color][color="#666600"]=[/color][color="#008800"]"55"[/color] [color="#660066"]type[/color][color="#666600"]=[/color][color="#008800"]"text"[/color] [color="#660066"]name[/color][color="#666600"]=[/color][color="#008800"]"pricerunner_kat"[/color] [color="#660066"]value[/color][color="#666600"]=[/color][color="#008800"]"'.htmlentities($this->[/color]getFieldValue($obj, 'pricerunner_kat'), ENT_COMPAT, 'UTF-8').'" style="width: 130px; margin-right: 44px;" /> Thanks for the help. Link to comment Share on other sites More sharing options...
sepahan Posted April 10, 2012 Share Posted April 10, 2012 if i want to show new field in fo what do i do? 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