Forums / All Other Contributions/Addons / Minimum Customer Account Information - Support Thread

Minimum Customer Account Information - Support Thread

Views: 33,369

Results 61 to 80 of 88
27 Sep 2013, 7:20 PM
#61
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Minimum Customer Account Information - Support Thread

Oh Lat9 you are awesome! Thank you.x

2 Oct 2013, 1:47 PM
#62
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

lat9:

I've submitted v1.3.0 to the Plugins area; it should be available there shortly. Features:

  1. Added the capability to require the customer's country during account creation via admin configuration setting.
  1. If the country is enabled, a customer can choose the value during account creation and change it using their account_edit page.
  1. If the country is not enabled, the entry_country_id field in each customer's address record is set to the "Default Create Account Country ID".
  1. The first time someone accesses your admin after you copy the files, any 0-value entry_country_id fields in your database's address_book table are set to your store's "Default Create Account Country ID".
  1. Since the country is a demographic item only, it's not displayed on a customer invoice.

'tis now available ...

29 Nov 2013, 2:44 PM
#63
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

v1.4.0 has been submitted to the Plugins area, to pull in the downwardly-compatible updates introduced in Zen Cart v1.5.2.

7 Dec 2013, 1:19 AM
#64
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Minimum Customer Account Information - Support Thread

Thank you for the update Lat9.
I hope you are well?

I see that you have also updated thishttp://www.zen-cart.com/downloads.php?do=file&id=1597 add-on too. I am having a small issue with merging the respective file \includes\modules\pages\account_edit\header_php.php as both mods use this file. I've got it working without bringing across all the changes in the file.
My file content as follows

<?php
/**
 * Header code file for the customer's Account-Edit page
 *
 * @package page
 * @copyright Copyright 2012 Vinos de Frutas Tropicales (lat9): Minimum Customer Account Information
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Mon Jul 1 14:32:42 2013 -0400 Modified in v1.5.2 $
 */
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_EDIT');

if (!$_SESSION['customer_id']) {
  $_SESSION['navigation']->set_snapshot();
  zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
  if (ACCOUNT_GENDER == 'true') $gender = zen_db_prepare_input($_POST['gender']);
  $firstname = zen_db_prepare_input($_POST['firstname']);
  $lastname = zen_db_prepare_input($_POST['lastname']);
  if (ACCOUNT_DOB == 'true') $dob = (empty($_POST['dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_db_prepare_input($_POST['dob']));
/*-bof-a-minacct*/
  $company = zen_db_prepare_input($_POST['company']);
  $nick = zen_db_prepare_input($_POST['nick']);
/*-eof-a-minacct*/
//-bof-minacct-v1.3.0a-prepare country id, if set
  $country_id = (isset($_POST['country_id'])) ? zen_db_prepare_input($_POST['country_id']) : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
//-eof-minacct-v1.3.0a
  $email_address = zen_db_prepare_input($_POST['email_address']);
  $email_address_confirm = zen_db_prepare_input($_POST['email_address_confirm']);
  $telephone = zen_db_prepare_input($_POST['telephone']);
  $fax = zen_db_prepare_input($_POST['fax']);
  $email_format = zen_db_prepare_input($_POST['email_format']);

  if (CUSTOMERS_REFERRAL_STATUS == '2' and $_POST['customers_referral'] != '') $customers_referral = zen_db_prepare_input($_POST['customers_referral']);

  $error = false;

  if (ACCOUNT_GENDER == 'true') {
    if ( ($gender != 'm') && ($gender != 'f') ) {
      $error = true;
      $messageStack->add('account_edit', ENTRY_GENDER_ERROR);
    }
  }

  if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_FIRST_NAME_ERROR);
  }

  if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_LAST_NAME_ERROR);
  }

  if (ACCOUNT_DOB == 'true') {
    if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
      if (substr_count($dob,'/') > 2 || checkdate((int)substr(zen_date_raw($dob), 4, 2), (int)substr(zen_date_raw($dob), 6, 2), (int)substr(zen_date_raw($dob), 0, 4)) == false) {
        $error = true;
        $messageStack->add('account_edit', ENTRY_DATE_OF_BIRTH_ERROR);
      }
    }
  }

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR);
  }

  if (!zen_validate_email($email_address)) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
  } //added by STEVE for second field
  elseif ($email_address != $email_address_confirm) {
      $error = true;
      $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CONFIRM_NOT_MATCHING);
    }

  $check_email_query = "SELECT count(*) AS total
                        FROM   " . TABLE_CUSTOMERS . "
                        WHERE  customers_email_address = :emailAddress
                        AND    customers_id != :customersID";

  $check_email_query = $db->bindVars($check_email_query, ':emailAddress', $email_address, 'string');
  $check_email_query = $db->bindVars($check_email_query, ':customersID', $_SESSION['customer_id'], 'integer');
  $check_email = $db->Execute($check_email_query);

  if ($check_email->fields['total'] > 0) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
