Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 41
  1. #21
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Simple and Easy 2 Question Create Account Page

    So, wouldn't know it from just reviewing this thread, but the lack of direct answer to this question has spawned an entire thread about possibly leaving zencart, inciting others to discuss the possibility of leaving ZC all because the topic of this thread has not been entered... So, tonight, I decided to have a go.. In the last hour I came up with the following, although there are still a few things that are not quite right yet..

    For one, I "cheated" on disabling many of the fields to have them controlled at this point by use of the customer's gender. and that is used pretty much throughout the disabled area(s)... Considering how important the whole thing is to the "success" of continuing to use ZC, there is one thing I haven't quite fixed/figured out, but for the night I'm quiting... Let someone else step in and find this last part... The way I've made this work, a user can create an account, and the fact that no address is assigned the customer is ignored until they basically try to go to checkout... Then the user is redirected to the the address_book_entry if one is/was not already assigned... All well and good... But done with the address entry? and well, it would be desirable at that point to return to the checkout process (checkout_shipping), but instead it goes back to my account... I don't have appropriate tools installed to track the data/variables, so further need to wait till later, but the following files were modified in support of this and are attached below:

    includes/modules/YOUR_TEMPLATE/create_account.php:
    Code:
    <?php
    /**
     * create_account header_php.php
     *
     * @package modules
     * @copyright Copyright 2003-2012 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  Sat Jul 21 16:05:31 2012 -0400 Modified in v1.5.1 $
     */
    // This should be first line of the script:
    $zco_notifier->notify('NOTIFY_MODULE_START_CREATE_ACCOUNT');
    
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    /**
     * Set some defaults
     */
      $process = false;
      $zone_name = '';
      $entry_state_has_zones = '';
      $error_state_input = false;
      $state = '';
      $zone_id = 0;
      $error = false;
      $email_format = (ACCOUNT_EMAIL_PREFERENCE == '1' ? 'HTML' : 'TEXT');
      $newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '0' ? false : true);
    
    /**
     * Process form contents
     */
    if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
      $process = true;
      $antiSpam = isset($_POST['should_be_empty']) ? zen_db_prepare_input($_POST['should_be_empty']) : '';
      $zco_notifier->notify('NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK');
    
      if (ACCOUNT_GENDER == 'true') {
        if (isset($_POST['gender'])) {
          $gender = zen_db_prepare_input($_POST['gender']);
        } else {
          $gender = false;
        }
      }
    
      if (isset($_POST['email_format'])) {
        $email_format = zen_db_prepare_input($_POST['email_format']);
      }
    
      if (ACCOUNT_COMPANY == 'true') $company = zen_db_prepare_input($_POST['company']);
      $firstname = zen_db_prepare_input(zen_sanitize_string($_POST['firstname']));
      $lastname = zen_db_prepare_input(zen_sanitize_string($_POST['lastname']));
      $nick = zen_db_prepare_input($_POST['nick']);
      if (ACCOUNT_DOB == 'true') $dob = zen_db_prepare_input($_POST['dob']);
      $email_address = zen_db_prepare_input($_POST['email_address']);
      $street_address = zen_db_prepare_input($_POST['street_address']);
      if (ACCOUNT_SUBURB == 'true') $suburb = zen_db_prepare_input($_POST['suburb']);
      $postcode = zen_db_prepare_input($_POST['postcode']);
      $city = zen_db_prepare_input($_POST['city']);
      if (ACCOUNT_STATE == 'true') {
        $state = zen_db_prepare_input($_POST['state']);
        if (isset($_POST['zone_id'])) {
          $zone_id = zen_db_prepare_input($_POST['zone_id']);
        } else {
          $zone_id = false;
        }
      }
      $country = zen_db_prepare_input($_POST['zone_country_id']);
      $telephone = zen_db_prepare_input($_POST['telephone']);
      $fax = zen_db_prepare_input($_POST['fax']);
      $customers_authorization = CUSTOMERS_APPROVAL_AUTHORIZATION;
      $customers_referral = zen_db_prepare_input($_POST['customers_referral']);
    
      if (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '2') {
        $newsletter = 0;
        if (isset($_POST['newsletter'])) {
          $newsletter = zen_db_prepare_input($_POST['newsletter']);
        }
      }
    
      $password = zen_db_prepare_input($_POST['password']);
      $confirmation = zen_db_prepare_input($_POST['confirmation']);
    
    
      if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
        if (!isset($_POST['privacy_conditions']) || ($_POST['privacy_conditions'] != '1')) {
          $error = true;
          $messageStack->add('create_account', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error');
        }
      }
    
      if (ACCOUNT_GENDER == 'true') {
        if ( ($gender != 'm') && ($gender != 'f') ) {
          $error = true;
          $messageStack->add('create_account', ENTRY_GENDER_ERROR);
        }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
      }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', 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('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
          }
        }
      }
    
      if (ACCOUNT_COMPANY == 'true') {
        if ((int)ENTRY_COMPANY_MIN_LENGTH > 0 && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
          $error = true;
          $messageStack->add('create_account', ENTRY_COMPANY_ERROR);
        }
      }
    
    
      if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
      } elseif (zen_validate_email($email_address) == false) {
        $error = true;
        $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
      } else {
        $check_email_query = "select count(*) as total
                                from " . TABLE_CUSTOMERS . "
                                where customers_email_address = '" . zen_db_input($email_address) . "'";
        $check_email = $db->Execute($check_email_query);
    
        if ($check_email->fields['total'] > 0) {
          $error = true;
          $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
        }
      }
    
      if ($phpBB && $phpBB->phpBB['installed'] == true) {
        if (strlen($nick) < ENTRY_NICK_MIN_LENGTH)  {
          $error = true;
          $messageStack->add('create_account', ENTRY_NICK_LENGTH_ERROR);
        } else {
          // check Zen Cart for duplicate nickname
          $sql = "select * from " . TABLE_CUSTOMERS  . "
                               where customers_nick = :nick:";
          $check_nick_query = $db->bindVars($sql, ':nick:', $nick, 'string');
          $check_nick = $db->Execute($check_nick_query);
          if ($check_nick->RecordCount() > 0 ) {
            $error = true;
            $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR);
          }
          // check phpBB for duplicate nickname
          if ($phpBB->phpbb_check_for_duplicate_nick($nick) == 'already_exists' ) {
            $error = true;
            $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR . ' (phpBB)');
          }
        }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
      }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_CITY_ERROR);
      }
      }
    
      if (ACCOUNT_STATE == 'true') {
        $check_query = "SELECT count(*) AS total
                        FROM " . TABLE_ZONES . "
                        WHERE zone_country_id = :zoneCountryID";
        $check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
        $check = $db->Execute($check_query);
        $entry_state_has_zones = ($check->fields['total'] > 0);
        if ($entry_state_has_zones == true) {
          $zone_query = "SELECT distinct zone_id, zone_name, zone_code
                         FROM " . TABLE_ZONES . "
                         WHERE zone_country_id = :zoneCountryID
                         AND " .
                         ((trim($state) != '' && $zone_id == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
                        "zone_id = :zoneID
                         ORDER BY zone_code ASC, zone_name";
    
          $zone_query = $db->bindVars($zone_query, ':zoneCountryID', $country, 'integer');
          $zone_query = $db->bindVars($zone_query, ':zoneState', strtoupper($state), 'noquotestring');
          $zone_query = $db->bindVars($zone_query, ':zoneID', $zone_id, 'integer');
          $zone = $db->Execute($zone_query);
    
          //look for an exact match on zone ISO code
          $found_exact_iso_match = ($zone->RecordCount() == 1);
          if ($zone->RecordCount() > 1) {
            while (!$zone->EOF && !$found_exact_iso_match) {
              if (strtoupper($zone->fields['zone_code']) == strtoupper($state) ) {
                $found_exact_iso_match = true;
                continue;
              }
              $zone->MoveNext();
            }
          }
    
          if ($found_exact_iso_match) {
            $zone_id = $zone->fields['zone_id'];
            $zone_name = $zone->fields['zone_name'];
          } else {
            $error = true;
            $error_state_input = true;
            $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
          }
        } else {
          if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
            $error = true;
            $error_state_input = true;
            $messageStack->add('create_account', ENTRY_STATE_ERROR);
          }
        }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
      }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if ( (is_numeric($country) == false) || ($country < 1) ) {
        $error = true;
        $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
      }
      }
    
      if (ACCOUNT_GENDER == 'true') {
      if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
      }
      }
    
    
      if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_PASSWORD_ERROR);
      } elseif ($password != $confirmation) {
        $error = true;
        $messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
      }
    
      if ($error == true) {
        // hook notifier class
        $zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
      } elseif ($antiSpam != '') {
        $zco_notifier->notify('NOTIFY_SPAM_DETECTED_DURING_CREATE_ACCOUNT');
        $messageStack->add_session('header', (defined('ERROR_CREATE_ACCOUNT_SPAM_DETECTED') ? ERROR_CREATE_ACCOUNT_SPAM_DETECTED : 'Thank you, your account request has been submitted for review.'), 'success');
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
      } else {
        $sql_data_array = array('customers_firstname' => $firstname,
                                'customers_lastname' => $lastname,
                                'customers_email_address' => $email_address,
                                'customers_nick' => $nick,
                                'customers_telephone' => $telephone,
                                'customers_fax' => $fax,
                                'customers_newsletter' => (int)$newsletter,
                                'customers_email_format' => $email_format,
                                'customers_default_address_id' => 0,
                                'customers_password' => zen_encrypt_password($password),
                                'customers_authorization' => (int)CUSTOMERS_APPROVAL_AUTHORIZATION
        );
    
        if ((CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '')) $sql_data_array['customers_referral'] = $customers_referral;
        if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
        if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = (empty($_POST['dob']) || $dob_entered == '0001-01-01 00:00:00' ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_date_raw($_POST['dob']));
    
        zen_db_perform(TABLE_CUSTOMERS, $sql_data_array);
    
        $_SESSION['customer_id'] = $db->Insert_ID();
    
        $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD', array_merge(array('customer_id' => $_SESSION['customer_id']), $sql_data_array));
    
        $sql_data_array = array('customers_id' => $_SESSION['customer_id'],
                                'entry_firstname' => $firstname,
                                'entry_lastname' => $lastname,
                                'entry_street_address' => $street_address,
                                'entry_postcode' => $postcode,
                                'entry_city' => $city,
                                'entry_country_id' => $country);
    
        if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
        if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
        if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
        if (ACCOUNT_STATE == 'true') {
          if ($zone_id > 0) {
            $sql_data_array['entry_zone_id'] = $zone_id;
            $sql_data_array['entry_state'] = '';
          } else {
            $sql_data_array['entry_zone_id'] = '0';
            $sql_data_array['entry_state'] = $state;
          }
        }
    
        zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
    
        $address_id = $db->Insert_ID();
    
        $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD', array_merge(array('address_id' => $address_id), $sql_data_array));
    
        $sql = "update " . TABLE_CUSTOMERS . "
                  set customers_default_address_id = '" . (int)$address_id . "'
                  where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
    
        $db->Execute($sql);
    
        $sql = "insert into " . TABLE_CUSTOMERS_INFO . "
                              (customers_info_id, customers_info_number_of_logons,
                               customers_info_date_account_created, customers_info_date_of_last_logon)
                  values ('" . (int)$_SESSION['customer_id'] . "', '1', now(), now())";
    
        $db->Execute($sql);
    
        // phpBB create account
        if ($phpBB->phpBB['installed'] == true) {
          $phpBB->phpbb_create_account($nick, $password, $email_address);
        }
        // End phppBB create account
    
        if (SESSION_RECREATE == 'True') {
          zen_session_recreate();
        }
    
        $_SESSION['customer_first_name'] = $firstname;
        $_SESSION['customer_default_address_id'] = $address_id;
        $_SESSION['customer_country_id'] = $country;
        $_SESSION['customer_zone_id'] = $zone_id;
        $_SESSION['customers_authorization'] = $customers_authorization;
    
        // restore cart contents
        $_SESSION['cart']->restore_contents();
    
        // hook notifier class
        $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT');
    
        // build the message content
        $name = $firstname . ' ' . $lastname;
    
        if (ACCOUNT_GENDER == 'true') {
          if ($gender == 'm') {
            $email_text = sprintf(EMAIL_GREET_MR, $lastname);
          } else {
            $email_text = sprintf(EMAIL_GREET_MS, $lastname);
          }
        } else {
          $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
        }
        $html_msg['EMAIL_GREETING'] = str_replace('\n','',$email_text);
        $html_msg['EMAIL_FIRST_NAME'] = $firstname;
        $html_msg['EMAIL_LAST_NAME']  = $lastname;
    
        // initial welcome
        $email_text .=  EMAIL_WELCOME;
        $html_msg['EMAIL_WELCOME'] = str_replace('\n','',EMAIL_WELCOME);
    
        if (NEW_SIGNUP_DISCOUNT_COUPON != '' and NEW_SIGNUP_DISCOUNT_COUPON != '0') {
          $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON;
          $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
          $coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
          $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id ."', '0', 'Admin', '" . $email_address . "', now() )");
    
          $text_coupon_help = sprintf(TEXT_COUPON_HELP_DATE, zen_date_short($coupon->fields['coupon_start_date']),zen_date_short($coupon->fields['coupon_expire_date']));
    
          // if on, add in Discount Coupon explanation
          //        $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .
          $email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER .
          (!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') . $text_coupon_help  . "\n\n" .
          strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR;
    
          $html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER ;
          $html_msg['COUPON_DESCRIPTION']     = (!empty($coupon_desc->fields['coupon_description']) ? '<strong>' . $coupon_desc->fields['coupon_description'] . '</strong>' : '');
          $html_msg['COUPON_TEXT_TO_REDEEM']  = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
          $html_msg['COUPON_CODE']  = $coupon->fields['coupon_code'] . $text_coupon_help;
        } //endif coupon
    
        if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
          $coupon_code = zen_create_coupon_code();
          $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
          $insert_id = $db->Insert_ID();
          $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $email_address . "', now() )");
    
          // if on, add in GV explanation
          $email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) .
          sprintf(EMAIL_GV_REDEEM, $coupon_code) .
          EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" .
          EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
          $html_msg['GV_WORTH'] = str_replace('\n','',sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) );
          $html_msg['GV_REDEEM'] = str_replace('\n','',str_replace('\n\n','<br />',sprintf(EMAIL_GV_REDEEM, '<strong>' . $coupon_code . '</strong>')));
          $html_msg['GV_CODE_NUM'] = $coupon_code;
          $html_msg['GV_CODE_URL'] = str_replace('\n','',EMAIL_GV_LINK . '<a href="' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . '">' . TEXT_GV_NAME . ': ' . $coupon_code . '</a>');
          $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
        } // endif voucher
    
        // add in regular email welcome text
        $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
    
        $html_msg['EMAIL_MESSAGE_HTML']  = str_replace('\n','',EMAIL_TEXT);
        $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\n','',EMAIL_CONTACT);
        $html_msg['EMAIL_CLOSURE']       = nl2br(EMAIL_GV_CLOSURE);
    
        // include create-account-specific disclaimer
        $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS). "\n\n";
        $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
    
        // send welcome email
        if (trim(EMAIL_SUBJECT) != 'n/a') zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');
    
        // send additional emails
        if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {
          if ($_SESSION['customer_id']) {
            $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax
                                from " . TABLE_CUSTOMERS . "
                                where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
    
            $account = $db->Execute($account_query);
          }
    
          $extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
          $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
          if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,
          $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
        } //endif send extra emails
    
        zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
    
      } //endif !error
    }
    
    
    /*
     * Set flags for template use:
     */
      $selected_country = (isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '') ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
      $flag_show_pulldown_states = ((($process == true || $entry_state_has_zones == true) && $zone_name == '') || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input) ? true : false;
      $state = ($flag_show_pulldown_states) ? ($state == '' ? '&nbsp;' : $state) : $zone_name;
      $state_field_label = ($flag_show_pulldown_states) ? '' : ENTRY_STATE;
    
    // This should be last line of the script:
    $zco_notifier->notify('NOTIFY_MODULE_END_CREATE_ACCOUNT');
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #22
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Simple and Easy 2 Question Create Account Page

    includes/templates/YOUR_TEMPLATE/tpl_modules_create_account.php:
    Code:
    <?php
    /**
     * Page Template
     *
     * Loaded automatically by index.php?main_page=create_account.<br />
     * Displays Create Account form.
     *
     * @package templateSystem
     * @copyright Copyright 2003-2014 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  Sun Aug 19 09:47:29 2012 -0400 Modified in v1.5.1 $
     */
    ?>
    
    <?php if ($messageStack->size('create_account') > 0) echo $messageStack->output('create_account'); ?>
    <div class="alert forward"><?php echo FORM_REQUIRED_INFORMATION; ?></div>
    <br class="clearBoth" />
    
    <?php
      if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
    ?>
    <fieldset>
    <legend><?php echo TABLE_HEADING_PRIVACY_CONDITIONS; ?></legend>
    <div class="information"><?php echo TEXT_PRIVACY_CONDITIONS_DESCRIPTION;?></div>
    <?php echo zen_draw_checkbox_field('privacy_conditions', '1', false, 'id="privacy"');?>
    <label class="checkboxLabel" for="privacy"><?php echo TEXT_PRIVACY_CONDITIONS_CONFIRM;?></label>
    </fieldset>
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_COMPANY == 'true') {
    ?>
    <fieldset>
    <legend><?php echo CATEGORY_COMPANY; ?></legend>
    <label class="inputLabel" for="company"><?php echo ENTRY_COMPANY; ?></label>
    <?php  echo zen_draw_input_field('company', '',  zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', '40') . '  id="company"') . (zen_not_null(ENTRY_COMPANY_TEXT) ? '<span  class="alert">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?>
    </fieldset>
    <?php
      }
    ?>
    
    <fieldset>
    <legend><?php echo TABLE_HEADING_ADDRESS_DETAILS; ?></legend>
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <?php  echo zen_draw_radio_field('gender', 'm', '', 'id="gender-male"') .  '<label class="radioButtonLabel" for="gender-male">' . MALE .  '</label>' . zen_draw_radio_field('gender', 'f', '',  'id="gender-female"') . '<label class="radioButtonLabel"  for="gender-female">' . FEMALE . '</label>' .  (zen_not_null(ENTRY_GENDER_TEXT) ? '<span class="alert">' .  ENTRY_GENDER_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <label class="inputLabel" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label>
    <?php  echo zen_draw_input_field('firstname', '',  zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . '  id="firstname"') . (zen_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span  class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <label class="inputLabel" for="lastname"><?php echo ENTRY_LAST_NAME; ?></label>
    <?php  echo zen_draw_input_field('lastname', '',  zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', '40') . '  id="lastname"') . (zen_not_null(ENTRY_LAST_NAME_TEXT) ? '<span  class="alert">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <label class="inputLabel" for="street-address"><?php echo ENTRY_STREET_ADDRESS; ?></label>
       <?php echo zen_draw_input_field('street_address', '',  zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', '40') .  ' id="street-address"') . (zen_not_null(ENTRY_STREET_ADDRESS_TEXT) ?  '<span class="alert">' . ENTRY_STREET_ADDRESS_TEXT .  '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php  echo zen_draw_input_field('should_be_empty', '', ' size="40" id="CAAS"  style="visibility:hidden; display:none;" autocomplete="off"'); ?>
    
    <?php
      if (ACCOUNT_SUBURB == 'true') {
    ?>
    <label class="inputLabel" for="suburb"><?php echo ENTRY_SUBURB; ?></label>
    <?php  echo zen_draw_input_field('suburb', '',  zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', '40') . '  id="suburb"') . (zen_not_null(ENTRY_SUBURB_TEXT) ? '<span  class="alert">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <label class="inputLabel" for="city"><?php echo ENTRY_CITY; ?></label>
    <?php  echo zen_draw_input_field('city', '',  zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', '40') . '  id="city"') . (zen_not_null(ENTRY_CITY_TEXT) ? '<span  class="alert">' . ENTRY_CITY_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_STATE == 'true') {
        if ($flag_show_pulldown_states == true) {
    ?>
    <label class="inputLabel" for="stateZone" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>
    <?php
           echo zen_draw_pull_down_menu('zone_id',  zen_prepare_country_zones_pull_down($selected_country), $zone_id,  'id="stateZone"');
          if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert">' . ENTRY_STATE_TEXT . '</span>';
        }
    ?>
    
    <?php if ($flag_show_pulldown_states == true) { ?>
    <br class="clearBoth" id="stBreak" />
    <?php } ?>
    <label class="inputLabel" for="state" id="stateLabel"><?php echo $state_field_label; ?></label>
    <?php
        echo zen_draw_input_field('state', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"');
         if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span  class="alert" id="stText">' . ENTRY_STATE_TEXT . '</span>';
        if ($flag_show_pulldown_states == false) {
          echo zen_draw_hidden_field('zone_id', $zone_name, ' ');
        }
    ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <label class="inputLabel" for="postcode"><?php echo ENTRY_POST_CODE; ?></label>
    <?php  echo zen_draw_input_field('postcode', '',  zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40') . '  id="postcode"') . (zen_not_null(ENTRY_POST_CODE_TEXT) ? '<span  class="alert">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
    <?php  echo zen_get_country_list('zone_country_id', $selected_country,  'id="country" ' . ($flag_show_pulldown_states == true ?  'onchange="update_zone(this.form);"' : '')) .  (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' .  ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    </fieldset>
    
    <fieldset>
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <legend><?php echo TABLE_HEADING_PHONE_FAX_DETAILS; ?></legend>
    <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>': ''); ?>
    <?php
      }
    ?>
    
    <?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', '', 'id="fax"') .  (zen_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="alert">' .  ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?>
    <?php
      }
    ?>
    </fieldset>
    
    <?php
      if (ACCOUNT_DOB == 'true') {
    ?>
    <fieldset>
    <legend><?php echo TABLE_HEADING_DATE_OF_BIRTH; ?></legend>
    <label class="inputLabel" for="dob"><?php echo ENTRY_DATE_OF_BIRTH; ?></label>
    <?php  echo zen_draw_input_field('dob','', 'id="dob"') .  (zen_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="alert">' .  ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    </fieldset>
    <?php
      }
    ?>
    
    <fieldset>
    <legend><?php echo TABLE_HEADING_LOGIN_DETAILS; ?></legend>
    <label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL_ADDRESS; ?></label>
    <?php  echo zen_draw_input_field('email_address', '',  zen_set_field_length(TABLE_CUSTOMERS, 'customers_email_address', '40') .  ' id="email-address"') . (zen_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ?  '<span class="alert">' . ENTRY_EMAIL_ADDRESS_TEXT .  '</span>': ''); ?>
    <br class="clearBoth" />
    
    <?php
      if ($phpBB->phpBB['installed'] == true) {
    ?>
    <label class="inputLabel" for="nickname"><?php echo ENTRY_NICK; ?></label>
    <?php  echo zen_draw_input_field('nick','','id="nickname"') .  (zen_not_null(ENTRY_NICK_TEXT) ? '<span class="alert">' .  ENTRY_NICK_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <label class="inputLabel" for="password-new"><?php echo ENTRY_PASSWORD; ?></label>
    <?php  echo zen_draw_password_field('password', '',  zen_set_field_length(TABLE_CUSTOMERS, 'customers_password', '20') . '  id="password-new" autocomplete="off"') .  (zen_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="alert">' .  ENTRY_PASSWORD_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="password-confirm"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></label>
    <?php  echo zen_draw_password_field('confirmation', '',  zen_set_field_length(TABLE_CUSTOMERS, 'customers_password', '20') . '  id="password-confirm" autocomplete="off"') .  (zen_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span  class="alert">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>':  ''); ?>
    <br class="clearBoth" />
    </fieldset>
    
    <fieldset>
    <legend><?php echo ENTRY_EMAIL_PREFERENCE; ?></legend>
    <?php
      if (ACCOUNT_NEWSLETTER_STATUS != 0) {
    ?>
    <?php  echo zen_draw_checkbox_field('newsletter', '1', $newsletter,  'id="newsletter-checkbox"') . '<label class="checkboxLabel"  for="newsletter-checkbox">' . ENTRY_NEWSLETTER . '</label>' .  (zen_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="alert">' .  ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php } ?>
    
    <?php  echo zen_draw_radio_field('email_format', 'HTML', ($email_format ==  'HTML' ? true : false),'id="email-format-html"') . '<label  class="radioButtonLabel" for="email-format-html">' .  ENTRY_EMAIL_HTML_DISPLAY . '</label>' .   zen_draw_radio_field('email_format', 'TEXT', ($email_format == 'TEXT' ?  true : false), 'id="email-format-text"') . '<label  class="radioButtonLabel" for="email-format-text">' .  ENTRY_EMAIL_TEXT_DISPLAY . '</label>'; ?>
    <br class="clearBoth" />
    </fieldset>
    
    <?php
      if (CUSTOMERS_REFERRAL_STATUS == 2) {
    ?>
    <fieldset>
    
    <legend><?php echo TABLE_HEADING_REFERRAL_DETAILS; ?></legend>
    <label class="inputLabel" for="customers_referral"><?php echo ENTRY_CUSTOMERS_REFERRAL; ?></label>
    <?php  echo zen_draw_input_field('customers_referral', '',  zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', '15') . '  id="customers_referral"'); ?>
    <br class="clearBoth" />
    </fieldset>
    <?php } ?>
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #23
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Simple and Easy 2 Question Create Account Page

    includes/init_includes/overrides/init_header.php:
    Code:
    <?php
    /**
     * header code, mainly concerned with adding to messagestack when certain warnings are applicable
     *
     * @package templateStructure
     * @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  Tue Jul 23 19:29:41 2013 -0400 Modified in v1.5.2 $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    /**
     * set which precautions should be checked
     */
    /**
     * should a message be displayed if install directory exists
     */
    define('WARN_INSTALL_EXISTENCE', 'true');
    /**
     * should a message be displayed if  config directory is writeable
     */
    define('WARN_CONFIG_WRITEABLE', 'true');
    /**
     * should a message be displayed if sql cache directory not writeable
     */
    define('WARN_SQL_CACHE_DIRECTORY_NOT_WRITEABLE', 'true');
    /**
     * should a message be displayed if session.autostart is on in php.ini
     */
    define('WARN_SESSION_AUTO_START', 'true');
    /**
     * should a message be displayed if download directory not readable
     */
    define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
    /**
     * should a message be displayed if system detects version problem with the database
     */
    define('WARN_DATABASE_VERSION_PROBLEM','true');
    // check if the installer directory exists, and warn of its existence
    if (WARN_INSTALL_EXISTENCE == 'true') {
      $check_path = realpath(dirname(basename($PHP_SELF)) . '/zc_install');
      if (is_dir($check_path)) {
         $messageStack->add('header',  sprintf(WARNING_INSTALL_DIRECTORY_EXISTS, ($check_path == '' ?  '..../zc_install' : $check_path)), 'warning');
      }
    }
    
    // check if the configure.php file is writeable
    if (WARN_CONFIG_WRITEABLE == 'true') {
      $check_path = realpath(dirname(basename($PHP_SELF)) . '/includes/configure.php');
      if (file_exists($check_path) && is__writeable($check_path)) {
         $messageStack->add('header', sprintf(WARNING_CONFIG_FILE_WRITEABLE,  ($check_path == '' ? '..../includes/configure.php' : $check_path)),  'warning');
      }
    }
    
    // check if the sql cache folder is writeable
    if (WARN_SQL_CACHE_DIRECTORY_NOT_WRITEABLE == 'true' && strtolower(SQL_CACHE_METHOD) == 'file') {
      if (!is_dir(DIR_FS_SQL_CACHE)) {
        $messageStack->add('header', WARNING_SQL_CACHE_DIRECTORY_NON_EXISTENT, 'warning');
      } elseif (!is_writeable(DIR_FS_SQL_CACHE)) {
        $messageStack->add('header', WARNING_SQL_CACHE_DIRECTORY_NOT_WRITEABLE, 'warning');
      }
    }
    
    // give the visitors a message that the website will be down at ... time
    if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'false') ) {
      $messageStack->add('header', TEXT_BEFORE_DOWN_FOR_MAINTENANCE . PERIOD_BEFORE_DOWN_FOR_MAINTENANCE);
    }
    
    // this will let the admin know that the website is DOWN FOR MAINTENANCE to the public
    if ( (DOWN_FOR_MAINTENANCE == 'true') && (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) ) {
      $messageStack->add('header', TEXT_ADMIN_DOWN_FOR_MAINTENANCE, 'warning');
    }
    
    // check session.auto_start is disabled
    if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
      if (ini_get('session.auto_start') == '1') {
        $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
      }
    }
    
    // to warn if the "downloads" folder is not readable (ie: not found, etc)
    if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
      if (!is_dir(DIR_FS_DOWNLOAD)) {
        $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
      }
    }
    
    // check database version against source code
    $zv_db_patch_ok = true; // we start with true
    if (WARN_DATABASE_VERSION_PROBLEM != 'false') {
       $result = $db->Execute("SELECT project_version_major,  project_version_minor FROM " . TABLE_PROJECT_VERSION . " WHERE  project_version_key = 'Zen-Cart Database'");
      $zv_db_patch_level_found = $result->fields['project_version_major']. '.' . $result->fields['project_version_minor'];
      $zv_db_patch_level_expected = EXPECTED_DATABASE_VERSION_MAJOR . '.' . EXPECTED_DATABASE_VERSION_MINOR;
      if ($zv_db_patch_level_expected=='.' || ($zv_db_patch_level_found < $zv_db_patch_level_expected) ) {
        $zv_db_patch_ok = false;
        $messageStack->add('header', WARNING_DATABASE_VERSION_OUT_OF_DATE, 'warning');
      }
    }
    
    // Alerting about payment modules in testing/debug mode
    
    if  (defined('MODULE_PAYMENT_PAYPAL_IPN_DEBUG') &&  (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'true' ||  MODULE_PAYMENT_PAYPAL_TESTING == 'Test')) {
      $messageStack->add('header', 'PAYPAL IS IN TESTING MODE', 'warning');
    }
    if  ((defined('MODULE_PAYMENT_AUTHORIZENET_AIM_STATUS') &&  MODULE_PAYMENT_AUTHORIZENET_AIM_STATUS == 'True' &&  defined('MODULE_PAYMENT_AUTHORIZENET_AIM_TESTMODE') &&  MODULE_PAYMENT_AUTHORIZENET_AIM_TESTMODE == 'Test') ||  (defined('MODULE_PAYMENT_AUTHORIZENET_STATUS') &&  MODULE_PAYMENT_AUTHORIZENET_STATUS == 'True' &&  defined('MODULE_PAYMENT_AUTHORIZENET_TESTMODE') &&  MODULE_PAYMENT_AUTHORIZENET_TESTMODE =='Test' ) ) {
      $messageStack->add('header', 'AUTHORIZENET IS IN TESTING MODE', 'warning');
    }
    if (defined('MODULE_SHIPPING_USPS_SERVER') &&   MODULE_SHIPPING_USPS_SERVER == 'test' ) {
      $messageStack->add('header', 'USPS IS IN TESTING MODE', 'warning');
    }
    
    // Alerts for EZ-Pages
    if (EZPAGES_STATUS_HEADER == '2' && (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR']))) {
      $messageStack->add('header', TEXT_EZPAGES_STATUS_HEADER_ADMIN, 'caution');
    }
    if (EZPAGES_STATUS_FOOTER == '2' && (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR']))) {
      $messageStack->add('header', TEXT_EZPAGES_STATUS_FOOTER_ADMIN, 'caution');
    }
    if (EZPAGES_STATUS_SIDEBOX == '2' && (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR']))) {
      $messageStack->add('header', TEXT_EZPAGES_STATUS_SIDEBOX_ADMIN, 'caution');
    }
    if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) {
      $messageStack->add('header', 'STRICT ERROR REPORTING IS ON', 'warning');
    }
    
    
    // if down for maintenance, prevent indexing
    if ( (DOWN_FOR_MAINTENANCE == 'true') && (!strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) ) {
      header("HTTP/1.1 503 Service Unavailable");
    }
    
    /* Check for invalid countries in customer's address book.
     * If a customer is logged in, check to see that the customers' address(es) still contain valid countries.
    * If not, redirect to the address-book page for changes.
    */
    if  ($_SESSION['customer_id'] && $_GET['main_page'] !=  FILENAME_ADDRESS_BOOK_PROCESS && $_GET['main_page'] !=  FILENAME_LOGOFF && ($_GET['main_page'] ==  FILENAME_CHECKOUT_SHIPPING || $_GET['main_page'] ==  FILENAME_CHECKOUT_PROCESS || $_GET['main_page'] ==  FILENAME_CHECKOUT_CONFIRMATION)) {
      $addresses_query = "SELECT  address_book_id, entry_country_id as country_id, entry_firstname as  firstname, entry_lastname as lastname
                          FROM   " . TABLE_ADDRESS_BOOK . "
                          WHERE  customers_id = :customersID
                          ORDER BY firstname, lastname";
    
      $addresses_query = $db->bindVars($addresses_query, ':customersID', $_SESSION['customer_id'], 'integer');
      $addresses = $db->Execute($addresses_query);
    
      while (!$addresses->EOF) {
        if (zen_get_country_name($addresses->fields['country_id'], TRUE) == '') {
           $messageStack->add_session('addressbook',  sprintf(ERROR_TEXT_COUNTRY_DISABLED_PLEASE_CHANGE,  zen_get_country_name($addresses->fields['country_id'], FALSE)),  'error');
          $_SESSION['navigation']->set_snapshot (array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING));
          zen_redirect (zen_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses->fields['address_book_id'], 'SSL'));
        }
        $addresses->MoveNext();
      }
    }
    I think those were all the files that I had to change, then in the configuration->customers section I basically turned off everything...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #24
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Simple and Easy 2 Question Create Account Page

    Should apologize for not including comments on the changed code... The above was taken from a clean install of ZC 1.5.4 and modified specifically to support this login by username and password only in order to maximze the logins and thus gather email addresses. As thus far understood this is to be performed as an immediate action to gain access to the site rather than just an action at the point of checkout where at one point or another billing/shippng information is gathered to support the transaction.

    Fyi, something I realized as a result of modifying some of the core file (now in a directory titled overrides) is that it is in ZC's core operation that a logged in user have an address in their address book... Whether that address is real or not is not the issue, just that one exists... Made me question why should one have that so far up at the beginning (for a site that requires login to access the content) and the drawback(s) of removing it earlier on. One thing I saw/see is that assuming an account wasn't created for the sole purpose of being malicious and avoidng all means of detection, the next "level" of abuser s simply likely to provide information at some point in the process that may point back to them. Now without even asking anything related, anyone can create an account and then do whatever might be possible by someone having an account but there will be no additional "tracking" info other than whatever potentially spoofed ip info. So, I'm not saying the above is a bad thing, only pointing out potential issues.

    On that, I think I forgot to force an address for checkout_payment and also I'm thinking one of the header_php.php files will need to include an inspection of the bookmarks, and if one of the appplicable pages were the source to set the backlink to that location after an address has been provided...

    Hope the above helps somewhat. I plan on possibly reposting the code with comments/improved indication of the applied changes. I also haven't evaluated the impact of the above on other template files that call these files. It really was a "rush" job and sub-par, but at least I left the honey-pot alone so didn't lose that protection.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #25
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Simple and Easy 2 Question Create Account Page

    Quote Originally Posted by pricediscrimination View Post
    Simple registration is something that was brought up in another post 7 years ago. This comment hits the nail on the head:



    I love ZC and am very thankful for being able to do amazing things with it. But sometimes the thinking behind it seems stuck in the Internet of 7 years ago - which makes me sad/worried about the future of the software. In 2015, hardly any site asks 12+ questions for registration. It is important for marketing and growing a customer base to have fast email/pw only registration.

    If we can find a solution in this thread, I believe it will help others who are hoping to actually grow their business. As it stands, the stock registration page is doing more harm than good.
    I think what needs to be made CLEAR for others stumbling upon this thread is that what is being asked for here is more of membership type of setup.. Granted it's a FREE membership, but the point is that unlike a TRADITIONAL e-commerce setup a customer account is REQUIRED to view the store or do any shopping.. The OP is looking for minimal account details for creating the customer account in that certain details are REQUIRED to create an account.

    Should the customer decide to make a purchase the information required for walking through the purchase workflow is required at the time of the checkout..

    Before making this about Zen Cart's age, I wanted to add that Zen Cart's basic checkout flow follows a "standard" flow that most other ecommerce systems follow.. I don't think this alternate workflow being discussed here is an "out-the-box" workflow setup for ANY e-commerce bundle out there.. (happy to be proven wrong if anyone has different information on this)

    lat9 has point out the what is required to achieve the OPs objective and mc12345678 seems to have provided the how to achieve the OPs objectiv.. I just wanted to pop in to add this little note to make sure the WHY was adequately covered as well..
    Last edited by DivaVocals; 1 Nov 2015 at 08:21 PM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  6. #26
    Join Date
    May 2008
    Posts
    402
    Plugin Contributions
    0

    Default Re: Simple and Easy 2 Question Create Account Page

    Quote Originally Posted by DivaVocals View Post
    I think what needs to be made CLEAR for others stumbling upon this thread is that what is being asked for here is more of membership type of setup.. Granted it's a FREE membership, but the point is that unlike a TRADITIONAL e-commerce setup a customer account is REQUIRED to do any shopping..
    This is how almost any modern eCommerce site works now. You'll be hard-pressed to find a shopping site that asks for all details when creating an account. Account creation flow is basically contact info/email list. Purchasing is billing/shipping info.

    With all due respect, not sure how much online shopping Zen cart users do, because comments like this make it sound like no one has been a customer of an eCommerce store in the past 5 years.

    As brought up in another thread. This is Zen Cart's problem. It's stuck in eCommerce of 10 years ago. Things ARE different NOW.


    https://www.brooklynboot.com/register

    https://www.thetiebar.com/profile-create

    https://login.rosegal.com/m-users-a-sign.htm

    https://www.lulus.com/login.html

    https://www.cufflinks.com/customer/account/create/

    https://############.com/ap/register

    https://www.forever21.com/EU/Login/L...f21&lang=en-US


    Do I have to keep going?

    So let's make it CLEAR for others stumbling upon this threat that what's being asked for here is more of a MODERN day eCommerce site. And that if you are new to ZC, just know that NO ONE is going to sign up for your site if you're asking for their entire life story in your registration form. Name/email/password, that's all they will want to (and are accustomed to) give you.


  7. #27
    Join Date
    May 2008
    Posts
    402
    Plugin Contributions
    0

    Default Re: Simple and Easy 2 Question Create Account Page

    Quote Originally Posted by mc12345678 View Post
    Hope the above helps somewhat. I plan on possibly reposting the code with comments/improved indication of the applied changes. I also haven't evaluated the impact of the above on other template files that call these files. It really was a "rush" job and sub-par, but at least I left the honey-pot alone so didn't lose that protection.
    mc12345678, cannot thank you enough for your time, and for caring enough to try to help solve it for the community. You have helped several times before too, thank you! Will try it all out and report back.

  8. #28
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Simple and Easy 2 Question Create Account Page

    Quote Originally Posted by pricediscrimination View Post
    This is how almost any modern eCommerce site works now. You'll be hard-pressed to find a shopping site that asks for all details when creating an account. Account creation flow is basically contact info/email list. Purchasing is billing/shipping info.

    With all due respect, not sure how much online shopping Zen cart users do, because comments like this make it sound like no one has been a customer of an eCommerce store in the past 5 years.

    As brought up in another thread. This is Zen Cart's problem. It's stuck in eCommerce of 10 years ago. Things ARE different NOW.


    https://www.brooklynboot.com/register

    https://www.thetiebar.com/profile-create

    https://login.rosegal.com/m-users-a-sign.htm

    https://www.lulus.com/login.html

    https://www.cufflinks.com/customer/account/create/

    https://############.com/ap/register

    https://www.forever21.com/EU/Login/L...f21&lang=en-US


    Do I have to keep going?

    So let's make it CLEAR for others stumbling upon this threat that what's being asked for here is more of a MODERN day eCommerce site. And that if you are new to ZC, just know that NO ONE is going to sign up for your site if you're asking for their entire life story in your registration form. Name/email/password, that's all they will want to (and are accustomed to) give you.


    With all due respect, I think the members of this community KNOW how "modern" shopping is "done" these days.. However, based on your original posts, the workflow you described would require a customer to create an account before they can even SHOP.. That is a DIFFERENT workflow than even some of the sites you pointed out.. Using the sites you listed as an example, Forever 21, Brooklyn Boot, or Rose Gal don't require me to create an account to shop.. I can shop and I don't have to create an account or login as an existing customer until I checkout.. Even when I do checkout, I can create the account using minimal information, but to complete my purchase, I would still need to provide the rest of my personal details (billing and shipping address, etc). Those details become a part of my account profile for the next time I login..

    Again, this isn't an out the box feature of Zen Cart, but it's not an out the box feature of other e-commerce packages either (ala PrestaCart, X-Cart, osCommerce, Magento, VirtueMart) This was truly the point I was trying to make here, which has NOTHING to do with Zen Cart's age at all.. Does this code need to be a part of the out the box functionality of Zen Cart?? I think that a "one size fits all" fix is not the "right" direction.. Certainly there should be more OPTIONS, but just that OPTIONS.. Ultimately that's up to the team working on the upcoming release roadmap, but certainly if others need/want this same kind of workflow, at least there is now code which gives folks this functionality..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  9. #29
    Join Date
    May 2008
    Posts
    402
    Plugin Contributions
    0

    Default Re: Simple and Easy 2 Question Create Account Page

    Quote Originally Posted by mc12345678 View Post
    includes/init_includes/overrides/init_header.php:
    I think those were all the files that I had to change, then in the configuration->customers section I basically turned off everything...
    Hi again, I changed the 3 files that you modified and it did not do anything except put back some default stuff that I already removed. I wonder if perhaps the code you left here was mistakenly from a stock file and not the modified version you worked on.

  10. #30
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Simple and Easy 2 Question Create Account Page

    Quote Originally Posted by pricediscrimination View Post
    Hi again, I changed the 3 files that you modified and it did not do anything except put back some default stuff that I already removed. I wonder if perhaps the code you left here was mistakenly from a stock file and not the modified version you worked on.
    Depends on how you "removed" the other stuff... My guess is that you did so by specifically deleting code, rather than turning off switches in the admin.

    Yes, it was a stock file and first, all of the items described as being "too much" were disabled through the admin panel, and then the remaining (with exception of some of the text that I missed) were bounded by a single admin controlling switch for "ease" and expediency. As said was a rush job mostly to prove the possibility. More thought/action would be necessary to do it right... That would include one or more additional admin switches to encompass either the individual or a group of options to be disabled and to further remove the "checks" on the absent data, etc... At the level and time of writing, the "concern" was the ability to accommodate the request... The base action was provided with "caution" provided in the implementation.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Need to EDIT create account page and Step 2 checkout page
    By ngstime in forum General Questions
    Replies: 1
    Last Post: 13 Apr 2010, 02:16 AM
  2. Log In and Create Account Page?
    By kab_death in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Mar 2010, 02:26 AM
  3. Simple and easy check out page
    By InterSign in forum General Questions
    Replies: 0
    Last Post: 20 May 2008, 05:27 AM
  4. Blank Create Account and Login Page
    By misty16 in forum General Questions
    Replies: 2
    Last Post: 31 Dec 2007, 06:46 AM
  5. Bypass create account success page and go to My Account instead?
    By dealbyethan.com in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 3 Dec 2007, 01:50 PM

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