AFemaleProdigy Posted April 23, 2012 Share Posted April 23, 2012 I am trying to add several new custom fields that the user can fill out during the registration process, which will then be attached to the ps_customer table with the rest of their information. I have created the new tables in the DB with no problem. If I manually enter values in the DB via phpmyadmin, I am able to get them to show up in the customer view/list and other BO pages, but the functions to add the values through the registration process are not working. I have attempted to follow the instructions at the link below and do believe I did it all exactly as instructed. However, I am getting the same error that the last two people were getting and I can't get the registration process to complete. It gets stuck on "An error occurred while creating your account." http://www.prestashop.com/forums/topic/113300-tutorial-add-custom-field-to-customer-registration-how-you-found-us-store-in-db-display-result-in-admin/ I haven't been able to get any assistance on that thread, so I am making a new one. I also was trying to get the page to output the actual error for troubleshooting, but I can't get that to work either. Can anyone see any fault in those instructions that would cause problems with 1.4.7.3? Maybe something is missing or should be written differently? Any help would be greatly appreciated. Thanks! Link to comment Share on other sites More sharing options...
Mike Kranzler Posted April 23, 2012 Share Posted April 23, 2012 Hi AFemaleProdigy, You can also try the suggestions here. Please let me know if that works any better for you. -Mike 1 Link to comment Share on other sites More sharing options...
AFemaleProdigy Posted April 23, 2012 Author Share Posted April 23, 2012 Thanks, Mike. I went through those steps as well, but still get the same error. The custom fields show up with no problem, but when the user tries to submit the Login step (contact info, address, login), the user is redirected back to the same page with the same error message. Is there some way to determine what the actual error is? It is a general error message with no details. Also, I was able to add the new custom fields to BO which not only displays their value, but I am also able to edit them in BO now. I just can't get the authentication process to move to the next step during registration. Link to comment Share on other sites More sharing options...
AFemaleProdigy Posted April 24, 2012 Author Share Posted April 24, 2012 I figured out the problem. I had to change the Null settings for the new tables in the DB. It is all working now. 1 Link to comment Share on other sites More sharing options...
BWT Posted April 24, 2012 Share Posted April 24, 2012 I have an easier way of doing this, if your form and fields are different from that of "My Account" and need a specific form for your site/business I would be happy to help. On my demo site you can see the example of the form I am talking about. 2 Link to comment Share on other sites More sharing options...
Mike Kranzler Posted April 24, 2012 Share Posted April 24, 2012 Great, I'm glad you were able to resolve this! I'll go ahead and mark this thread as solved for you. Happy selling! -Mike Link to comment Share on other sites More sharing options...
AFemaleProdigy Posted April 27, 2012 Author Share Posted April 27, 2012 Thanks! tjg, I wish I had seen that post before, but I have already learned the hard way. Oh well. I learned something new anyway. 1 Link to comment Share on other sites More sharing options...
arimasco Posted August 9, 2012 Share Posted August 9, 2012 this not just closeer to the jesica problem,... I would like to 1. add additional field to my presta registration., 2. this field is county This field will a county field, that should be optionaly field coresponding to the county list in the dbasae. Could someone here help me to do this...?? I have tried edit some , in authentication.tpl, but nothing still happened... Is there some thing logicaly solving to do that.. thx..vy mu Link to comment Share on other sites More sharing options...
RobboR Posted December 11, 2012 Share Posted December 11, 2012 (edited) this not just closeer to the jesica problem,... I would like to 1. add additional field to my presta registration., 2. this field is county This field will a county field, that should be optionaly field coresponding to the county list in the dbasae. Could someone here help me to do this...?? I have tried edit some , in authentication.tpl, but nothing still happened... Is there some thing logicaly solving to do that.. thx..vy mu Have you tried to make form costumization throught control panel? Go to Localization > Country > Choose the Country you want to customize > edit the "address layout" fields adding or deleting field Hope this help Edited December 11, 2012 by RobboR (see edit history) Link to comment Share on other sites More sharing options...
Coldness Posted December 11, 2012 Share Posted December 11, 2012 Does this work in 1.5 version? Can anyone be kind and write a tutorial on how to accomplish this in 1.5? Link to comment Share on other sites More sharing options...
TommyKaneko Posted December 28, 2012 Share Posted December 28, 2012 (edited) this not just closeer to the jesica problem,... I would like to 1. add additional field to my presta registration., 2. this field is county This field will a county field, that should be optionaly field coresponding to the county list in the dbasae. Could someone here help me to do this...?? I have tried edit some , in authentication.tpl, but nothing still happened... Is there some thing logicaly solving to do that.. thx..vy mu To add county to the addresses, you have to do the following: in override/classes/Address.php, add these lines: <?php class Address extends AddressCore { /** @var string county */ public $county; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'address', 'primary' => 'id_address', 'fields' => array( 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12), 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64), 'county' => array('type' => self::TYPE_STRING, 'validate' => 'isCountyName', 'size' => 64), 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16), 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), ), ); } ?> Then add Validation in override/classes/Validate.php: <?php class Validate extends ValidateCore { /* Check for city name validity * * @param string $city City name to validate * @return boolean Validity is ok or not */ public static function isCountyName($county) { return empty($county) || preg_match('/^[a-zA-Z -]+$/', $county); } } ?> Then in your theme template files, there are several places you'll need to add the following or similar code: {elseif $field_name eq "county"} <p class="text county"> <label for="county">{l s='County'}</label> <input type="text" class="text" name="county" id="county" value="{if isset($guestInformations) && $guestInformations.county}{$guestInformations.county}{/if}" /> </p> .. That last bit of code, or similar versions of it need to be inserted into the following template files: order-opc-new-account.tpl authentication.tpl address.tpl authentication-create-account.tpl ….Then you need to add the 'county' field for each county that you want it to appear. Go to Localization > Country > Choose the Country you want to customize > edit the "address layout" fields adding 'county' as a field. You will also need add an extra field into the table ps_address in yout phpMyAdmin: ALTER TABLE `ps_address` ADD `county` VARCHAR( 64 ) Then Edited December 28, 2012 by TommyKaneko (see edit history) 1 Link to comment Share on other sites More sharing options...
logz05 Posted January 11, 2013 Share Posted January 11, 2013 @TommyKaneko This works great for the front end - thanks ;-) - but do you know where to change the BO templates so you can actually see the extra field as an admin? Thanks 1 Link to comment Share on other sites More sharing options...
Geradmit Posted February 25, 2013 Share Posted February 25, 2013 Is this works on presta 1.5 ? Link to comment Share on other sites More sharing options...
modulesmarket Posted February 28, 2013 Share Posted February 28, 2013 (edited) 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 Edited February 28, 2013 by modulesmarket (see edit history) Link to comment Share on other sites More sharing options...
dinofratelli Posted May 13, 2013 Share Posted May 13, 2013 I have created a tutorial for Prestashop 1.5: http://www.bitsandchips.it/forum/viewtopic.php?f=11&t=4884 . Hope this help! Link to comment Share on other sites More sharing options...
neller Posted May 21, 2013 Share Posted May 21, 2013 I have just successfully added a custom field to the user registration screen using this guide posted by dinofratelli, however there is one step missing in the guide. http://www.bitsandchips.it/forum/viewtopic.php?f=11&t=4884 in classes/Customer.php around line 160 public static $definition = array( ... 'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 32), Below this line, add this line 'referralcode' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), Works like a charm vor ver. 1.5.4.0 Neller 2 Link to comment Share on other sites More sharing options...
dinofratelli Posted May 21, 2013 Share Posted May 21, 2013 (edited) Thank you Neller for the note!!! Effectively in my modifications to Prestashop I have added this line but I forget to add in the guide Edited May 21, 2013 by dinofratelli (see edit history) Link to comment Share on other sites More sharing options...
anukku Posted July 1, 2013 Share Posted July 1, 2013 (edited) Hy, is it posibile to add a limit for new custom fields? For example i want to add a custom field name CNP ( personal numeric code) wich must have exactly 13 numbers. Ex: 1860219001122, and also if a customers puts 10 numbers, to display a message like "Incorrect CNP" ? I want this field to be *, mandatory. How do i make this custom field visible in a customer order? To see the CNP of a customer, after he did an order, i must go in the clients section and look for it;... Also, the new field created is not visible if i press edit from admin on a customer. In front office in my account, also the new field is not displayed. I have added some pics also This tutorial is great, but it also needs some more customizations on custom field added...and i lack some skils I.ve managed to add the custom field on front office customer informations by editing the identity.tpl from my theme, but i don;t know how to make it display the values inserted. I thing it hs something to do with {$smarty.post. . For example the name wich is displayed has a smarty.post.firstname. I think i must add smarty.post.referralcode to somewher but don;t know were... I've put the code in identity.tpl : <label for="referralcode">{l s='CNP'}</label> <input name="referralcode" type="text" class="text" id="referralcode" value="{$smarty.post.referralcode}"/> </p> But the field remains empty after i press save. If i replace $smarty.post.referralcode} with $smarty.post.firstname} after i press save it displays the name. So this mean , at least i think, it has something to do with phpmyadmin and the sql database, but don;t know what to do in database.. pls anyone help... Edited July 1, 2013 by anukku (see edit history) Link to comment Share on other sites More sharing options...
RobinsondMantua Posted September 3, 2013 Share Posted September 3, 2013 (edited) Hy, is it posibile to add a limit for new custom fields? For example i want to add a custom field name CNP ( personal numeric code) wich must have exactly 13 numbers. Ex: 1860219001122, and also if a customers puts 10 numbers, to display a message like "Incorrect CNP" ? I want this field to be *, mandatory. How do i make this custom field visible in a customer order? To see the CNP of a customer, after he did an order, i must go in the clients section and look for it;... Also, the new field created is not visible if i press edit from admin on a customer. In front office in my account, also the new field is not displayed. I have added some pics also This tutorial is great, but it also needs some more customizations on custom field added...and i lack some skils I.ve managed to add the custom field on front office customer informations by editing the identity.tpl from my theme, but i don;t know how to make it display the values inserted. I thing it hs something to do with {$smarty.post. . For example the name wich is displayed has a smarty.post.firstname. I think i must add smarty.post.referralcode to somewher but don;t know were... I've put the code in identity.tpl : <label for="referralcode">{l s='CNP'}</label> <input name="referralcode" type="text" class="text" id="referralcode" value="{$smarty.post.referralcode}"/> </p> But the field remains empty after i press save. If i replace $smarty.post.referralcode} with $smarty.post.firstname} after i press save it displays the name. So this mean , at least i think, it has something to do with phpmyadmin and the sql database, but don;t know what to do in database.. pls anyone help... Hi!!! I 've the same problem as you. How have you solved? Thanks!!! Edited September 3, 2013 by RobinsondMantua (see edit history) Link to comment Share on other sites More sharing options...
anukku Posted September 3, 2013 Share Posted September 3, 2013 Nope...i didn;t solved it Unfortunately no one answered to this... Link to comment Share on other sites More sharing options...
RobinsondMantua Posted September 4, 2013 Share Posted September 4, 2013 (edited) Anukku, i think that i solved it. I am a newbie in this kind of enviroment. Consecuently, i don´t know if this solution is the best solution, but after a few tests that seems to be working. Here we go! - In themes\default\identity.tpl, add the following lines just before the line {if $newsletter} <p class="text"> <label for="referralcode">{l s='Referral code'}</label> <input name="referralcode" type="text" class="text" id="referralcode" value="{$referralcode}"/> </p> - In controllers\front\IdentityController.php : - In the method "initContent" add the following line $referralcode=$this->context->cookie->customer_referralcode; after the line parent::initContent(); In the same method, add the line $this->context->smarty->assign('referralcode', $referralcode); before the the line $this->setTemplate(_PS_THEME_DIR_.'identity.tpl'); - In the method "postProcess" add the following line $this->customer->referralcode = Tools::$this->customer->referralcode; after the line $this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname)); and add the line $this->context->cookie->customer_referralcode = $this->customer->referralcode; after the existing line $this->context->cookie->customer_firstname = $this->customer->firstname; Please, test it and tell me something. Edited September 4, 2013 by RobinsondMantua (see edit history) 2 Link to comment Share on other sites More sharing options...
anukku Posted September 4, 2013 Share Posted September 4, 2013 Dudeeee Ty so much. It freakin works. :D Link to comment Share on other sites More sharing options...
RobinsondMantua Posted September 4, 2013 Share Posted September 4, 2013 Link to comment Share on other sites More sharing options...
Palido Posted November 19, 2013 Share Posted November 19, 2013 Hi, does somebody know how i can upload a .csv to a custom field? I need a field where all our locations are listed, and the customer needs to choose one!? Link to comment Share on other sites More sharing options...
jdgojariya Posted February 7, 2014 Share Posted February 7, 2014 I have an easier way of doing this, if your form and fields are different from that of "My Account" and need a specific form for your site/business I would be happy to help. On my demo site you can see the example of the form I am talking about. Hello. Where is your demo site link.? Link to comment Share on other sites More sharing options...
DArnaez Posted August 31, 2014 Share Posted August 31, 2014 THere is a module or which of these solutions works on Prestashop 1.6.09? Link to comment Share on other sites More sharing options...
modulesmarket Posted September 1, 2014 Share Posted September 1, 2014 Hello DArnaez, yes, module works for Prestashop 1.6.0.9. Please check demo shop if you want. Here you will find all details: http://addons.prestashop.com/en/content-management/7152-custom-fields.html Link to comment Share on other sites More sharing options...
DArnaez Posted September 2, 2014 Share Posted September 2, 2014 Too expensive for me. Is just to add the "How did you know about us?". I will wait for next upgrades. But thanks! Link to comment Share on other sites More sharing options...
Web Bespokers Posted September 3, 2015 Share Posted September 3, 2015 Too expensive for me. Is just to add the "How did you know about us?". I will wait for next upgrades. But thanks! Hi DArnaez, did you find any upgrades which helped you to solve it without module installation? Link to comment Share on other sites More sharing options...
DArnaez Posted September 3, 2015 Share Posted September 3, 2015 No by the moment, my friend. Link to comment Share on other sites More sharing options...
olumide Posted June 22, 2016 Share Posted June 22, 2016 Hi friends, While users try to create an account there is an error code "There is 1 error 1.optin is required." that get them stuck and i have tried all areas to troubleshoot and it seems effortless. Kindly help Link to comment Share on other sites More sharing options...
Impe-M Posted February 21, 2017 Share Posted February 21, 2017 Hi, I need to add the field dni to "identity.tpl" file. Anyone has the solution for PrestaShop 1.6.0.9? Link to comment Share on other sites More sharing options...
ofal Posted March 7, 2017 Share Posted March 7, 2017 How can I add custom fields to newsletter? i bought Pop Newsletter v1.3.2. How to configure custom fields in this module? Or maybe I have to buy another module......... My blocknewsletter.tpl: } <!-- Block Newsletter module--> <div id="newsletter_block_left" class="block"> <h4>{l s='Newsletter' mod='blocknewsletter'}</h4> <div class="block_content"> <form action="{$link->getPageLink('index', null, null, null, false, null, true)|escape:'html':'UTF-8'}" method="post"> <div class="form-group{if isset($msg) && $msg } {if $nw_error}form-error{else}form-ok{/if}{/if}" > <input class="inputNew form-control grey newsletter-input" id="newsletter-input" type="text" name="email" size="18" value="{if isset($msg) && $msg}{$msg}{elseif isset($value) && $value}{$value}{else}{l s='Enter your e-mail' mod='blocknewsletter'}{/if}" /> <button type="submit" name="submitNewsletter" class="btn btn-default button button-small"> <span>{l s='Ok' mod='blocknewsletter'}</span> </button> <input type="hidden" name="action" value="0" /> </div> </form> </div> {hook h="displayBlockNewsletterBottom" from='blocknewsletter'} </div> <!-- /Block Newsletter module--> {strip} {if isset($msg) && $msg} {addJsDef msg_newsl=$msg|@addcslashes:'\''} {/if} {if isset($nw_error)} {addJsDef nw_error=$nw_error} {/if} {addJsDefL name=placeholder_blocknewsletter}{l s='Enter your e-mail' mod='blocknewsletter' js=1}{/addJsDefL} {if isset($msg) && $msg} {addJsDefL name=alert_blocknewsletter}{l s='Newsletter : %1$s' sprintf=$msg js=1 mod="blocknewsletter"}{/addJsDefL} {/if} {/strip} Link to comment Share on other sites More sharing options...
olumide Posted June 21, 2017 Share Posted June 21, 2017 Hello Folks, Am presently working on a new project, i want to create a product page and list them under a sub category of a category but it's not showing me the drop down option category to choos for a sub category. I will appreciate if i can get help on how to re solve this problem. Cheers... 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