/*-bof-a-minacct*/
  }
/*-eof-a-minacct*/
    // check phpBB for duplicate email address
/*-bof-c-minacct*/
    if (is_object($bb) && $bb->check_email_not_used(zen_db_input($email_address), $nick) != bb::STATUS_OK) {
/*-eof-c-minacct*/
      $error = true;
      $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS . ' (' . $bb->get_bb_name() . ')');
/*-eof-c-zcbb*/
    }
/*-bof-d-minacct
  }
  -eof-d-minacct*/

  if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
    $error = true;

    $messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
  }
  
  $zco_notifier->notify('NOTIFY_HEADER_ACCOUNT_EDIT_VERIFY_COMPLETE');
  
/*-bof-a-minacct*/
  if (ACCOUNT_COMPANY == 'true' && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_COMPANY_ERROR);
  }
/*-eof-a-minacct*/

//-bof-minacct-v1.3.0a
  if ($country_id <= 0) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_COUNTRY_ERROR);
  }
//-eof-minacct-v1.3.0a

  if ($error == false) {
/*-bof-c-zcbb*/
    // update bulletin board with new address
    if (is_object($bb)) {   
      $bb->change_email(zen_db_input(zen_db_input($nick)), zen_db_input($email_address));
    }
/*-eof-c-zcbb*/
    $sql_data_array = array(array('fieldName'=>'customers_firstname', 'value'=>$firstname, 'type'=>'string'),
                            array('fieldName'=>'customers_lastname', 'value'=>$lastname, 'type'=>'string'),
                            array('fieldName'=>'customers_email_address', 'value'=>$email_address, 'type'=>'string'),
                            array('fieldName'=>'customers_telephone', 'value'=>$telephone, 'type'=>'string'),
                            array('fieldName'=>'customers_fax', 'value'=>$fax, 'type'=>'string'),
                            array('fieldName'=>'customers_email_format', 'value'=>$email_format, 'type'=>'string')
    );

    if ((CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '')) {
      $sql_data_array[] = array('fieldName'=>'customers_referral', 'value'=>$customers_referral, 'type'=>'string');
    }
    if (ACCOUNT_GENDER == 'true') {
      $sql_data_array[] = array('fieldName'=>'customers_gender', 'value'=>$gender, 'type'=>'string');
    }
    if (ACCOUNT_DOB == 'true') {
      if ($dob == '0001-01-01 00:00:00' or $_POST['dob'] == '') {
        $sql_data_array[] = array('fieldName'=>'customers_dob', 'value'=>'0001-01-01 00:00:00', 'type'=>'date');
      } else {
        $sql_data_array[] = array('fieldName'=>'customers_dob', 'value'=>zen_date_raw($_POST['dob']), 'type'=>'date');
      }
    }

    $where_clause = "customers_id = :customersID";
    $where_clause = $db->bindVars($where_clause, ':customersID', $_SESSION['customer_id'], 'integer');
    $db->perform(TABLE_CUSTOMERS, $sql_data_array, 'update', $where_clause);

    $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
            SET    customers_info_date_account_last_modified = now()
            WHERE  customers_info_id = :customersID";

    $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');

    $db->Execute($sql);

    $where_clause = "customers_id = :customersID AND address_book_id = :customerDefaultAddressID";
    $where_clause = $db->bindVars($where_clause, ':customersID', $_SESSION['customer_id'], 'integer');
    $where_clause = $db->bindVars($where_clause, ':customerDefaultAddressID', $_SESSION['customer_default_address_id'], 'integer');
    $sql_data_array = array(array('fieldName'=>'entry_firstname', 'value'=>$firstname, 'type'=>'string'),
    array('fieldName'=>'entry_lastname', 'value'=>$lastname, 'type'=>'string'));
/*-bof-a-minacct*/
    if (ACCOUNT_COMPANY == 'true') {
      $sql_data_array[] = array('fieldName' => 'entry_company', 'value' => $company, 'type' => 'string');
    }
/*-eof-a-minacct*/
//-bof-minacct-v1.3.0a-add country id
    if (defined('MIN_ACCOUNT_INCLUDE_COUNTRY') && MIN_ACCOUNT_INCLUDE_COUNTRY == true) {
      $sql_data_array[] = array('fieldName' => 'entry_country_id', 'value' => $country_id, 'type' => 'integer');
    }
//-eof-minacct-v1.3.0a

    $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);

    $zco_notifier->notify('NOTIFY_HEADER_ACCOUNT_EDIT_UPDATES_COMPLETE');

    // reset the session variables
    $_SESSION['customer_first_name'] = $firstname;

    $messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success');

    zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  }
}
/*-bof-c-minacct*/
$account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
                         customers_dob, customers_email_address, customers_telephone,
                         customers_fax, customers_email_format, customers_referral, entry_company,
                         customers_nick, entry_country_id
                  FROM   " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab
                  WHERE  c.customers_id = :customersID
                  AND    ab.customers_id = c.customers_id";  /*minacct-v1.3.0c*/
/*-eof-c-minacct*/
$account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
$account = $db->Execute($account_query);
//-bof-minacct-v1.3.0a
$country_id = ($account->fields['entry_country_id'] == 0) ? SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY : $account->fields['entry_country_id'];
//-eof-minacct-v1.3.0a
if (ACCOUNT_GENDER == 'true') {
  if (isset($gender)) {
    $male = ($gender == 'm') ? true : false;
  } else {
    $male = ($account->fields['customers_gender'] == 'm') ? true : false;
  }
  $female = !$male;
}

// if DOB field has database default setting, show blank:
$dob = ($dob == '0001-01-01 00:00:00') ? '' : $dob;

$customers_referral = $account->fields['customers_referral'];

if (isset($customers_email_format)) {
  $email_pref_html = (($customers_email_format == 'HTML') ? true : false);
  $email_pref_none = (($customers_email_format == 'NONE') ? true : false);
  $email_pref_optout = (($customers_email_format == 'OUT')  ? true : false);
  $email_pref_text = (($email_pref_html || $email_pref_none || $email_pref_out) ? false : true);  // if not in any of the others, assume TEXT
} else {
  $email_pref_html = (($account->fields['customers_email_format'] == 'HTML') ? true : false);
  $email_pref_none = (($account->fields['customers_email_format'] == 'NONE') ? true : false);
  $email_pref_optout = (($account->fields['customers_email_format'] == 'OUT')  ? true : false);
  $email_pref_text = (($email_pref_html || $email_pref_none || $email_pref_out) ? false : true);  // if not in any of the others, assume TEXT
}

$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);

// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_ACCOUNT_EDIT');
?>

If perhaps you could have a look, as and when, no biggie.
Thank you.

7 Dec 2013, 12:16 PM
#65
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

