Zen Cart Logo
Forums / All Other Contributions/Addons / Additional Customers Fields

Additional Customers Fields

Locked

Views: 88,141

Results 461 to 480 of 491
This thread is locked. New replies are disabled.
28 May 2009, 6:42 AM
#461
frankderosa avatar

frankderosa

New Zenner

Join Date:
Jan 2009
Location:
Charlottesville, VA
Posts:
51
Plugin Contributions:
0

Additional Customers Fields

FrankDeRosa:

I have followed the instructions as supplied in the mod (using the v3.0 and I am getting a fatal error referencing class.base.php being defined already, on the customer side. I have the admin side working, to my knowledge. Any thoughts?

OK, turns out that I created a few extra files as I merged certain things. I had some extra files in the auto_loaders folder. This was bad. I have removed the extra junk and now that error is gone... replaced by a new one!

Fatal error: Class 'addCustomersFields' not found in /home/birchdev/public_html/inbio_dev/includes/autoload_func.php on line 69

This in turn seems to refer back to config.core.php, where the mod has code inserted to load a addCustomerFields object, around line 169. So I double checked in the classes folder, and addcustomersfields.php is there. That leaves me wondering, why can't class addcustomersfields be found? It's in there...

Any thoughts?

Thanks,
Frank

4 Jun 2009, 1:30 PM
#462
blackboi80 avatar

blackboi80

New Zenner

Join Date:
Mar 2008
Posts:
8
Plugin Contributions:
0

Re: Additional Customers Fields

Hi Guys, Is there some one out there who will be so kind as to put together a working update with all the bugs ironed out in the download area....pleassssssse. Thanks

24 Jun 2009, 2:44 AM
#463
supersnow avatar

supersnow

Zen Follower

Join Date:
Apr 2007
Location:
California, USA
Posts:
233
Plugin Contributions:
0

Re: Additional Customers Fields

I must say the new version of this module is great.

The only thing that I am now having trouble with is the testing for required fields. If nothing is entered I get the following warning which to a user will be very misleading.

[IMG]https://www.kravshop.com/wholesale/includes/templates/wholesale/images/icons/error.gif[/IMG] The following field has been set to "required" : - [B]Bus reg[/B] - and was sent to be updated with no content. Please make the proper corrections.    [IMG]https://www.kravshop.com/wholesale/includes/templates/wholesale/images/icons/error.gif[/IMG]  The following field has been set to "required" : - [B]{validation_post}[/B] - and was sent to be updated with no content. Please make the proper corrections.
```So where is this coming from so I can make it more understandable. I am aware of where this comes from:

the he following field has been set to "required" : - - and was sent to be updated with no content. Please make the proper corrections.


**Bus reg 
****{validation_post}

**It really doesn't tell the customer what fields they are missing. Plus why isn't the check for required fields not handled like the rest of the registration fields?
2 Jul 2009, 6:29 PM
#464
supersnow avatar

supersnow

Zen Follower

Join Date:
Apr 2007
Location:
California, USA
Posts:
233
Plugin Contributions:
0

Re: Additional Customers Fields

can anyone help me this my problem - anyone?

22 Jul 2009, 5:18 PM
#465
pink avatar

pink

New Zenner

Join Date:
May 2009
Posts:
64
Plugin Contributions:
0

Re: Additional Customers Fields

supersnow:

can anyone help me this my problem - anyone?

/includes/languages/english/extra_definitions/your_template/addcustomersfields.php

22 Jul 2009, 5:50 PM
#466
pink avatar

pink

New Zenner

Join Date:
May 2009
Posts:
64
Plugin Contributions:
0

Re: Additional Customers Fields

I installed additional_customers_fields_3-01 on a Zen Cart 1.3.8a.

In the backend I do get the following error entering into "additional customers fiels": > 1054 Unknown column 'field_required' in 'field list'

in:
[ SELECT field_id, field_name, field_required, field_status, use_url, field_url FROM customers_additional]

Going to "Create new additional customers fields", I do not get TYPE or SIZE options.

In the frontend I don't get the shop, but: > 1054 Unknown column 'field_required' in 'field list'

in:
[ SELECT field_id, field_name, field_required, field_status, use_url, field_url FROM customers_additional WHERE field_status = 1 ]

What's wrong?

22 Jul 2009, 6:00 PM
#467
pink avatar

pink

New Zenner

Join Date:
May 2009
Posts:
64
Plugin Contributions:
0

Re: Additional Customers Fields

Ok, with this I resolved the 1054-Error:

FrankDeRosa:

By the way, I believe the following query will get you a working table with all the fields included:

CREATE TABLE IF NOT EXISTS zen_customers_additional (
field_id int(11) NOT NULL AUTO_INCREMENT,
field_name varchar(255) NOT NULL DEFAULT '',
field_status char(2) NOT NULL DEFAULT '',
field_date date NOT NULL,
field_required int(11) NOT NULL,
use_url varchar(255) NOT NULL,
field_url varchar(255) NOT NULL,
field_url_name varchar(255) NOT NULL,
PRIMARY KEY (field_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

> 
> This uses the zen_ table prefix; you may need to adjust this or remove it if you don't use table prefixes.  Also, this inserts the whole table.  If you already inserted the 3 fields the instructions specify, you'll want to drop the table, then use this.
> 
> Frank

So, the install.txt suplied has a wrong sql for the db. > CREATE TABLE customers_additional (
>   field_id int(11) NOT NULL auto_increment,
>   field_name varchar(255) NOT NULL default '',
>   field_status char(2) NOT NULL default '',
>   PRIMARY KEY (field_id)
> ) ENGINE=MyISAM;

But I still don't have TYPE and SIZE options.
23 Jul 2009, 1:36 PM
#468
pink avatar

pink

New Zenner

Join Date:
May 2009
Posts:
64
Plugin Contributions:
0

Re: Additional Customers Fields

Pink:

But I still don't have TYPE and SIZE options.

Ok, got that too.

I had to copy the content of:
admin/includes/javascript/mods/additional_customers_fields/english/

to

admin/includes/javascript/mods/additional_customers_fields/german/.

That simpel.

(I thougt, that zc would take the english language files, if there is no one in the actualy choosen language. That's wrong.)

23 Aug 2009, 12:21 AM
#469
wlmartin avatar

wlmartin

New Zenner

Join Date:
Jun 2008
Posts:
34
Plugin Contributions:
0

Re: Additional Customers Fields

In the install instructions it says to use a compare program to edit certain files. The instructions also say that edits are identified as being "additional fields" edits - however when I use the compare program I find other lines of code in the "additional fields" files that differ with the default code. Some of these are on their face irrelevant but others I am not sure about. Can anyone tell me if these need to be edited in the default code or not?

For instance on admin/customers.php line 16 the code is different than the default code but it does not fall within the defines of the additional fields edit notations.

Thanks for your help

23 Aug 2009, 12:49 AM
#470
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: Additional Customers Fields

wlmartin:

In the install instructions it says to use a compare program to edit certain files. The instructions also say that edits are identified as being "additional fields" edits - however when I use the compare program I find other lines of code in the "additional fields" files that differ with the default code. Some of these are on their face irrelevant but others I am not sure about. Can anyone tell me if these need to be edited in the default code or not?

For instance on admin/customers.php line 16 the code is different than the default code but it does not fall within the defines of the additional fields edit notations.

Thanks for your help

It's hard to tell sometimes. Sometimes the author might have forgotten to put the identifier comments around their changes, sometimes it's a different modification that they did to their file for something unrelated and forgot to change it for this mod's release, sometimes someone uses an older core file to modify and there have since been changes to the core.

You have to look at what the uncommented changes do to see if it is related to what you are doing. Most of the time it isn't and it's pretty easy to tell that it's not related. I would advise to change only the parts specified and see if it works as expected. If you get errors you can go back, the error message will tell you what file is throwing the error.

23 Aug 2009, 2:23 AM
#471
wlmartin avatar

wlmartin

New Zenner

Join Date:
Jun 2008
Posts:
34
Plugin Contributions:
0

Re: Additional Customers Fields

Luckily I am trying it on my wamp server with a test store. I am going to do a fresh install and document every step I take to try to figure out what is wrong - pretty sure it is something I must have done.

I am not able at this point to actually add any additional fields in the drop down "Add Additional Fields". I get some of the errors mentioned above like the 1054.

I think I will post all the steps in an understandable format if I am able to complete the install successfully.

Appreciate the feedback.

23 Aug 2009, 1:09 PM
#472
wlmartin avatar

wlmartin

New Zenner

Join Date:
Jun 2008
Posts:
34
Plugin Contributions:
0

Re: Additional Customers Fields

Able to get all working on admin side. Just to verify install, I went to store end and attempted a customer login. Unable to login and using the debug utility I got the following error message:

**
PHP Fatal error: Cannot redeclare class addCustomersFields in C:\wamp\www*****\includes\classes\addcustomersfields.php on line 363**

Looked at the file and the only thing on line 363 is a " } ".

Appreciate any help.

31 Aug 2009, 10:00 PM
#473
grafikoweb avatar

grafikoweb

New Zenner

Join Date:
Jun 2009
Posts:
1
Plugin Contributions:
0

Re: Additional Customers Fields

Bjorn:

Thanks Oracle. Perhaps you could help me with the pull down function?

Sample provided;

zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $zone_id, 'id="stateZone"');

> 
> Altered;
> ```php
zen_draw_pull_down_menu('customers_age', $account->array['customers_age'], 'id="customers_age"');

Dropdown shows XX, I know the altered drop down is incorrect. Any ideas?

Bjorn

I tried it it's works fine to add pull down on front end (create_account page)

// End of additional customers fields.
// Additional customers fields.
if ($customersFields->countFields() > 0) {

if ($customersFields->isActive('type_bien') && $customersFields->isRequired('type_bien')) {
    ?>
    <label class="inputLabel" for="type_bien"><?php echo ENTRY_SURFACE; ?></label>
    <?php zen_draw_pull_down_menu('type_bien', $additional_customers_fields_form_pull_down_content['type_bien'], 'type_bien', 'id="type_bien"'); ?>
	<select name="test_field">
	  <option value="Maison">Maison</option>
	  <option value="Terrain">Terrain</option>
	  <option value="Appartement">Appartement</option>
	</select>    
    <br class="clearBoth" />
    <?php

} elseif ($customersFields->isActive('type_bien') && !$customersFields->isRequired('type_bien')) {
    ?>
    <label class="inputLabel" for="type_bien"><?php echo ENTRY_TYPE_BIEN; ?></label>
    <?php 
	
	 $modArray = array();

$modArray[] = array('id' => 'value1', 'text' => 'value1');
$modArray[] = array('id' => 'value2', 'text' => 'value2');
$modArray[] = array('id' => 'value3', 'text' => 'value3');

	echo zen_draw_pull_down_menu('type_bien',$modArray);

?>

    <br class="clearBoth" />
    <?php
}     

}
// End of additional customers fields.

And for the additional_customers_fields.php in admin/languages/english/extra_definition
$additional_customers_fields_form_pull_down_title['type_bien'] = array('Type de bien: ');
$additional_customers_fields_form_pull_down_content['type_bien'] = array(value1,value2,value3);

1 Sep 2009, 2:27 AM
#474
qwerpoiu338 avatar

qwerpoiu338

New Zenner

Join Date:
Dec 2007
Location:
Ontario, Canada
Posts:
27
Plugin Contributions:
0

Re: Additional Customers Fields

Hi, I've set up "additional customers fields" add on recently. How can I display data from the additional fields on to the confirmation page (page after "Add to Cart" button is clicked)?

1 Sep 2009, 9:02 PM
#475
dbjonline avatar

dbjonline

New Zenner

Join Date:
Mar 2009
Posts:
1
Plugin Contributions:
0

Re: Additional Customers Fields

Plain and simple, I have installed everything correctly, compared files, etc. I have test_field as the only additional new field per the install instructions. So, when I try to create a new account and DO NOT have test_field active in the admin area, i get the error: "The following field has been set to "required" : - {validation_post} - and was sent to be updated with no content. Please make the proper corrections" and so a new account is not created. Anyone else experiencing this and if it is corrected, please advise how. VERY FRUSTRATING! And thanks!:wacko:

10 Sep 2009, 4:12 PM
#476
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: Additional Customers Fields

I don't remember exactly but I had this as well. The problem was somewhere with another mod interfering. I think it was the customers.php.

The mods were tax id and how did you hear about us. Not sure if this applies to you but I am pretty sure you have two mods conflicting.

27 Sep 2009, 4:27 PM
#477
windswift avatar

windswift

New Zenner

Join Date:
Mar 2009
Posts:
15
Plugin Contributions:
0

Re: Additional Customers Fields

let me put all together:
upload admin and includes folder
apply SQL patch using code

CREATE TABLE customers_additional (
field_id int(11) NOT NULL AUTO_INCREMENT,
field_name varchar(255) NOT NULL DEFAULT '',
field_date date NOT NULL,
field_required int(11) NOT NULL,
use_url varchar(255) NOT NULL,
field_url varchar(255) NOT NULL,
field_url_name varchar(255) NOT NULL,
field_status char(2) NOT NULL DEFAULT '',
PRIMARY KEY (field_id)
) ENGINE=MyISAM

Create new field in Admin->customers->additional
usually INT for numbers and Verchar for letters and numbers

For self input,
insert code:

if ($customersFields->isActive('license') && $customersFields->isRequired('license')) {
?>
<legend><?php echo ENTRY_REQUIREDFIELD_TITLE; ?><span class="alert"><?php echo ENTRY_ADDITIONAL_TITLE; ?> </span></legend>
<label class="inputLabel" for="test_field"><?php echo ENTRY_LICENSE_TITLE; ?></label>
<?php echo zen_draw_input_field('license', '', zen_set_field_length(TABLE_CUSTOMERS, 'license', '10') . ' id="license"') . '<span class="alert">' . ENTRY_REQUIREDFIELD_NOTE_TITLE . '</span>'; ?>
<br class="clearBoth" />
<?php

} elseif ($customersFields->isActive('license') && !$customersFields->isRequired('license')) {
    ?>
    <legend><?php echo ENTRY_REQUIREDFIELD_TITLE; ?><span class="alert">*</span></legend>
    <label class="inputLabel" for="test"><?php echo ENTRY_LICENSE_TITLE; ?></label>
    <?php echo zen_draw_input_field('license', '', zen_set_field_length(TABLE_CUSTOMERS, 'license', '10') . ' id="license"'); ?>
    <br class="clearBoth" />
    <?php
}

After

// Additional customers fields.

if ($customersFields->countFields() > 0) {
in creat_account.php file.
also, insert
$additional_customers_fields_form_input_title['license'] = array('License number: ');
$additional_customers_fields_form_input_length['license'] = array("10");
in additional_customer_fields.php
make appropriate change (ie, change license to the field name you create in this case).
don't forget to add stuffs in addcustomerfields.php to make the language change.
for my example here is > define('ENTRY_REQUIREDFIELD_TITLE', 'Required Information: ');
define('ENTRY_LICENSE_TITLE', 'License number : ');

For people who want to create a drop down menu:

using following code:

if ($customersFields->isActive('occupation') && $customersFields->isRequired('occupation')) {
?>
<label class="inputLabel" for="occupation"><?php echo ENTRY_OCCUPATION; ?></label>

<?php zen_draw_pull_down_menu('occupation', $additional_customers_fields_form_pull_down_content['occupation'], 'occupation', 'id="occupation"'); ?> <select name="occupation"> <Option value="" >Please Select...</option> <option value="OPTION1">OPTION1</option> <option value="OPTION2">OPTION2</option> <option value="OPTION3">OPTION3</option> </select> <br class="clearBoth" /> <?php

} elseif ($customersFields->isActive('occupation') && !$customersFields->isRequired('occupation')) {
?>
<label class="inputLabel" for="occupation"><?php echo ENTRY_OCCUPATION; ?></label>

<?php zen_draw_pull_down_menu('occupation', $additional_customers_fields_form_pull_down_content['occupation'], 'occupation', 'id="occupation"'); ?> <select name="occupation"> <Option value="" >Please Select...</option> <option value="OPTION1">OPTION1</option> <option value="OPTION2">OPTION2</option> <option value="OPTION3">OPTION3</option> </select> <br class="clearBoth" /> <?php }

into Creat_account.php file, change "occupation" to the field name you created, and make appropriate change to the OPTIONS fields.
and add following code to additional_customer_fields.php

$additional_customers_fields_form_input_title['occupation'] = array('Occupation: ');
$additional_customers_fields_form_input_length['occupation'] = array("10");

27 Sep 2009, 4:35 PM
#478
windswift avatar

windswift

New Zenner

Join Date:
Mar 2009
Posts:
15
Plugin Contributions:
0

Re: Additional Customers Fields

I'm using zen cart 1.38a and 3.01 of this mod.
seems when i using the customer.php comes with this mod, the main page gets mashed up.

ID# First Name
Asc Desc Last Name
Asc Desc Company
Asc Desc Account Created
Asc Desc Last Login
Asc Desc Pricing Group
Asc Desc GV Balance
Asc Desc Authorized
Asc Desc Action
those titles are all gone.
really weird to me. I don't know if i'm the only one who have this issue.
also, dose anyone know how to put the information from additional fields to the main page of customer.php? I'd like to replace the company and GV balance from the main page with the additional information.
Thanks in advance

10 Oct 2009, 3:43 PM
#479
perlgerl avatar

perlgerl

New Zenner

Join Date:
Nov 2008
Posts:
9
Plugin Contributions:
0

Re: Additional Customers Fields

In the situation where more than one additional customer field has been added and is required, I found that only the first field was being flagged when there was an error. This is because of the way the logic is constructed in the function validatePostContent found in file /includes/classes/addcustomersfields.php at line 95.

function validatePostContent() {
global $messageStack;
$table_fields = $this->getFieldsContent();
foreach ($table_fields as $key => $val) {
   if (isset($_POST[$val]) && sizeof($_POST[$val]) > 0) {                
      if ($this->isRequired($val) && strlen(trim(zen_db_prepare_input($_POST[$val]))) > 0) {
        return true;
   } elseif (!$this->isRequired($val)) {
        return true;
   } else {
        ereg("(.+)\_(.+)", $val, $regs);
        $val = $regs[1] . " " . $regs[2];                  
        $messageStack->add(zen_db_prepare_input($_GET['main_page']), str_replace("{validation_post}", ucfirst(zen_output_string_protected($val)), ERROR_ADDITIONAL_CUSTOMERS_FIELDS_VALIDATION_POST));
        return false;
      }
    }
  }      
}

I replaced this function with the following. It's not the most elegant code, but it works and is heavily commented. The comments show why there is a constraint that the additional field names must contain only one underscore.

function validatePostContent() {
global $messageStack;
$table_fields = $this->getFieldsContent();
// $table_fields = Array ( [0] => test_field [1] => test_field2 etc
$count_errors = 0;
foreach ($table_fields as $key => $val) {
  // if the form contained any fields
  if (isset($_POST[$val]) && sizeof($_POST[$val]) > 0) {
  // and the field is mandatory and the trimmed string length is > 0
    if ($this->isRequired($val) && strlen(trim(zen_db_prepare_input($_POST[$val]))) > 0) {
      $count_errors = $count_errors + 0;
      // if the field is not mandatory
      } elseif (!$this->isRequired($val)) {
        $count_errors = $count_errors + 0;
      // string must be mandatory and blank
      } else {
        // Searches a string for matches to the regular expression given in pattern in a case-sensitive way.
	// If matches are found for parenthesized substrings of pattern and the function is called with the third argument regs , the matches will be stored in the elements of the array regs .
	// $regs[1] will contain the substring which starts at the first left parenthesis; $regs[2] will contain the substring starting at the second, and so on. $regs[0] will contain a copy of the complete string matched.
	// ereg ( string $pattern, string $string, array &$regs )
	// This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0
	// search $val for underscores to replace with spaces and split into two words to store in $regs[1] and $regs[2]
	ereg("(.+)\_(.+)", $val, $regs);
        $val = $regs[1] . " " . $regs[2];
	// get the error message from /includes/languages/english/extra_definitions/ksmf2010/addcustomersfields.php
        // and replace {validation_post} with a nice looking $val
	//                                                                                               str_replace (   $search for,                       $replace with,                                $search in                    )
        $messageStack->add(zen_db_prepare_input($_GET['main_page']), str_replace("{validation_post}", ucfirst(zen_output_string_protected($val)), ERROR_ADDITIONAL_CUSTOMERS_FIELDS_VALIDATION_POST));
	$count_errors = $count_errors + 1;
      }
    }
 }
  if ($count_errors > 0) {return false;} else {return true;}
}	

Hope this helps someone.

10 Oct 2009, 4:24 PM
#480
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Additional Customers Fields

split into two words to store in $regs[1] and $regs[2]```php
$val = $regs[1] . " " . $regs[2];

If $regs has only two values, they would be $regs[0] and $regs[1].