derailed Posted February 27, 2009 Share Posted February 27, 2009 Hello ! I want to add more fields ( company registration info ) to the New account registration form. I want the entry in the field to make it's way to the database and also be viewable in the back office accounts management.From what I figured I added this entry in authentification.tpl: {l s='C.U.I.'}<input type="text" class="text" id="cui" name="cui" value="{if isset($smarty.post.cui)}{$smarty.post.cui}{/if}" /> and I also added in /classes/Adress.php: /** @var string C.U.I. (optional) */ public $cui;.Now what ?I think I will try adding mannualy a "cui" row in the ps_address in the prestashop database. Is that enough to make the field register? What is needed to make it appear in back office ? Thank you Link to comment Share on other sites More sharing options...
derailed Posted February 28, 2009 Author Share Posted February 28, 2009 ... figured it out by myself so no help no longer needed. Link to comment Share on other sites More sharing options...
prestabase Posted February 28, 2009 Share Posted February 28, 2009 derailed,How did you do it? In case anyone searches for this later. Link to comment Share on other sites More sharing options...
derailed Posted February 28, 2009 Author Share Posted February 28, 2009 Ok. This is what I needed to achieve and how I did it. WARNING! Moderate HTML/PHP and MySql knowhow needed. Don't try to do this unless you know what you are doing, it might make your shop unusable. Try first on a test server.Paths to files might be different depending on your install. MySql prefix for the table might also be different.Italic text is the code you need add.I needed 1 custom field in the registration form. This field request company registration info from the client. This information needs to make it's way to the shop database and from there be accessible by the back office and also be presented on the invoice.There are 4 files needed to be edited:/themes/prestashop/authentification.tpl - this adds the actual fields in the registration form/classes/Address.php - this makes the addresses management, it tells the form how to handle the submitted info/admin/tabs/AdminAddresses.php - this allows the back office to retrieve and edit the submitted info/classes/PDF.php - this handles the on request construction of pdf invoices1. /themes/prestashop/authentification.tplThis is an example of a custom textfield added. You need to add this between two paragraphs as needed, in the account-creation_form form. {l s='C.I.F.'} <input type="text" class="text" id="cif" name="cif" value="{if isset($smarty.post.cif)}{$smarty.post.cif}{/if}" /> 2. /classes/Address.phpIn this file there are several places in witch code needs to be added:In class "Address extends ObjectModel" you need to add : /** @var string C.I.F. (optional) */ public $cif;In "protected $fieldsSize = array" you need to add:'cif'=>32In "protected "$fieldsValidate" you need to add:'cif' => 'isGenericName'In "public function getFields() { parent::validateFields(); if (isset($this->id))"you need to add:$fields['cif'] = pSQL($this->cif);3. /admin/tabs/AdminAddresses.phpYou need to add in the code that makes the form for the BackOffice address management, in my case line 238, after the Company text field:'.$this->l('C.I.F.').' <input type="text" size="33" name="cif" value="'.htmlentities($this->getFieldValue($obj, 'cif'), ENT_COMPAT, 'UTF-8').'" />'.$this->l('Invalid characters:').' <>;=#{} 4. /classes/PDF.php You need to add in " /* Display address information */" and position as needed, in my case after the company name, after this :{ $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->company), 0, 'L'); $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->company), 0, 'L'); $pdf->Ln(5);}add this:$pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->cif), 0, 'L');$pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->cif), 0, 'L');$pdf->Ln(5);.To make this work you also need to add a new field in the "ps_address" table in the prestashop mysql database:Using phpMyAdmin, navigate to the prestashop database, ps_address table, Structure tab. At the bottom of the structure table select: Add 1 fields At The End Of The Table. In the new page add "cif" in the Field section, VARCHAR for type, 32 for Length/Values, select null and type" NULL" in the Default field.This should be it. 1 Link to comment Share on other sites More sharing options...
mr_c Posted August 30, 2009 Share Posted August 30, 2009 I've been trying to do this exact same thing but with a different type of field. A "description_mini" field, which is just text with a maximum of 10 words. Can you please help me? I added the field in the ps_product_lang table but can't use it in the front office unless i edit the files in prestashop and i tried finding every "description_short" field and rename it as "description_mini" just to test, but it doesn't come up with calling it on the website, nothing comes up!I'm seriously pulling my hair out here! please help a brother out! thanks Link to comment Share on other sites More sharing options...
vietnam Posted September 14, 2009 Share Posted September 14, 2009 Derailed . You have 2 errors in your siteWarning: require_once(/home/autodotr/public_html/config/../classes/MailAlerts.php) [function.require-once]: failed to open stream: No such file or directory in /home/autodotr/public_html/config/config.inc.php on line 20Fatal error: require_once() [function.require]: Failed opening required '/home/autodotr/public_html/config/../classes/MailAlerts.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/autodotr/public_html/config/config.inc.php on line 20In http://www.autodot.ro/modules/mailalerts/myalerts.phpAnd the second it`s that you can not make or edit your old AdressAcasa>Contul meu>Adresele meleAdd an adress link to http://www.autodot.ro/address.php When it should be http://www.autodot.ro/addresses.phpBtw did you make that you can add or edit your adress from withing user panel that yu can modify the CIF, IBAN, etc ? On http://www.mobila-online.biz/ when i click on modify my adress from the Front Office it`s show the standard settings.It`s the same to edit ?Good luck and maybe you will make a module that people can add or substract lines from the registration. Link to comment Share on other sites More sharing options...
derailed Posted September 15, 2009 Author Share Posted September 15, 2009 Hello ! Thank you for the error reports. The 1'st error I am aware of and actually can't seem to figure out what is the problem. It's not permissions related , and no modifications had been made to the mailalerts module, so I guess it must be database related. Maybe in my many shop upgrades something went wrong. The 2'nd error was caused by a missing address.php file, and now it's fixed. Thank you ! No the file name is correct , there is a address.php and one adresses.php file. Yes I have added the posibility to edit the CIF and Recom entries from within Front office and also Back office. I will post soon the steps to do it.I don't think it's posibble to make a module that will handle extra entries in the registration form since it requires modifyng core files. Maybe if someone would implement this feature in the official release.Marius Link to comment Share on other sites More sharing options...
derailed Posted September 15, 2009 Author Share Posted September 15, 2009 To add editable custom entries in the user cp you must edit two files : address.tpl and addresses.tpl in your theme's folder:1. address.tpl:In the form declaration you must add the following two fieldsets ( modify names as needed): <input type="hidden" name="token" value="{$token}" />{l s='CIF'}<input type="text" id="cif" name="cif" value="{if isset($smarty.post.cif)}{$smarty.post.cif}{else}{$address->cif|escape:'htmlall':'UTF-8'}{/if}" /> <input type="hidden" name="token" value="{$token}" />{l s='Recom'}<input type="text" id="recom" name="recom" value="{if isset($smarty.post.recom)}{$smarty.post.recom}{else}{$address->recom|escape:'htmlall':'UTF-8'}{/if}" /> 2. addresses.tplJust after : " {if $address.company}{$address.company}{/if} " on line 21 ( i guess ) you must add :{if $address.cif}{$address.cif}{/if}{if $address.recom}{$address.recom}{/if}ATTENTION: Follow all thread and make this modifications only after adding the custom columns to the mysql database. Link to comment Share on other sites More sharing options...
alex84 Posted September 21, 2009 Share Posted September 21, 2009 Hello here are the files modified . The files contain these fields: CUI; NR REG COM; IBAN. Make changes only in phpmyadmin. 10x derailed Link to comment Share on other sites More sharing options...
milkydip Posted September 30, 2009 Share Posted September 30, 2009 I need further explanations for this still don't get it. Thanks!Regards,milkydipPlacement financier Link to comment Share on other sites More sharing options...
xetu Posted October 17, 2009 Share Posted October 17, 2009 Hi all, alex 84, where are the modified files? I guess you made 3 modification in database, ca you please tell us how you made-it?thanks in advance.catalin Link to comment Share on other sites More sharing options...
Miha Posted November 1, 2009 Share Posted November 1, 2009 derailed, thank you very much for these tips.I only have one problem: In backoffice, text fields are empty (where values should be displayed). Does your code for backoffice work for you? Link to comment Share on other sites More sharing options...
derailed Posted November 1, 2009 Author Share Posted November 1, 2009 Yes Miha, it should work. I attached my AdminAddresses.php so you can compare code and troubleshoot your problem. Hope it helps AdminAddresses.php 1 Link to comment Share on other sites More sharing options...
corint1 Posted December 9, 2009 Share Posted December 9, 2009 cam ciudat mod de modificare a datelor unei firme ... ma refer la cui , iban etc etc etc ... le-am gasit la adresa ... nimeni nu le cauta acolo ... nu poate face o midificare sa fie puse la datele de indentificare , ca sa nu vorbesc de un alt mod de inregistrare a PJ ? ... din pagina de inregistrare sa se poate selecta PF sau PJ si in consecinta sa se introduca datele ... mercipropun sa mutam discutia pe forumul romanesc ... banuiesc ca numai pe noi ne intereseaza modul acesta de inregistrare Link to comment Share on other sites More sharing options...
derailed Posted December 9, 2009 Author Share Posted December 9, 2009 Romaneste: eu am gasit o rezolvare , desi recunosc ca nu e cea mai potrivita ergonomic vorbind. Din pacate sunt doar programator de ocazie, mai mult designer si integrator. Eu am identificat legaturile, fisierele si modalitatea de editare, acum ar fi potrivit sa intervina un programator profi ca sa realizeze ce spui tu.English: I found the way to adress this issue, but I admitt it's not the most easy and ergonomic way to do it. I am an designer and integrater. I pointed the links, files and the way to modify the files, now it is time for a real programmer to step in and make what you requested: a way for the client to select it's status : company or individual. Let's hope someone in the prestashop staff will notice this request and adress it in feature versions. Link to comment Share on other sites More sharing options...
corint1 Posted December 9, 2009 Share Posted December 9, 2009 nu ma descurc in engleza asa ca o sa comunic numai in romaneste ...intuitia m-a dus sa inecrc sa modific alte 2 fisiere ... indentity.php si indentity.tpl ... toate bune si frumoase numai ca in Fo in fereastra de indentificare nu imi aduce nimic din spate ... ramin aceleasi lucruri : nume, prenume si email ... poate totusi cu cunostintele tale reusesti sa ma pilotezi cum anume sa fac macar sa aduca din db cimpurile noi ...merci Link to comment Share on other sites More sharing options...
kpince Posted February 8, 2010 Share Posted February 8, 2010 This has been very helpful for me..ThanksI have added a custom field to customer info as id# by following the posts here. It works fine. Needed to update identity.tpl as well.Now I'll delve into adding a drop down list for address for choosing city region..Will post when finished. Link to comment Share on other sites More sharing options...
eschmidt Posted April 1, 2010 Share Posted April 1, 2010 I am using the customerRegistration module to require my customers to enter a valid code to gain access to a group. http://www.prestashop.com/forums/viewthread/10305/third_party_modules/module_customerregistration_managementI am trying to get that code they enter to pass through and show up in the backend. I've tried the methods described in this forum but I can't get it to work. I am wondering if that is because that input field was added on by a different module? It's all part of the same form so I'm not sure if that would matter. Any more tips or ways to pass a form input field into the Customer area of the back office? Link to comment Share on other sites More sharing options...
epicurean Posted August 16, 2010 Share Posted August 16, 2010 Hi - this has been very useful. Thank you Instead of creating new customer fields, we want to create new product fields and these fields need to be visible when a customer is on our website looking to purchase a product. Do the same principles apply?thank youPhyllis Link to comment Share on other sites More sharing options...
Artizzz Posted September 21, 2010 Share Posted September 21, 2010 great solution! only I would like to note that there need to add fields in address.tlp, addresses.tlp and identity.tlp files. Link to comment Share on other sites More sharing options...
vergnaud Posted October 10, 2010 Share Posted October 10, 2010 Dear all,Reviving this thread as this is the best so far on the topic. I have managed to add a field at the account creation (a server serial number I need for key generation afterwards) and all is fine in English BUT as soon as I switch to an other langage, typically French in my case. I have the issue of the field not displayed and because I have made it mandatory, this is a blocker. I am trying to figure out how to make that flexible and localizable!Anyone has done that by any chance?Did I add the section in the wrong place in authentication.tpl? Link to comment Share on other sites More sharing options...
mvalent Posted October 23, 2010 Share Posted October 23, 2010 This topic is really interesting ! I had a look and I find very little (almost nothing) information about database customization.Can somebody respond to the following question :What are the implications in case of an update of Prestashop ?I mean, when updating Prestashop, are the extra fields in the database going to remain there or the update is going to drop them ?Also, are the modifications in the tpl and php files to be applied again and again, each time Prestashop comes with an update ?Thanks. Link to comment Share on other sites More sharing options...
rocky Posted October 24, 2010 Share Posted October 24, 2010 When you upgrade PrestaShop, it will simply add new fields and modify existing fields. It doesn't drop any tables. You shouldn't have any problem unless you've added a new field, then the next version of PrestaShop tries to add a field with the same name.If you've modified PrestaShop's files, you will need to make those changes again whenever you upgrade the files. It's best to limit changes to your theme files and leave PrestaShop's PHP files alone. Link to comment Share on other sites More sharing options...
panteehoe Posted March 13, 2011 Share Posted March 13, 2011 Hi, i have a huge problem, I've tried to add a custom field in the AdminProducts.php - it should be a drop down list with 4 options and the selected option should display next to the add to cart button. I appled similar steps as suggested here, but as soon as i add the adjusted code, the section "add product" dissapears. Any suggestions? Please? Pretty please? Link to comment Share on other sites More sharing options...
Drukpa Posted March 24, 2011 Share Posted March 24, 2011 Hi, thanks for the help, but I have encountered a problem. I cannot view the new field I added from the Backoffice whilst clicking on a customer. It comes up empty. Typed in the correct field name. What other file do I need to edit, besides the AdminAddresses.php Link to comment Share on other sites More sharing options...
giuly Posted April 27, 2011 Share Posted April 27, 2011 I can't upgrade, because of file modified, many files. I try this on PS 1.3.2.3 but it doesn't work, does'nt appear on authentication.php.Any idea?PleaseI see new field in translation on backoffice, but I didn't see it in authentication Link to comment Share on other sites More sharing options...
lucasss Posted June 16, 2011 Share Posted June 16, 2011 thanks a lot, hints provided in this thread were quite useful.I've managed to create my own fields in registration form (still being able to update/modify them from customer's point of view and back office as well) and use values from these fields in pdf invoice.I can confirm that files needed to be modified are:1. .../prestashop/classes/Address.php2. .../prestashop/adminXXX/tabs/AdminAddresses.php3. .../prestashop/themes/prestashop/address.tpl4. .../prestashop/themes/prestashop/authentification.tpl5. and your pdf templateTested on PrestaShop 1.4.2.5! Link to comment Share on other sites More sharing options...
lucasss Posted June 16, 2011 Share Posted June 16, 2011 can't forget to mention,besides the file modifications, also mysql modification is necessary!If you want to add "field1" field into the registration form, keep on mind you need to have "field1" field added to your mysql database as well. As prestashop is storing/loading all these details form the database.Say, you're using mysql database called "prestadb"If you have shell access to mysql, use following commands: mysql -u YOUR_MYSQL_USERNAME -p (now mysql will ask you for your password, enter it) use predstadb; opens "prestadb" database ALTER TABLE ps_address ADD field1 VARCHAR(60); creates "field1" field in ps_address table quit gets you outta mysql Could be helpful for somebody... Link to comment Share on other sites More sharing options...
DGPublishing Posted November 14, 2011 Share Posted November 14, 2011 Honestly there has to be an easier way? I'm trying to add the field "Company Phone" to the registration. I'm not sure why this isn't installed by default, but I'm in no way capable of editing the database or the php. Is there any other way? Link to comment Share on other sites More sharing options...
lucass Posted November 14, 2011 Share Posted November 14, 2011 I believe there exist some paid module to do that; however, speaking of free solution, you gotta go through all these "nasty" editing... Link to comment Share on other sites More sharing options...
corint1 Posted November 16, 2011 Share Posted November 16, 2011 tell me what you want exactlly ... ( spune-mi exact ce vrei - use google translate) Link to comment Share on other sites More sharing options...
Geradmit Posted February 25, 2013 Share Posted February 25, 2013 Maybe some one can make modification for prestashop 1.5 Link to comment Share on other sites More sharing options...
modulesmarket Posted February 28, 2013 Share Posted February 28, 2013 Hi, I've created module that will allow add extra fields to registration form. With that module you can easily create unlimited number of additional fields and sections on top and bottom of the registration form. The advantage of that module is that it doesn't override or change any core files. Please check it here: http://addons.presta...tom-fields.html Regards, modulesmarket.com Link to comment Share on other sites More sharing options...
bannerclick Posted May 14, 2013 Share Posted May 14, 2013 Hi modulesmarket, I bought yor module. Is it possible to include the added data in the confirmation email? If yes, how do i do that? Thanks, Barry Link to comment Share on other sites More sharing options...
modulesmarket Posted May 14, 2013 Share Posted May 14, 2013 Hi, It's not possible by default but I can extend the module to met your requirement. I just need a details on that - please drop me the email with the details either by the Addons contact page or email - [email protected]. Regards, Radek Link to comment Share on other sites More sharing options...
bannerclick Posted June 25, 2013 Share Posted June 25, 2013 Hi Radek, i just see your reply now I will send you an email! Link to comment Share on other sites More sharing options...
rajaramprobytes Posted May 9, 2016 Share Posted May 9, 2016 Hello friendz, How to add new fields to the address in Prestashop 1.6.1.5 I have add two new field to address section in front office but i can't able add this process. please help me 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