Here you go, picandnix:

<?php
/**
 * Header code file for the customer's Account-Edit page
 *
 * @package page
 * @copyright Copyright 2012 Vinos de Frutas Tropicales (lat9): Minimum Customer Account Information
 * @copyright Copyright 2003-2013 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: DrByte  Mon Jul 1 14:32:42 2013 -0400 Modified in v1.5.2 $
 */
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_EDIT');

if (!$_SESSION['customer_id']) {
  $_SESSION['navigation']->set_snapshot();
  zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
  if (ACCOUNT_GENDER == 'true') $gender = zen_db_prepare_input($_POST['gender']);
  $firstname = zen_db_prepare_input($_POST['firstname']);
  $lastname = zen_db_prepare_input($_POST['lastname']);
  if (ACCOUNT_DOB == 'true') $dob = (empty($_POST['dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_db_prepare_input($_POST['dob']));
/*-bof-a-minacct*/
  $company = zen_db_prepare_input($_POST['company']);
  $nick = zen_db_prepare_input($_POST['nick']);
/*-eof-a-minacct*/
//-bof-minacct-v1.3.0a-prepare country id, if set
  $country_id = (isset($_POST['country_id'])) ? zen_db_prepare_input($_POST['country_id']) : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
//-eof-minacct-v1.3.0a
  $email_address = zen_db_prepare_input($_POST['email_address']);
  $telephone = zen_db_prepare_input($_POST['telephone']);
  $fax = zen_db_prepare_input($_POST['fax']);
  $email_format = zen_db_prepare_input($_POST['email_format']);

  if (CUSTOMERS_REFERRAL_STATUS == '2' and $_POST['customers_referral'] != '') $customers_referral = zen_db_prepare_input($_POST['customers_referral']);

  $error = false;

  if (ACCOUNT_GENDER == 'true') {
    if ( ($gender != 'm') && ($gender != 'f') ) {
      $error = true;
      $messageStack->add('account_edit', ENTRY_GENDER_ERROR);
    }
  }

  if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_FIRST_NAME_ERROR);
  }

  if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_LAST_NAME_ERROR);
  }

  if (ACCOUNT_DOB == 'true') {
    if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
      if (substr_count($dob,'/') > 2 || checkdate((int)substr(zen_date_raw($dob), 4, 2), (int)substr(zen_date_raw($dob), 6, 2), (int)substr(zen_date_raw($dob), 0, 4)) == false) {
        $error = true;
        $messageStack->add('account_edit', ENTRY_DATE_OF_BIRTH_ERROR);
      }
    }
  }

  if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR);
  }

  if (!zen_validate_email($email_address)) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
  }

  $check_email_query = "SELECT count(*) AS total
                        FROM   " . TABLE_CUSTOMERS . "
                        WHERE  customers_email_address = :emailAddress
                        AND    customers_id != :customersID";

  $check_email_query = $db->bindVars($check_email_query, ':emailAddress', $email_address, 'string');
  $check_email_query = $db->bindVars($check_email_query, ':customersID', $_SESSION['customer_id'], 'integer');
  $check_email = $db->Execute($check_email_query);

  if ($check_email->fields['total'] > 0) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
/*-bof-a-minacct*/
  }
/*-eof-a-minacct*/
    // check phpBB for duplicate email address
/*-bof-c-zcbb*/
    if ($nick != '' && is_object($bb) && $bb->check_email_not_used(zen_db_input($email_address), $nick) != bb::STATUS_OK) {
      $error = true;
      if (method_exists($bb, 'get_bb_message'))
      $messageStack->add('account_edit', (method_exists($bb, 'get_bb_message') && $bb->get_bb_message() != '') ? $bb->get_bb_message() : (ENTRY_EMAIL_ADDRESS_ERROR_EXISTS . ' (' . $bb->get_bb_name() . ')') );
/*-eof-c-zcbb*/
    }
