New Zenner
- Join Date:
- Apr 2005
- Posts:
- 99
- Plugin Contributions:
- 0
Additional Customers Fields
TheOracle:
Again - the activity of what causes this ?
When I go to create an account, the duplicated fields are already there. Not doing anything.
Views: 88,141
New Zenner
TheOracle:
Again - the activity of what causes this ?
When I go to create an account, the duplicated fields are already there. Not doing anything.
New Zenner
Please forgive me if I am duplicating an inquiry, my eyes didn't find what I was needing...
My current site is running:MYSQL 4.1.10 with Server version 4.1.22-standard and PhpMyAdmin 2.9.0.2
This is my problem:
I went to the admin and played with the information on the additional customer fields. It doesn't show up when they log in so I am assuming that is not something this provides (when they apply for an account...) but when going to the customer information, click edit and looking to "Additional Customer Fields it is blank..." then when clicking on "update" I get this error...
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE customers_id = 1' at line 1
in:
[UPDATE zen_customers SET WHERE customers_id = 1]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
I am unable, all together, see the new fields either on the customer side as well as the Admin end of things.
ANY help you can provide (and I am sure you tire from the inquiries) would be absolutely relished and thank you in advance for your time.
VV
Suspended
When I go to create an account, the duplicated fields are already there. Not doing anything.
Can't see any template readings between your while and ending while statement from your tpl_modules_create_account.php file yet.
UPDATE zen_customers SET WHERE customers_id = 1
I assume this error comes from your admin/customers.php file.
See that you have something like:
UPDATE " . TABLE_CUSTOMERS . " SET " . $additional_sql . " WHERE customers_id = '" . (int)$customers_id . "'
This part of instruction is also stated from my installation guide.
The produced error from your end means that you did not incorporated my modules correctly under that file since the $additional_sql variable cannot be initialized for your case. See the installation instructions again on this matter as you must assure to have downloaded the latest version of this MOD from my site.
New Zenner
Hello Oracle,
Progress has been made. I ran the file comparison again as you suggested and found the offending file. Now the menu for additional options shows up in my admin. Also, "sql patch" has created the needed table in the database. Hoorah!
I did read the instructions in the file. Yes, I did reread. Yes, there was STILL a blank look after rereading a third time. However, after reading more of this thread, I was able to figure out what exactly the "additional_customers_fields.php" was meant to accomplish.
I followed the instructions to make an "Authorized Buyer" field. Can you see where I may have messed this process up?
Results=
Also, from reading through this thread, I made sure more than one additional field was created.
Any ideas? If I'm missing any details to help with an answer, please let me know. This would be an AMAZING help if I could get it to work. I've just been working at it for awhile and have a feeling I'm overlooking something.
Thanks for you time!
New Zenner
On the multiple fields topic, here is my template page:
/catalog/includes/templates/silverfish/templates/tpl_modules/create/account.php
<?php // Additional customers fields begins here. ?>
<?php if (isset($account->fields['field_name'])) { ?>
<fieldset>
<?php if (isset($account->fields['field_status']) && $account->fields['field_status'] == 2) {
?>
<legend><?php echo ENTRY_ADDITIONAL_CUSTOMERS_FIELDS_TITLE; ?></legend>
<?php
} // End of if statement.
while (!$account->EOF) {
// We now set up an additional customer field for hobbies.
if (isset($account->fields['field_name']) && $account->fields['field_name'] == "customers_hobbies") {
echo add_customers_fields_for_create_account('customers_hobbies', 'zen_draw_textarea_field');
} // End of additional customers fields for hobbies.
// We now set up an additional customer field for sales representative.
if (isset($account->fields['field_name']) && $account->fields['field_name'] == "sales_rep") {
echo add_customers_fields_for_create_account('sales_rep', 'zen_draw_pull_down_menu');
} // End of additional customers fields for ages.
// We now set up an additional customer field for cellphone.
if (isset($account->fields['field_name']) && $account->fields['field_name'] == "customers_cellphone") {
echo add_customers_fields_for_create_account('customers_cellphone', 'zen_draw_input_field');
} // End of additional customers fields for cellphone.
// We now set up an additional customers fields for pods.
if (isset($account->fields['field_name']) && $account->fields['field_name'] == "customers_pod") {
echo add_customers_fields_for_create_account('customers_pod', 'zen_draw_radio_field');
} // End of additional customers fields for pods.
$account->MoveNext();
} // End of while statement.
?>
</fieldset>
<?php
} // End of if statement.
// End of additional customers fields.
?>
New Zenner
Also if I go to edit a customer from the admin side my pull down menu shows up, but there is no content in the pull down box. So, then I also create a radio button selection and it shows up but still no pull down. What am I doing wrong? Here is my admin/includes/languages/english/extra_definitions/additional_customers_fields.php
// Additional Customers Fields - Form Type Table Title For Whole Additional Window.
define('ADDITIONAL_CUSTOMERS_FIELDS_FORM_TITLE', 'Sales Representative');
//=========================================================================================================
// Additional Customers Fields - Form Type Table Structure (Input text fields)
// Here's out it works in HTML version for the input text:
// - <input type="text" name="customers_hobbies" value="your content">
// - <input type="text" name="customers_age" value="your content">
// - <input type="text" name="customers_cellphone" value="your content">
// Imagine; almost four years has passed and all the pain we had to push ourselves into.
// This new way is a way for your freedom. All you need to do is to enter "one" title name for
// each additional customers fields you have created from the MOD.
// Remember, a constance of 'two additional customers fields' is needed.
// You can see some example below. As you can see, for the input type, there are no content.
// Of course not, the content is being gathered from the database since no options are required
// in order to ask customers to fill their content. The title should suffise in this case (the same for the textarea type).
//-------------------------------------------------------------------------
// Here's a cheap preview:
// Title | Content
// ------------------------------------------------------------------------
// From your admin/customers.php file, before this MOD was ever built, additional fields required to be
// added manually into the file as expertise were required in order to accomplish the task without
// any damages involved.
// Try it here and time yourself to see how fast you can implement new fields - starting from this point.
// Array functionality:
// As for the other fields type -
// The way arrays work, again, one title only. As for the content, you can add unlimited texts and values inside.
// Ex: ("test1", "test2", "test3") and so on. Remember to add your title first.
// In your admin/customers.php file, the results will output like this if you choose the pull down list type:
// Title | test1
// test2
// test3
// As for your radio title, it will output like this:
// Title | <button> test1 <button> test2 <button> test3
// If you have read this text until here, then you should understand how it works. If not, you can always request support
// from the author for additional help.
// 1st note: If you're worried about having your fields checked by default, don't worry - it is already implemented in the MOD.
// 2nd note: Do NOT add the additional customers name field twice on two different form types. Otherwise, you might alter
// your specific customer's options.
// 3rd note: There are no checkboxes options inside this MOD yet. Reason: Checkboxes are meant for specific actions.
// It cannot be determined on what exacly you'd like to do with these checkboxes (ex: delete, update, select, checked without validations ect ...).
// Below are few examples on how it works. You can customize these names into the fields name you created - the way you like them to be.
// Update note June 7, 2007: If you intend to, either, use the pull-down menus 'or' the radio buttons, make sure to set the default value to 1 rather than 0.
// Good luck !
//=========================================================================================================
//$additional_customers_fields_form_input_title['customers_hobbies'] = array('Hobbies: ');
//$additional_customers_fields_form_input_title['customers_age'] = array('Age: ');
$additional_customers_fields_form_input_title['customers_cellphone'] = array('Cellphone: ');
// Additional Customers Fields - Form Type Table Structure (Textarea fields)
$additional_customers_fields_form_textarea_title['customers_hobbies'] = array('Hobbies: ');
//$additional_customers_fields_form_textarea_title['customers_age'] = array('Age: ');
//$additional_customers_fields_form_textarea_title['customers_cellphone'] = array('Cellphone: ');
// Additional Customers Fields - Form Type Table Structure (Select fields - title)
//$additional_customers_fields_form_pull_down_title['customers_hobbies'] = array('Hobbies: ');
//$additional_customers_fields_form_pull_down_title['customers_cellphone'] = array('Cellphone: ');
//$additional_customers_fields_form_pull_down_content['customers_hobbies'] = array("test1");
$additional_customers_fields_form_pull_down_title['sales_rep'] = array('Sales Representative: ');
$additional_customers_fields_form_pull_down_content['sales_rep'] = array("None", "Mel Kimmel", "Boyd Thomas");
//$additional_customers_fields_form_pull_down_content['customers_cellphone'] = array("test3");
//$additional_customers_fields_form_radio_title['customers_hobbies'] = array("Hobbies: ");
$additional_customers_fields_form_radio_title['sales_rep'] = array("Sales Representative: ");
//$additional_customers_fields_form_radio_title['customers_cellphone'] = array("Cellphone: ");
//$additional_customers_fields_form_radio_content['customers_hobbies'] = array("Test1");
$additional_customers_fields_form_radio_content['sales_rep'] = array("None", "Mel Kimmel", "Boyd Thomas");
//$additional_customers_fields_form_radio_content['customers_cellphone'] = array("Test3");
New Zenner
Also, is there any way to get this additional field to show up on the invoice when I print it?
New Zenner
I also get this error when I try to update the customer from the admin side.
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE customers_id = 36' at line 1
in:
[UPDATE customers SET WHERE customers_id = 36]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Suspended
- Admin Customer Details: no extra fields show
Of course not. No content has been filled from the customers yet. It will only show up when customers will fill something inside each new create additional customers fields.
- Customer/storefront: Login form shows box with the heading "Additional Customers Fields" but the added field does not show
Sounds like you did not went into your template files and languages files for adding the required initials of your additional customers fields once you activated the field from the admin - > customers - > add customers fields page.
- Customer/storefront/my account info: Same heading but empty box as #2
Here you go. Perfect sense. The content has not been filled by the customer from your account edit page. Of course, for the registration page, you must at least follow my reply right above for your 2..
Also, from reading through this thread, I made sure more than one additional field was created.
Any ideas? If I'm missing any details to help with an answer, please let me know. This would be an AMAZING help if I could get it to work. I've just been working at it for awhile and have a feeling I'm overlooking something.
Sure. Apply my steps on this thread. :smile:
<?php // Additional customers fields begins here. ?> <?php if (isset($account->fields['field_name'])) { ?><fieldset> <?php if (isset($account->fields['field_status']) && $account->fields['field_status'] == 2) { ?> <legend><?php echo ENTRY_ADDITIONAL_CUSTOMERS_FIELDS_TITLE; ?></legend> <?php } // End of if statement. while (!$account->EOF) { // We now set up an additional customer field for hobbies. if (isset($account->fields['field_name']) && $account->fields['field_name'] == "customers_hobbies") { echo add_customers_fields_for_create_account('customers_hobbies', 'zen_draw_textarea_field'); } // End of additional customers fields for hobbies. // We now set up an additional customer field for sales representative. if (isset($account->fields['field_name']) && $account->fields['field_name'] == "sales_rep") { echo add_customers_fields_for_create_account('sales_rep', 'zen_draw_pull_down_menu'); } // End of additional customers fields for ages. // We now set up an additional customer field for cellphone. if (isset($account->fields['field_name']) && $account->fields['field_name'] == "customers_cellphone") { echo add_customers_fields_for_create_account('customers_cellphone', 'zen_draw_input_field'); } // End of additional customers fields for cellphone. // We now set up an additional customers fields for pods. if (isset($account->fields['field_name']) && $account->fields['field_name'] == "customers_pod") { echo add_customers_fields_for_create_account('customers_pod', 'zen_draw_radio_field'); } // End of additional customers fields for pods. $account->MoveNext(); } // End of while statement. ?> </fieldset> <?php} // End of if statement.
// End of additional customers fields.
?>
AGAIN ! - Please post your messages within 1-2 threads for your problems (for each problems at least). I'm sorry but the next time I'm seeing this - no more support for you !
That does look right ... hope I didn't coded my function wrong. I will test this in a couple of mins and confirm if this is a bug or not regarding the multiple fields showing up twice (or more).
Also if I go to edit a customer from the admin side my pull down menu shows up, but there is no content in the pull down box. So, then I also create a radio button selection and it shows up but still no pull down. What am I doing wrong? Here is my admin/includes/languages/english/extra_definitions/additional_customers_fields.php
$additional_customers_fields_form_pull_down_title['sales_rep'] = array('Sales Representative: ');
$additional_customers_fields_form_pull_down_content['sales_rep'] = array("None", "Mel Kimmel", "Boyd Thomas");
What did you selected for the field type ? I just noticed I forgot to state an important line in my documentation.
All drop down fields must be created as INT in order to see the pull down menu's content.
Sorry about that. I will add this part into my documentation immediately and leave an update when my package will be ready. :lookaroun
For now, you may delete your sales_rep field from the admin and re-create it again (as int this time). It should work from there - thanks for the catch. :smile:
Also, is there any way to get this additional field to show up on the invoice when I print it?
I'm not sure what you mean there ... all customers who completes an order should have the additional customers fields included (and this - of course - if you have followed my instructions regarding the email template and checkout_process.php's language file). If it wasn't what you meant, please advise.
I also get this error when I try to update the customer from the admin side.
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE customers_id = 36' at line 1
in:
[UPDATE customers SET WHERE customers_id = 36]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Please read 5-6 thread above. The reason for this has been mentionned.
New Zenner
Hello again Oracle,
Thank you for continuing to reply to all the questions.
TheOracle:
Of course not. No content has been filled from the customers yet. It will only show up when customers will fill something inside each new create additional customers fields.
The registration form in Zen allows fields to show, even if they haven't been filled out, so the admin or customer may fill them at a later date. This mod does not allow for fields to be available until the customer fills them out?
TheOracle:
Sounds like you did not went into your template files and languages files for adding the required initials of your additional customers fields once you activated the field from the admin - > customers - > add customers fields page.
From the instructions I thought the only file that needed customized text/code (ie my choice of title/type of field) added to it after creating the fields was in the "additional_customers_fields.php". Are there other template and/or language files to add coding to as well? If so, which? I haven't found such an answer in this thread, however it's quite possible I'm overlooking it. :wink:
Suspended
This mod does not allow for fields to be available until the customer fills them out?
This restriction only applies to your account edit page. Not for create account. For create account, you should be able to see the additional customers fields once you activated the fields from the admin and applied the steps correctly towards your extra_definitions language file (store-front & admin) and the template files (store-front).
however it's quite possible I'm overlooking it.
Indeed. The only files you need to edit for your store-front is the additional_customers_fields_create_account.php and additional_customers_fields_account_edit.php under your extra_definitions folder once you activated the fields from the admin. Then, you need to edit the template files for your create account and account edit under the while loop statement.
Also, not to forget that if you need to see these fields under your admin - > customers page, you need to edit your additional_customers_fields.php file under your admin's extra_definitions folder.
New Zenner
Thank you for replying. I deleted my sales_rep field and reinstalled it as an INT and nothing changed, I still can't see the content in my pull down menu.
Suspended
Unless you did not compared your admin/customers.php file with mine, I cannot reproduce this problem.
New Zenner
I am getting the error that you responded to in post #303. This is the code that I have. Does it look ok to you?
Here is my admin/customers.php file:
// Additional Customers Fields.
$additional_sql = "";
$table_fields = $db->get_table_fields(TABLE_CUSTOMERS);
foreach ($table_fields as $key => $val) {
if (!in_array($key, $customers_table_fields)) {
$key = zen_output_string_protected($key);
if (isset($_POST[$key]) && isset($table_fields[$key]) && eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,6}$", zen_db_prepare_input($_POST[$key])) && zen_validate_email($_POST[$key])) {
$additional_sql .= ", $key = '".zen_db_prepare_input($_POST[$key])."', ";
} elseif (isset($_POST[$key]) && isset($table_fields[$key])) {
$additional_sql .= ", $key = '".zen_db_prepare_input(strip_tags($_POST[$key]))."', ";
}
}
}
if (!empty($additional_sql)) {
$additional_sql .= substr($additional_sql, 0, strlen($additional_sql) -2);
}
$sql_update = "UPDATE " . TABLE_CUSTOMERS . " SET " . zen_db_output($additional_sql) . " WHERE customers_id = " . (int)$customers_id;
$db->Execute($sql_update);
// End of Additional Customers Fields.
Suspended
1 - All I see is my block. No information on where precisely this has been pasted.
2 - Different subject from the last post above. First, you stated a problem regarding a field and now you're stepping back on the previous page without resolving the last issue.
New Zenner
Hey rbepple,
Is there a possible way you can send me your files for this mod? Cause I am still having problems on the admin side, and you are the only person with MYSQL 5 that seems to have gotten the dreaded error to work.
1054 Unknown column 'c.customers_default_address_id' in 'on clause'
in:
[select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id, c.customers_email_format, c.customers_group_pricing, c.customers_authorization, c.customers_referral, ac.field_name, ac.field_status from customers c, customers_additional ac left join address_book a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '9']
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
theoracle,
PHP Version 5.1.4 with MySQL 4.1.21 seems to work fine with this mod.
We just have to delete 'moderators_level' => 1, in \includes\modules\your_template\create_account.php, cause moderators_level error appears when the moderators level mod is not install.
also the following code in the same file has problems, had to delete it for it to work under PHP Version 5.1.4.
if (!get_support_ticket_tables($_SESSION['customer_id'], 'check_if_support_ticket_tables_exists')) {
get_support_ticket_tables($_SESSION['customer_id'], 'create_support_ticket_tables');
} // End of if statement.
Also, do you think its possible for MYSQL 5 to duplicated the fields like the picture I posted? Cause I tried installing the mod on a default classic template and the fields still duplicates itself.
New Zenner
That code that I pasted is straight off or your MOD that I uploaded so that code is where you wrote it in admin/customers.php. I never moved it. My boss has bumped this problem to the highest priority because we cannot edit any customers. We can go to the edit page but when we click up date we get the error and we don't even have to change any fields to get the error. I am still having the problem with the field showing up more than once and the empty contents in the customer edit page, but the admin side has been deamed more crucial to us.
New Zenner
Blitz49,
I have n oclue on how to send a file. Sorry!
New Zenner
Its okay, thanks tho. Guess I just gotta wait for this mod to get updated to MYSQL 5 thats all.
Suspended
theoracle,
PHP Version 5.1.4 with MySQL 4.1.21 seems to work fine with this mod.
We just have to delete 'moderators_level' => 1, in \includes\modules\your_template\create_account.php , cause moderators_level error appears when the moderators level mod is not install.
First - this is not about a PHP v5.x issue but rather a mySQL v5.x issue (as mentionned earlier).
Second - The moderators_level field should NOT appear into the additional customers fields updates nor insert statements if you did added the field into the customers_table_fields array from your extra_definitions folder.
As for the admin end, if you did not installed the MOD, there's no way this field could interfer with this MOD since the field, physically, doesn't exist. However, if you did installed it, it shouldn't be any problem either since it has to manually update the moderators_level field - considered as a core field (since this has nothing to do with this MOD).
Its okay, thanks tho. Guess I just gotta wait for this mod to get updated to MYSQL 5 thats all.
Again - it is NOT a MOD issue but an unflexibility of mySQL v5.x since it is NOT a stable version - done by mySQL manufacturer.
Fields marked required must be completed.
Tell staff why this post should be reviewed.