blacksymmetry Posted December 12, 2010 Share Posted December 12, 2010 I am Trying to add a custom field in admin>>catalog>>Add a new product, this value should be inserted in table ps_product in database can any one help me. how it should be worked out.Thanks for any advice Link to comment Share on other sites More sharing options...
shokinro Posted December 12, 2010 Share Posted December 12, 2010 There is a customization tab catalog product page. You can add customization fields there.After adding customization fields, it will displayed on front store, so that customer is able to customize the product.I am no sure if that is you are looking. Link to comment Share on other sites More sharing options...
blacksymmetry Posted December 12, 2010 Author Share Posted December 12, 2010 No, no would like store this note only in admin, note should be visible only for me. Link to comment Share on other sites More sharing options...
shokinro Posted December 12, 2010 Share Posted December 12, 2010 In that case, maybe you can use some fields that you are not in use.for example: Reference, Supplier ReferenceI don't think these two fields are displayed any where in front store, if you are not used them you can use this instead. Link to comment Share on other sites More sharing options...
blacksymmetry Posted December 12, 2010 Author Share Posted December 12, 2010 But this fields have got lenght validation to 32 char, i updated db column to 1000 chat but still are here php validation or Javascript. Link to comment Share on other sites More sharing options...
shokinro Posted December 12, 2010 Share Posted December 12, 2010 You also need to change product class file at /classes/Product.php.It locates around line 158(depends on your version) protected $fieldsSize = array('reference' => 32, 'supplier_reference' => 32, 'location' => 64, 'ean13' => 13); Link to comment Share on other sites More sharing options...
blacksymmetry Posted December 12, 2010 Author Share Posted December 12, 2010 Reference field is showed on front of shop, but supplier_reference id O.K, is it good for me, thanks for advice. Link to comment Share on other sites More sharing options...
VNguyen Posted December 13, 2010 Share Posted December 13, 2010 Hi,Other way to do that (add new extra fields in ps_table and class Product). In Product.php, you have to add something like that:public $new_field;protected $fieldsSize = array('reference' => 32, 'supplier_reference' => 32, 'location' => 64, 'ean13' => 13, 'new_field' => 10000); // for exampleprotected $fieldsValidate = array('new_field' => 'is_float'); // for exampleIn function getFields, you have to add 1 more line:$fields['new_field'] = floatval($this->field);And the last and most important thing, you have to add one new field name "new_field" into table ps_product.Regards,Viet Link to comment Share on other sites More sharing options...
blacksymmetry Posted December 13, 2010 Author Share Posted December 13, 2010 VNguyenMany thanks for your advice, but how can i display this custom field in the form "add new item"? Link to comment Share on other sites More sharing options...
VNguyen Posted December 14, 2010 Share Posted December 14, 2010 Hi,You have to edit AdminProduct.php, and change this function postProcess(). This function is responsibility to display form to edit/add new and handle posted data.Regards,Viet Link to comment Share on other sites More sharing options...
blacksymmetry Posted December 14, 2010 Author Share Posted December 14, 2010 VNguyen: hello i don't understand you. In AdminProducts.php i found funct. postProcess() and i thinh, that should be in here>/* Product attributes management */ elseif (Tools::isSubmit('submitProductAttribute'))But i don't know what exactly add to this function. Link to comment Share on other sites More sharing options...
otiz Posted January 7, 2012 Share Posted January 7, 2012 in AdminProducts.php insert <tr> <td class="col-left">'.$this->l('new_field:').'</td> <td class="translatable">'; echo ' <div class="lang_3" style="float: left;"> <input size="55" type="text" id="new_field" name="new_field" value="'.$this->getFieldValue($obj, 'new_field').'" /> </div>'; echo ' </td> </tr> And in classes/products.php define can in line 150 /** @var string new_field */ public $new_field; Do not change PostProcess() in AdminProducts.php Link to comment Share on other sites More sharing options...
I am Oleg Posted March 22, 2012 Share Posted March 22, 2012 Hello! But how to pick up that data from the database and write it on the product page somewhere? Many thanks! Link to comment Share on other sites More sharing options...
I am Oleg Posted March 23, 2012 Share Posted March 23, 2012 OK! Don't worry! I've got it! If someone wants to know HOW TO, let me know here. Link to comment Share on other sites More sharing options...
sepahan Posted April 10, 2012 Share Posted April 10, 2012 please say your way!!!! Link to comment Share on other sites More sharing options...
otiz Posted April 16, 2012 Share Posted April 16, 2012 get data from db ? create in db table ps_product "new_field" -- <?php echo $this->getFieldValue($obj, 'new_field'); ?> -- -- classes/products.php define Line 150 /** @var string new_field */ public $new_field; -- Link to comment Share on other sites More sharing options...
jincmd Posted December 11, 2012 Share Posted December 11, 2012 Hello! But how to pick up that data from the database and write it on the product page somewhere? Many thanks! I've begun searching for a solution to change the REFERENCE number to be called "SKU" I'm having trouble finding a method to do this. so i'm wondering if you would inform me on wether I should use your solution here... Please advise thanks Link to comment Share on other sites More sharing options...
jincmd Posted December 11, 2012 Share Posted December 11, 2012 should i do this to create a feild for SKU? because It seems complex and i'm having trouble finding out how to change to "REFERENCE" (which i don't need) to SKU Link to comment Share on other sites More sharing options...
Recommended Posts