/*-bof-d-minacct
  }
  -eof-d-minacct*/

  if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
    $error = true;

    $messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
  }
  
  $zco_notifier->notify('NOTIFY_HEADER_ACCOUNT_EDIT_VERIFY_COMPLETE');
  
/*-bof-a-minacct*/
  if (ACCOUNT_COMPANY == 'true' && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_COMPANY_ERROR);
  }
/*-eof-a-minacct*/

//-bof-minacct-v1.3.0a
  if ($country_id <= 0) {
    $error = true;
    $messageStack->add('account_edit', ENTRY_COUNTRY_ERROR);
  }
//-eof-minacct-v1.3.0a

  if ($error == false) {
/*-bof-c-zcbb*/
    // update bulletin board with new address
    if (is_object($bb) && $nick != '') {   
      $bb->change_email(zen_db_input(zen_db_input($nick)), zen_db_input($email_address));
    }
/*-eof-c-zcbb*/
    $sql_data_array = array(array('fieldName'=>'customers_firstname', 'value'=>$firstname, 'type'=>'string'),
                            array('fieldName'=>'customers_lastname', 'value'=>$lastname, 'type'=>'string'),
                            array('fieldName'=>'customers_email_address', 'value'=>$email_address, 'type'=>'string'),
                            array('fieldName'=>'customers_telephone', 'value'=>$telephone, 'type'=>'string'),
                            array('fieldName'=>'customers_fax', 'value'=>$fax, 'type'=>'string'),
                            array('fieldName'=>'customers_email_format', 'value'=>$email_format, 'type'=>'string')
    );

    if ((CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '')) {
      $sql_data_array[] = array('fieldName'=>'customers_referral', 'value'=>$customers_referral, 'type'=>'string');
    }
    if (ACCOUNT_GENDER == 'true') {
      $sql_data_array[] = array('fieldName'=>'customers_gender', 'value'=>$gender, 'type'=>'string');
    }
    if (ACCOUNT_DOB == 'true') {
      if ($dob == '0001-01-01 00:00:00' or $_POST['dob'] == '') {
        $sql_data_array[] = array('fieldName'=>'customers_dob', 'value'=>'0001-01-01 00:00:00', 'type'=>'date');
      } else {
        $sql_data_array[] = array('fieldName'=>'customers_dob', 'value'=>zen_date_raw($_POST['dob']), 'type'=>'date');
      }
    }

    $where_clause = "customers_id = :customersID";
    $where_clause = $db->bindVars($where_clause, ':customersID', $_SESSION['customer_id'], 'integer');
    $db->perform(TABLE_CUSTOMERS, $sql_data_array, 'update', $where_clause);

    $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
            SET    customers_info_date_account_last_modified = now()
            WHERE  customers_info_id = :customersID";

    $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');

    $db->Execute($sql);

    $where_clause = "customers_id = :customersID AND address_book_id = :customerDefaultAddressID";
    $where_clause = $db->bindVars($where_clause, ':customersID', $_SESSION['customer_id'], 'integer');
    $where_clause = $db->bindVars($where_clause, ':customerDefaultAddressID', $_SESSION['customer_default_address_id'], 'integer');
    $sql_data_array = array(array('fieldName'=>'entry_firstname', 'value'=>$firstname, 'type'=>'string'),
    array('fieldName'=>'entry_lastname', 'value'=>$lastname, 'type'=>'string'));
/*-bof-a-minacct*/
    if (ACCOUNT_COMPANY == 'true') {
      $sql_data_array[] = array('fieldName' => 'entry_company', 'value' => $company, 'type' => 'string');
    }
/*-eof-a-minacct*/
//-bof-minacct-v1.3.0a-add country id
    if (defined('MIN_ACCOUNT_INCLUDE_COUNTRY') && MIN_ACCOUNT_INCLUDE_COUNTRY == true) {
      $sql_data_array[] = array('fieldName' => 'entry_country_id', 'value' => $country_id, 'type' => 'integer');
    }
//-eof-minacct-v1.3.0a

    $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);

    $zco_notifier->notify('NOTIFY_HEADER_ACCOUNT_EDIT_UPDATES_COMPLETE');

    // reset the session variables
    $_SESSION['customer_first_name'] = $firstname;

    $messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success');

    zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  }
}
/*-bof-c-minacct*/
$account_query = "SELECT customers_gender, customers_firstname, customers_lastname,
                         customers_dob, customers_email_address, customers_telephone,
                         customers_fax, customers_email_format, customers_referral, entry_company,
                         customers_nick, entry_country_id
                  FROM   " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab
                  WHERE  c.customers_id = :customersID
                  AND    ab.customers_id = c.customers_id";  /*minacct-v1.3.0c*/
