Page 14 of 14 FirstFirst ... 4121314
Results 131 to 138 of 138
  1. #131
    Join Date
    Aug 2013
    Location
    Oregon
    Posts
    4
    Plugin Contributions
    0

    Default Re: Add a field into create account

    Quote Originally Posted by CSGODeimos View Post
    Need a little help here guys.

    Followed the instructions given.

    Tax ID can be seen in the database fine - https://gyazo.com/26d4fd8fae5ca1650b1e7549b2f9a0c8

    But when I go to register a new customer it doesn't show - https://gyazo.com/89423ca1bb1715117c7f8438a0828fa8

    Any help? No idea what I'm doing wrong? I read somewhere about tpl_modules_create_account.php but that doesn't exist in 1.5.5a / Sheffield Blue Responsive
    If you don't find tpl_modules_create_account.php in includes/templates/YOURTEMPLATE/templates/tpl_modules_create_account.php then you need to grab it out of includes/templates/template_default/templates/tpl_modules_create_account.php

  2. #132
    Join Date
    Aug 2013
    Location
    Oregon
    Posts
    4
    Plugin Contributions
    0

    Default Re: Add a field into create account

    Tharina posted this in 2009 and I've followed the instructions to successfully add additional fields to the customer account registration in Zen Cart 1.5.5a.

    Once piece that I did find is that the new fields were not showing up in the Admin section when I went to edit a customer. Tere is an IF statement in Admin/customers.php that requires you set the Fax Number to TRUE in your admin->Configuration->Customer Details.

    Code:
    BACKUP
    0. Backup your database using PHPMyAdmin,
    ALSO backup the affected files before making each change.
    AFFECTED FILES TO BACKUP:
    includes/modules/YOURTEMPLATE/create_account.php
    includes/languages/YOURTEMPLATE/english.php
    includes/templates/YOURTEMPLATE/templates/tpl_modules_create_account.php
    Admin/customers.php
    includes/templates/YOUR TEMPLATE/templates/tpl_account_edit_default.php
    includes/modules/pages/account_edit/header_php.php
    includes/languages/YOURTEMPLATE/english.php
    includes/modules/pages/create_account/jscript_form_check.php
    includes/modules/pages/account_edit/jscript_form_check.php
    includes/modules/create_account.php
    
    ADD TABLE TO DATABASE:
    1. Go to PHPMyAdmin and select your database from the pulldown.
    
    2. On the left sidebar of PHPMyAdmin click on the table "customers"
    
    3. On the right side of the screen you will see all the fields like customers_telephone, customers_fax and so-on... Now scroll below this and you should see a way to add a field, in mine I saw:
    
    The "Add" text box should contain "1", in the field(s) section, select the "At end of table" radio button, leave everything else as it is and then click the "GO" button.
    
    This sent me to another page to name my field and stuff so I named it "customers_taxid" (no quotation marks).
    Then I selected "VarChar" and a length of "32"(or whatever length in characters you want your new entry field),
    Collation = (it was blank and I left it blank),
    Attributed = (it was blank and I left it blank),
    Null = NULL
    
    Then I clicked "SAVE"
    
    4. I then saw my new field in the table it was on the bottom of all the other ones that were previously there.
    
    5. Close PHPMyAdmin
    
    TO ADD FIELD FOR NEW CUSTOMERS:
    6. Open file includes/modules/YOURTEMPLATE/create_account.php
    (or if your template did not override this then simply use the one in modules folder)
    
    7a. Now search for the following:
    
    $fax = zen_db_prepare_input($_POST['fax']);
    
    DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:
    
    $taxid = zen_db_prepare_input($_POST['taxid']);
    
    7b. Next search for:
    
    'customers_fax' => $fax,
    
    DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:
    
    'customers_taxid' => $taxid,
    
    
    8a. Now open file: includes/languages/YOURTEMPLATE/english.php
    (or if your template did not override this then simply use the one in languages folder)
    
    8b. Search for the following code:
    
    define('TABLE_HEADING_PHONE_FAX_DETAILS', 'Additional Contact Details');
    
    this is the heading for the section on the form that houses the telephone number and fax number inputs, I changed it to this:
    
    define('TABLE_HEADING_PHONE_FAX_DETAILS', 'Additional Details');
    
    this allowed my heading to say "Additional Information" instead of the original text of "Additional Contact Details" *
    
    8c. Also add the following code:
    
    define('ENTRY_TAXID_NUMBER', 'TAX ID:');
    
    define('ENTRY_TAXID_NUMBER_TEXT', '');
    
    to be tidy, this entry should be added to where all the other "define('ENTRY..." statements are.
    
    
    9. Now open file: includes/templates/YOURTEMPLATE/templates/tpl_modules_create_account.php
    
    9a. Now search for the following code:
    
    <?php
    if (ACCOUNT_FAX_NUMBER == 'true') {
    ?>
    <br class="clearBoth" />
    <label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
    <?php echo zen_draw_input_field('fax', $account->fields['customers_fax'], 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
    <?php
    }
    ?>
    
    DO NOT ERASE THE ABOVE CODE, ONLY PASTE THE NEW LINES OF CODE BELOW THE CODE ABOVE, here is the new code to paste under the code above:
    
    <br class="clearBoth" />
    <label class="inputLabel" for="taxid"><?php echo ENTRY_TAXID_NUMBER; ?></label>
    <?php echo zen_draw_input_field('taxid', $account->fields['customers_taxid'], 'id="taxid"') . (zen_not_null(ENTRY_TAXID_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TAXID_NUMBER_TEXT . '</span>': ''); ?>
    
    
    TO ADD FIELD UNDER ADMIN FOR EDITING EXISTING CUSTOMERS:
    10. Now go to Admin/customers.php and edit this file.
    (editing this file will allow you to see the taxid field when you edit customer information in the administrative section)
    
    11. Search for:
    
    $customers_fax = zen_db_prepare_input($_POST['customers_fax']);
    
    DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:
    
    $customers_taxid = zen_db_prepare_input($_POST['customers_taxid']);
    
    11a. Now search for:
    
    'customers_fax' => $customers_fax,
    
    DO NOT ERASE THE ABOVE CODE. PUT THE NEW CODE DIRECTLY UNDER THE CODE ABOVE, HERE IS THE EXTRA LINE OF CODE:
    
    'customers_taxid' => $customers_taxid,
    
    11b. Now search for:
    
    a.entry_country_id, c.customers_telephone, c.customers_fax,
    
    REPLACE THIS CODE WITH THE FOLLOWING CODE BELOW:
    
    a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_taxid,
    
    (ALL I DID WAS ADD "c.customers_taxid," TO THE END OF THE EXISTING CODE.)
    
    11c. Now search for:
    
    <tr>
    <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>
    <td class="main">
    <?php
    if ($processed == true) {
    echo $cInfo->customers_fax . zen_draw_hidden_field('customers_fax');
    } else {
    echo zen_draw_input_field('customers_fax', $cInfo->customers_fax, zen_set_field_length(TABLE_CUSTOMERS, 'customers_fax', 15));
    }
    ?>
    </td>
    </tr>
    
    DO NOT ERASE THIS CODE SIMPLY GO DIRECTLY UNDER THIS CODE AND ADD IN THE FOLLOWING CODE:
    
    <tr>
    <td class="main"><?php echo ENTRY_TAXID_NUMBER; ?></td>
    <td class="main">
    <?php
    if ($processed == true) {
    echo $cInfo->customers_taxid . zen_draw_hidden_field('customers_taxid');
    } else {
    echo zen_draw_input_field('customers_taxid', $cInfo->customers_taxid, zen_set_field_length(TABLE_CUSTOMERS, 'customers_taxid', 15));
    }
    ?>
    </td>
    </tr>
    
    12) In the file \includes\templates\<YOUR TEMPLATE>\templates\tpl_account_edit_default.php (it wasn't there for us so we copy-pasted it from the template_default folder)
    
    Right after:
    <label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
    <?php echo zen_draw_input_field('fax', $account->fields['customers_fax'], 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    Inserted:
    <label class="inputLabel" for="taxid"><?php echo ENTRY_TAXID_NUMBER; ?></label>
    <?php echo zen_draw_input_field('taxid', $account->fields['customers_taxid'], 'id="taxid"') . (zen_not_null(ENTRY_TAXID_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TAXID_NUMBER_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    13) In the file \includes\modules\pages\account_edit\header_php.php:
    
    a) After:
    $fax = zen_db_prepare_input($_POST['fax']);
    Inserted:
    $taxid = zen_db_prepare_input($_POST['taxid']);
    
    b) After:
    array('fieldName'=>'customers_fax', 'value'=>$fax, 'type'=>'string'),
    Inserted:
    array('fieldName'=>'customers_taxid', 'value'=>$taxid, 'type'=>'string'),
    
    c) Within the array:
    $account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
    customers_dob, customers_email_address, customers_telephone,
    customers_fax, customers_email_format, customers_referral
    FROM " . TABLE_CUSTOMERS . "
    WHERE customers_id = :customersID";
    
    Added customers_taxid, as follows:
    $account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
    customers_dob, customers_email_address, customers_telephone,
    customers_fax, customers_taxid, customers_email_format, customers_referral
    FROM " . TABLE_CUSTOMERS . "
    WHERE customers_id = :customersID";
    Good luck!

  3. #133
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Add a field into create account

    Hi All,

    I know this is an old topic, but as I needed additional fields on my create account page, this MOD seemed perfect....
    I installed and all new fields display in their proper places both in catalog & admin, and also seem to work fine when data is entered during registration.....

    All good so far... BUT!

    Now, one field (company name) now "does not write to the database! It has been working for years now, and as I went back over all of the extrafields MOD files, I could not see a relation to the company name field, and all looks good......

    Questions.....
    1) Which file actually "inserts" the posted data from the Create Account page to the DB?
    2) Any ideas how installing this MOD could stop another field from posting to the DB?

    Thanks!

  4. #134
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    544
    Plugin Contributions
    18

    Default Re: Add a field into create account

    @zapme1 it's really hard to say without seeing the files. It really could be any file in the installation causing the problem.

    Does this issue only happen on Creating Account, or does happen on Editing Account as well?
    Did you ever customize the files prior to installing this mod?
    Did you copy the exact files from the module, or did you merge them into your existing files?
    What version of ZenCart are you using?

  5. #135
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Add a field into create account

    Quote Originally Posted by jackie.taferner View Post
    @zapme1 it's really hard to say without seeing the files. It really could be any file in the installation causing the problem.

    Does this issue only happen on Creating Account, or does happen on Editing Account as well?
    Only on Creating Acct... If I edit the acct then the info is written to the DB....

    Did you ever customize the files prior to installing this mod?
    My site is heavily modified over the years..... Only modified Field Names & added a dropdown.... All seems to work tho...

    Did you copy the exact files from the module, or did you merge them into your existing files?
    Merged into existing files...

    What version of ZenCart are you using?
    1.3.9h
    Hi Jackie and thanks for the reply!

    I answered your questions in Red above.....

    UPDATE:
    I back-tracked and restored my original files one-by-one until my issue vanished and narrowed it to a single file from the MOD.....

    /includes/modules/MY_TEMPLATE/create_account.php

    This file "Was Not" existing in this folder before installing this MOD, so nothing has been modified in the file, so I'm confused how this is causing "NULL" to be entered in another fields DB slot???

    Any ideas?

  6. #136
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    544
    Plugin Contributions
    18

    Default Re: Add a field into create account

    Ok, thanks for this info!

    Please grab your copy of this file:
    /includes/modules/create_account.php

    Then merge the changes with this file:
    /includes/modules/MY_TEMPLATE/create_account.php

    That second file overwrites the first, so if you had changes in the other file, they would not carry over.

    Let me know if that works! If not, please copy the contents of that file here so I can have a look.

  7. #137
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    111
    Plugin Contributions
    0

    Default Re: Add a field into create account

    Quote Originally Posted by jackie.taferner View Post
    Ok, thanks for this info!

    Please grab your copy of this file:
    /includes/modules/create_account.php

    Then merge the changes with this file:
    /includes/modules/MY_TEMPLATE/create_account.php

    That second file overwrites the first, so if you had changes in the other file, they would not carry over.

    Let me know if that works! If not, please copy the contents of that file here so I can have a look.
    YAY!!! That Worked!!!

    There wasn't much to merge between the 2-files, and I still don't see what caused the issue, but the important thing is that It Works!

    Thank You So Much For Your Help, Jackie! :-)

  8. #138
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    544
    Plugin Contributions
    18

    Default Re: Add a field into create account

    Great! Glad I could help :)

 

 
Page 14 of 14 FirstFirst ... 4121314

Similar Threads

  1. How do I add a custom pulldown field to create account page?
    By margarita in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 May 2008, 07:48 PM
  2. add a field to "create account"
    By bobio in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 26 Jan 2008, 07:35 AM
  3. Create account Form field allign
    By manfer72 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Jan 2008, 12:01 AM
  4. Create a requested field in registration account
    By rosponina in forum Managing Customers and Orders
    Replies: 6
    Last Post: 31 Jul 2006, 09:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR