香川県、高知県が選択できない



Filed under : Commerce系

このエラーは、既に対応対応済みの内容だか、後世?の為に記載しておこう(笑)。

■/catalog/create_account_process.php

<?php
/*
  $Id: create_account_process.php,v 1.6 2004/04/25 02:29:00 ptosh Exp $

  osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require(‘includes/application_top.php’);

// add for PWA
  $noaccount = tep_db_prepare_input($HTTP_POST_VARS['noaccount']);
  if($noaccount) { require(DIR_WS_LANGUAGES . $language . ‘/’ . FILENAME_CHECKOUT_FIRST); }
  require(DIR_WS_LANGUAGES . $language . ‘/’ . FILENAME_CREATE_ACCOUNT_PROCESS);

  if (!isset($HTTP_POST_VARS['action'])) {
    tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT));
  }

  // tamura 2002/12/30 「全角」英数字を「半角」に変換
  $an_cols = array(‘password’,'confirmation’,'email_address’,'postcode’,'telephone’,'fax’);
  if (ACCOUNT_DOB) $an_cols[] = ‘dob’;
  foreach ($an_cols as $col) {
    $HTTP_POST_VARS[$col] = tep_an_zen_to_han($HTTP_POST_VARS[$col]);
  }

  $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
  $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
  $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
  $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
  $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
  $telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
  $fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);
  $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
  $password = tep_db_prepare_input($HTTP_POST_VARS['password']);
  $confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);
  $street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);
  $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
  $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
  $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
  $city = tep_db_prepare_input($HTTP_POST_VARS['city']);
  $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
  $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
  $country = tep_db_prepare_input($HTTP_POST_VARS['country']);

  $error = false; // reset error flag

  if (ACCOUNT_GENDER == ‘true’) {
    if (($gender == ‘m’) || ($gender == ‘f’)) {
      $entry_gender_error = false;
    } else {
      $error = true;
      $entry_gender_error = true;
      $messageStack->add(‘error’, ENTRY_GENDER_ERROR);
    }
  }

  if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
    $error = true;
    $entry_lastname_error = true;
    $messageStack->add(‘error’, ENTRY_LAST_NAME_ERROR);
  } else {
    $entry_lastname_error = false;
  }

  if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
    $error = true;
    $entry_firstname_error = true;
    $messageStack->add(‘error’, ENTRY_FIRST_NAME_ERROR);
  } else {
    $entry_firstname_error = false;
  }

  if (ACCOUNT_DOB == ‘true’) {
    if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4))) {
      $entry_date_of_birth_error = false;
    } else {
      $error = true;
      $entry_date_of_birth_error = true;
      $messageStack->add(‘error’, ENTRY_DATE_OF_BIRTH_ERROR);
    }
  }

  if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
    $error = true;
    $entry_email_address_error = true;
    $messageStack->add(‘error’, ENTRY_EMAIL_ADDRESS_ERROR);
  } else {
    $entry_email_address_error = false;
  }

  if (!tep_validate_email($email_address)) {
    $error = true;
    $entry_email_address_check_error = true;
    $messageStack->add(‘error’, ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
  } else {
    $entry_email_address_check_error = false;
  }

  if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
    $error = true;
    $entry_post_code_error = true;
    $messageStack->add(‘error’, ENTRY_POST_CODE_ERROR);
  } else {
    $entry_post_code_error = false;
  }

  if (ACCOUNT_STATE == ‘true’) {
    if ($entry_country_error == true) {
      $entry_state_error = true;
      $messageStack->add(‘error’, ENTRY_STATE_ERROR);
    } else {
      $zone_id = 0;
      $entry_state_error = false;
      $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = ‘" . tep_db_input($country) . "’");
      $check_value = tep_db_fetch_array($check_query);
      $entry_state_has_zones = ($check_value['total'] > 0);
if ($entry_state_has_zones == true) {
$zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = ‘" . tep_db_input($country) . "’
and BINARY zone_name = ‘" . tep_db_input($state) . "’");
if (tep_db_num_rows($zone_query) == 1) {
$zone_values = tep_db_fetch_array($zone_query);
$zone_id = $zone_values['zone_id'];
} else {
$zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = ‘" . tep_db_input($country) .
"’ and BINARY zone_code = ‘" . tep_db_input($state) . "’");
if (tep_db_num_rows($zone_query) == 1) {
$zone_values = tep_db_fetch_array($zone_query);
$zone_id = $zone_values['zone_id'];
} else {
$error = true;
$entry_state_error = true;
}
}
} else {        if ($state == false) {
          $error = true;
          $entry_state_error = true;
          $messageStack->add(‘error’, ENTRY_STATE_ERROR);
        }
      }
    }
  }

  if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {

    $error = true;
    $entry_city_error = true;
    $messageStack->add(‘error’, ENTRY_CITY_ERROR);
  } else {
    $entry_city_error = false;
  }

  if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
    $error = true;
    $entry_street_address_error = true;
    $messageStack->add(‘error’, ENTRY_STREET_ADDRESS_ERROR);
  } else {
    $entry_street_address_error = false;
  }

  if (!$country) {
    $error = true;
    $entry_country_error = true;
    $messageStack->add(‘error’, ENTRY_COUNTRY_ERROR);
  } else {
    $entry_country_error = false;
  }

  if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
    $error = true;
    $entry_telephone_error = true;
    $messageStack->add(‘error’, ENTRY_TELEPHONE_NUMBER_ERROR);
  } else {
    $entry_telephone_error = false;
  }

// start for PWA

  if($noaccount && !$password && !$confirmation) {

    $entry_password_error = false;

  } else {

    $passlen = strlen($password);
    if ($passlen < ENTRY_PASSWORD_MIN_LENGTH) {
      $error = true;
      $entry_password_error = true;
      $messageStack->add(‘error’, ENTRY_PASSWORD_ERROR);
    } else {
      $entry_password_error = false;
    }

    if ($password != $confirmation) {
      $error = true;
      $entry_password_error = true;
      $messageStack->add(‘error’, ENTRY_PASSWORD_CONFIRMATION_ERROR);
    }

  }

  $check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = ‘" . tep_db_input($email_address) . "’ and purchased_without_account <> 1 and customers_id <> ‘" . tep_db_input($customer_id) . "’");
  if (tep_db_num_rows($check_email)) {
    $error = true;
    $entry_email_address_exists = true;
    if($noaccount){
      $messageStack->add(‘error’, ENTRY_EMAIL_ADDRESS_ERROR_EXISTS_PWA);
    } else {
      $messageStack->add(‘error’, ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
    }
  } else {
    $entry_email_address_exists = false;
  }

// end for PWA

  if ($error == true) {
    $processed = true;

    if($noaccount){
    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_FIRST));
    } else {
    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CREATE_ACCOUNT));
    }
    $breadcrumb->add(NAVBAR_TITLE_2);

    require_once(DIR_SMARTY);
    $subtitle = HEADING_TITLE;
    require(DIR_WS_INCLUDES . ‘header.php’);

?>

<?php require(DIR_WS_INCLUDES . ‘column_left.php’); ?>

<!– body_text //–>
    <td width="100%" valign="top"><?php echo tep_draw_form(‘account_edit’, tep_href_link(FILENAME_CREATE_ACCOUNT_PROCESS, ”, ‘SSL’), ‘post’, ‘onSubmit="return check_form();"’) . tep_draw_hidden_field(‘action’, ‘process’); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_TEMPLATES . DIR_WS_IMAGES . ‘table_background_account.gif’, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator(‘pixel_trans.gif’, ’100%’, ’10′); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td width="100%" height="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
              <tr>
                <td><table border="0" width="100%" height="100%" cellspacing="5" cellpadding="2" class="infoBoxContents">
<?php
  if ($error == true) {
?>
                  <tr>
                    <td class="smallText"><br><?php echo TEXT_ERROR_INFO; ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_separator(‘pixel_trans.gif’, ’100%’, ’10′); ?></td>
                  </tr>
<?php
  }
?>
<?php
  if(!$noaccount) {
    if ($messageStack->size(‘error’) > 0) {
?>
                  <tr>
                    <td><?php echo $messageStack->output(‘error’); ?></td>
 
                 </tr>
                  <tr>
                    <td><?php echo tep_draw_separator(‘pixel_trans.gif’, ’100%’, ’10′); ?></td>
                  </tr>
<?php
    }
?>
                  <tr>
                    <td>
                  <?php require(DIR_WS_MODULES . ‘account_details.php’); ?>
                    </td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
<?php
  }
?>

<?php
  if($noaccount) {
    if ($messageStack->size(‘error’) > 0) {
?>
                  <tr>
                    <td><?php echo $messageStack->output(‘error’); ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_separator(‘pixel_trans.gif’, ’100%’, ’10′); ?></td>
                  </tr>
<?php
    }
?>
                  <tr>
                    <td>
                  <?php require(DIR_WS_MODULES . ‘account_details2.php’); ?>
                    </td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
<?php
  }
?>
          <tr>
            <td><?php echo tep_draw_separator(‘pixel_trans.gif’, ’100%’, ’10′); ?></td>
          </tr>
          <tr>
            <td class="main" align="right"><?php echo tep_image_submit(‘button_continue.gif’, IMAGE_BUTTON_CONTINUE); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator(‘pixel_trans.gif’, ’100%’, ’10′); ?></td>
      </tr>
    </table></form></td>
<!– body_text_eof //–>

<?php include(DIR_WS_INCLUDES . ‘column_right.php’); ?>

<?php require(DIR_WS_INCLUDES . ‘footer.php’); ?>

<?php

// start for PWA

  } else {
    if($noaccount && !$password && !$confirmation) { $pwa = 1; } else { $pwa = 0; }

    // PWA 0.70 : SELECT using new method of determining a customer has purchased without account:
    $check_customer_query = tep_db_query("select customers_id, purchased_without_account,
                                          customers_firstname, customers_lastname, customers_password, customers_email_address,
                                          customers_default_address_id from " . TABLE_CUSTOMERS . "
                                          where upper(customers_email_address) = ‘" . strtoupper($HTTP_POST_VARS['email_address']) . "’ and purchased_without_account = 1");

    $check_customer = tep_db_fetch_array($check_customer_query);

    if (tep_db_num_rows($check_customer_query)) {
    // すでに購入経験アリ → データーを置換え

        $customer_id = $check_customer['customers_id'];

        $sql_data_array = array(‘purchased_without_account’ => $pwa,
                                ‘customers_firstname’ => $firstname,
                                ‘customers_lastname’ => $lastname,
                                ‘customers_email_address’ => $email_address,
                     &
#160;          ‘customers_telephone’ => $telephone,
                                ‘customers_fax’ => $fax,
                                ‘customers_newsletter’ => $newsletter,
                                ‘customers_password’ => tep_encrypt_password($password),
                                ‘customers_default_address_id’ => 1);

        if (ACCOUNT_GENDER == ‘true’) $sql_data_array['customers_gender'] = $gender;
        if (ACCOUNT_DOB == ‘true’) $sql_data_array['customers_dob'] = tep_date_raw($dob);

        tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, ‘update’, "customers_id = ‘".$customer_id."’");

        $date_now = date(‘Ymd’);
        tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = ‘" . $customer_id . "’");

    } else {

    // 購入経験ナシ

        // if customer_exist = NO

        // PWA 0.70 : new way of determining a customer purchased without an account : just say so!

        $sql_data_array = array(‘purchased_without_account’ => $pwa,
                                ‘customers_firstname’ => $firstname,
                                ‘customers_lastname’ => $lastname,
                                ‘customers_email_address’ => $email_address,
                                ‘customers_telephone’ => $telephone,
                                ‘customers_fax’ => $fax,
                                ‘customers_newsletter’ => $newsletter,
                                ‘customers_password’ => tep_encrypt_password($password),
                                ‘customers_default_address_id’ => 1);

        if (ACCOUNT_GENDER == ‘true’) $sql_data_array['customers_gender'] = $gender;
        if (ACCOUNT_DOB == ‘true’) $sql_data_array['customers_dob'] = tep_date_raw($dob);

        tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

        $customer_id = tep_db_insert_id();
        tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = ’1′ where customers_id = ‘" . (int)$customer_id . "’");

        tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values (‘" . (int)$customer_id . "’, ’0′, now())");

    } // ELSE CUSTOMER=NO

    $sql_data_array = array(‘customers_id’ => $customer_id,
                            ‘address_book_id’ => 1,
                            ‘entry_firstname’ => $firstname,
                            ‘entry_lastname’ => $lastname,
                            ‘entry_street_address’ => $street_address,
                            ‘entry_postcode’ => $postcode,
                            ‘entry_city’ => $city,
                            ‘entry_country_id’ => $country,
                            ‘entry_telephone’ => $telephone);

    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;
        }
    }

    $check_address_book_query = tep_db_query("select customers_id from " . TABLE_ADDRESS_BOOK . "
            
;                              where customers_id = ‘" . (int)$customer_id . "’ and address_book_id = 1");

    if (tep_db_num_rows($check_address_book_query)) {
        tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, ‘update’, "customers_id = ‘".$customer_id."’ and address_book_id = 1" );
    } else {
        tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
    }

    $customer_first_name = $firstname;
    $customer_last_name = $lastname; // 2003.03.11 Add Japanese osCommerce
    $customer_default_address_id = 1;
    $customer_country_id = $country;
    $customer_zone_id = $zone_id;
    tep_session_register(‘customer_id’);
    tep_session_register(‘customer_first_name’);
    tep_session_register(‘customer_last_name’); // 2003.03.11 Add Japanese osCommerce
    tep_session_register(‘customer_default_address_id’);
    tep_session_register(‘customer_country_id’);
    tep_session_register(‘customer_zone_id’);

    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = ‘" . $customer_id . "’");
    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = ‘" . $customer_id . "’");

// restore cart contents
    $cart->restore_contents();

    // build the message content
    $name = tep_get_fullname($firstname,$lastname);

    if (ACCOUNT_GENDER == ‘true’) {
       if ($HTTP_POST_VARS['gender'] == ‘m’) {
         $email_text = EMAIL_GREET_MR;
       } else {
         $email_text = EMAIL_GREET_MS;
       }
    } else {
      $email_text = EMAIL_GREET_NONE;
    }

    $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

    if($pwa == 1) {

        tep_session_register(‘noaccount’);

        tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, ”, ‘SSL’));

    } else {

        tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

        tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, ”, ‘SSL’));

    }

  }

  require(DIR_WS_INCLUDES . ‘application_bottom.php’);
?>

 

に変更

 

単純に以下のような対応もあるようだ。

■対応策(引用)
1. osCommerce の管理パネル画面から、「地域/税率設定」を選択し、左側のメニューの「地域設定」をクリックします。
2. 右下の、ページを4ページに設定します。
3. コード37の香川県を選択し、編集をクリックします。
香川県の後ろに、全角のドットを一つ付け加えます。
こんな感じです。 香川県.
更新をクリックします。
入れる数字は全角のドットである必要はありません。どんな文字でも可能です。
空白は、うまくいかない場合があるので、何か文字を入れましょう。

と、まあこんな感じ。

どうやら、mysqlのデータベースを、”utf-8” で作ればいいという話だが、確認はしていない。

RSS feed for comments on this post. TrackBack URI

Leave a reply