/*-eof-c-minacct*/
$account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
$account = $db->Execute($account_query);
//-bof-minacct-v1.3.0a
$country_id = ($account->fields['entry_country_id'] == 0) ? SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY : $account->fields['entry_country_id'];
//-eof-minacct-v1.3.0a
if (ACCOUNT_GENDER == 'true') {
  if (isset($gender)) {
    $male = ($gender == 'm') ? true : false;
  } else {
    $male = ($account->fields['customers_gender'] == 'm') ? true : false;
  }
  $female = !$male;
}

// if DOB field has database default setting, show blank:
$dob = ($dob == '0001-01-01 00:00:00') ? '' : $dob;

$customers_referral = $account->fields['customers_referral'];

if (isset($customers_email_format)) {
  $email_pref_html = (($customers_email_format == 'HTML') ? true : false);
  $email_pref_none = (($customers_email_format == 'NONE') ? true : false);
  $email_pref_optout = (($customers_email_format == 'OUT')  ? true : false);
  $email_pref_text = (($email_pref_html || $email_pref_none || $email_pref_out) ? false : true);  // if not in any of the others, assume TEXT
} else {
  $email_pref_html = (($account->fields['customers_email_format'] == 'HTML') ? true : false);
  $email_pref_none = (($account->fields['customers_email_format'] == 'NONE') ? true : false);
  $email_pref_optout = (($account->fields['customers_email_format'] == 'OUT')  ? true : false);
  $email_pref_text = (($email_pref_html || $email_pref_none || $email_pref_out) ? false : true);  // if not in any of the others, assume TEXT
}

$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);

// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_ACCOUNT_EDIT');
?>
7 Dec 2013, 2:11 PM
#66
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Minimum Customer Account Information - Support Thread

lat9:

Here you go, picandnix:

It goes without saying that your code worked :hug:
Thank you Lat9

13 Dec 2013, 11:35 AM
#67
green_books avatar

green_books

New Zenner

Join Date:
Nov 2013
Location:
Hong Kong
Posts:
44
Plugin Contributions:
0

Re: Minimum Customer Account Information - Support Thread

Hi,

Can I remove the field "Country" only? I tried to do it by myself but failed.
Every time when I submit the registration form, it shows "You must select a country from the Countries pull down menu." warning box.

I'd installed "Selectable Countries" pulgin and was half-way-done of the FEC (fast & east checkout).

Actually I hide the City field, and rename "Country" to "City". Also, I'm using the Selectable Countries plugin to disabled all the countries except Hong Kong. However, I failed.
Attachment 13517

After the first try, I try to do the opposite: hide "Country" and just leave "City" alone. But I still got the warning box.
Attachment 13518

Is there a way to either 1.)remove "Country" field (& disable the warning box) or 2.)just disable the warning box?
I'd tried to edit "jquery_form_check.php" & "tpl_module_create_account.php" to suit my content.

Below is the link to my sign up page:
http://greenbooks.englishlearning.edu.hk/index.php?main_page=create_account

Thanks,
Eva

13 Dec 2013, 11:56 AM
#68
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Minimum Customer Account Information - Support Thread

Green Books:

Hi,

Can I remove the field "Country" only? I tried to do it by myself but failed.
Every time when I submit the registration form, it shows "You must select a country from the Countries pull down menu." warning box.

I'd installed "Selectable Countries" pulgin and was half-way-done of the FEC (fast & east checkout).

Actually I hide the City field, and rename "Country" to "City". Also, I'm using the Selectable Countries plugin to disabled all the countries except Hong Kong. However, I failed.
Attachment 13517

After the first try, I try to do the opposite: hide "Country" and just leave "City" alone. But I still got the warning box.
Attachment 13518

Is there a way to either 1.)remove "Country" field (& disable the warning box) or 2.)just disable the warning box?
I'd tried to edit "jquery_form_check.php" & "tpl_module_create_account.php" to suit my content.

Below is the link to my sign up page:
http://greenbooks.englishlearning.edu.hk/index.php?main_page=create_account

Thanks,
Eva

Hi Eva
To clarify, this mod is for a store that sells downloadable products only.
I'd suggest you install one mod at a time, test it thoroughly then start with the next mod.
Selectable Countries works fine with Minimum Account mod.

13 Dec 2013, 12:32 PM
#69
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

Eva, like picandnix indicated, Minimum Customer Account supports stores that sell only virtual (i.e. downloads and/or services) products and your store has physical products.

That said, you want to remove this plugin from your store. Then set your store's default country to Hong Kong (Configuration->My Store->Country) and use a combination of the Zen Cart admin's Configuration->Minimum Values (setting the minimum length of the City to 0) and Configuration->Customer Details to define which customer fields you need.

You can then use CSS on the login and create_account pages to "hide" the display of both the Country and City fields (make sure that you have text somewhere that indicates that all addresses entered are assumed to be in Hong Kong). That way, you won't get the error message about the invalid country and all your addresses will be Hong Kong-based.

2 May 2014, 1:18 PM
#70
garabaldi avatar

garabaldi

New Zenner

Join Date:
Nov 2013
Posts:
25
Plugin Contributions:
0

Re: Minimum Customer Account Information - Support Thread

i have just installed this on my 1.5.1 and thanks bud it works well.

just 1 thing i found was i had the telephone set to false and it was still showing.
i checked includes/templates/bask_black/templates/tpl_modules_create_account.php

  -eof-d-minacct */ 
?>
<hr />
<label class="inputLabel" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label>
<?php echo zen_draw_input_field('telephone', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', '40') . ' id="telephone"') . (zen_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php

  if (ACCOUNT_FAX_NUMBER == 'true') {
?>
<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
<?php echo zen_draw_input_field('fax', '', 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php
  }
/*-bof-d-minacct

i have added if (ACCOUNT_TELEPHONE_NUMBER == 'true') { } to the code and the telephone number now does not show.

  if (ACCOUNT_TELEPHONE_NUMBER == 'true') {  
?>
<hr />
<label class="inputLabel" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label>
<?php echo zen_draw_input_field('telephone', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', '40') . ' id="telephone"') . (zen_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php
}
  if (ACCOUNT_FAX_NUMBER == 'true') {
?>
<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
<?php echo zen_draw_input_field('fax', '', 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php
  }
/*-bof-d-minacct

if this has been mentioned before then sorry but i have not read through the 7 pages of posts.

thanks

2 May 2014, 3:14 PM
#71
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

garabaldi:

i have just installed this on my 1.5.1 and thanks bud it works well.

just 1 thing i found was i had the telephone set to false and it was still showing.
i checked includes/templates/bask_black/templates/tpl_modules_create_account.php

-eof-d-minacct */
?>

<hr /> <label class="inputLabel" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label> <?php echo zen_draw_input_field('telephone', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', '40') . ' id="telephone"') . (zen_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php

if (ACCOUNT_FAX_NUMBER == 'true') {
?>
<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>

<?php echo zen_draw_input_field('fax', '', 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php } /*-bof-d-minacct ``` > > i have added if (ACCOUNT_TELEPHONE_NUMBER == 'true') { } to the code and the telephone number now does not show. > ``` if (ACCOUNT_TELEPHONE_NUMBER == 'true') { ?> <hr /> <label class="inputLabel" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label> <?php echo zen_draw_input_field('telephone', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', '40') . ' id="telephone"') . (zen_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php } if (ACCOUNT_FAX_NUMBER == 'true') { ?> <label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label> <?php echo zen_draw_input_field('fax', '', 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?> <br class="clearBoth" /> <?php } /*-bof-d-minacct ``` > > if this has been mentioned before then sorry but i have not read through the 7 pages of posts. > > thanks Nice catch, garabaldi! I'll get your fix into the next revision.
2 May 2014, 3:47 PM
#72
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

I've only made a slight change to your proposed fix, moving the check underneath the <hr />:

<hr />
<?php
 if (ACCOUNT_TELEPHONE_NUMBER == 'true') {  
?>
<label class="inputLabel" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label>
<?php echo zen_draw_input_field('telephone', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', '40') . ' id="telephone"') . (zen_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php
}
  if (ACCOUNT_FAX_NUMBER == 'true') {
?>
<label class="inputLabel" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
<?php echo zen_draw_input_field('fax', '', 'id="fax"') . (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
<?php
  }
/*-bof-d-minacct
23 May 2014, 6:20 PM
#73
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

v1.4.1 (which corrects the Telephone issue) is now available for download from the Plugins.

28 May 2014, 6:38 PM
#74
garabaldi avatar

garabaldi

New Zenner

Join Date:
Nov 2013
Posts:
25
Plugin Contributions:
0

Re: Minimum Customer Account Information - Support Thread

this works great and when someone signs up they dont have to give their address.

but if a guest goes to buy and uses the paypal button their account is created by paypal and they send the customers address. is there a way to stop this or is it a paypal problem.

thanks

garabaldi

28 May 2014, 10:40 PM
#75
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Minimum Customer Account Information - Support Thread

garabaldi:

this works great and when someone signs up they dont have to give their address.

but if a guest goes to buy and uses the paypal button their account is created by paypal and they send the customers address. is there a way to stop this or is it a paypal problem.

thanks

garabaldi

Is it a big problem having that unnecessary information? I don't mean that in a derogatory way, but is it actually a business problem?

29 May 2014, 12:01 PM
#76
garabaldi avatar

garabaldi

New Zenner

Join Date:
Nov 2013
Posts:
25
Plugin Contributions:
0

Re: Minimum Customer Account Information - Support Thread

its not a big problem but having the minimum amount of information stored in a store that only does virtual products is better than having personal information that is not needed. especially on the net.

the whole point of this is to keep the minimum of information given/stored and so this is just a glitch but one i want to fix :D

thanks

29 May 2014, 2:08 PM
#77
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

garabaldi, this plugin's purpose is to limit the amount of information collected during a "normal" Zen Cart create-account process; the information collected when the customer creates an account using the Express Checkout button's processing is beyond its scope. If you don't want your customer accounts created by PayPal, you could always disable the Express Checkout button.

2 Jun 2014, 1:08 PM
#78
garabaldi avatar

garabaldi

New Zenner

Join Date:
Nov 2013
Posts:
25
Plugin Contributions:
0

Re: Minimum Customer Account Information - Support Thread

yes i understand bud, i just disable the button as you suggested.

thank you :D

3 Jun 2014, 1:16 PM
#79
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

Great, I'm glad that made the process work for you!

13 Jul 2014, 12:44 PM
#80
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,116
Plugin Contributions:
56

Re: Minimum Customer Account Information - Support Thread

I've submitted v1.4.2 to the Plugins for approval (http://www.zen-cart.com/downloads.php?do=file&id=1465). It contains downwardly-compatible updates that bring the template-override files into line with Zen Cart v1.5.3.