Shin' Noguchi
boss****@switc*****
2004年 2月 16日 (月) 11:21:35 JST
長くなりますが追加したモジュールです。 language/japanese/module/payment内の 同名ファイルの変数名も同様に変更してあります。 過去ログに似た例もあったのですが、解決されて いなかったようなので、今回質問させていただいています。 野口慎一 <?php /* $Id: cod_table22.php,v 1.5 2003/09/17 00:54:27 ptosh Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // ゆうパック代金引換払い(手数料が購入金額に連動) class cod_table2 { var $code, $title, $description, $enabled; var $n_fee, $s_error; var $email_footer; // class constructor function cod_table2() { global $order; $this->code = 'cod_table2'; $this->title = MODULE_PAYMENT_COD_TABLE2_TEXT_TITLE; $this->description = MODULE_PAYMENT_COD_TABLE2_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_COD_TABLE2_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_COD_TABLE2_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_COD_TABLE2_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_COD_TABLE2_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->email_footer = MODULE_PAYMENT_COD_TABLE2_TEXT_EMAIL_FOOTER; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_COD_TABLE2_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COD_TABLE2_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // 代引手数料を計算する function calc_fee($total_cost) { $table_fee = split("[:,]" , MODULE_PAYMENT_COD_TABLE2_COST); $f_find = false; $this->n_fee = 0; for ($i = 0; $i < count($table_fee); $i+=2) { if ($total_cost <= $table_fee[$i]) { $this->n_fee = $table_fee[$i+1]; $f_find = true; break; } } if ( !$f_find ) { $this->s_error = MODULE_PAYMENT_COD_TABLE2_TEXT_OVERFLOW_ERROR; } return $f_find; } // class methods function javascript_validation() { return false; } function selection() { global $currencies; global $order; $total_cost = $order->info['total']; // 税金も含めた代金の総額 $f_result = $this->calc_fee($total_cost); // 手数料 $added_hidden = $f_result ? tep_draw_hidden_field('codt_fee', $this->n_fee).tep_draw_hidden_field('cod_total_cost', $total_cost) : tep_draw_hidden_field('codt_fee_error', $this->s_error); $s_message = $f_result ? (MODULE_PAYMENT_COD_TABLE2_TEXT_FEE . ' ' . $currencies->format($this->n_fee)) : ('<font color="#FF0000">' . $this->s_error . '</font>'); $selection = array( 'id' => $this->code, 'module' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_COD_TABLE2_TEXT_PROCESS, 'field' => ''), array('title' => $s_message, 'field' => $added_hidden)) ); return $selection; } function pre_confirmation_check() { return false; } function confirmation() { global $currencies; global $HTTP_POST_VARS; $s_result = !$HTTP_POST_VARS['codt_fee_error']; $s_message = $s_result ? (MODULE_PAYMENT_COD_TABLE2_TEXT_FEE . ' ' . $currencies->format($HTTP_POST_VARS['codt_fee'])) : ('<font color="#FF0000">' . $HTTP_POST_VARS['codt_fee_error'] . '</font>'); $confirmation = array( 'title' => $this->title, 'fields' => array(array('title' => MODULE_PAYMENT_COD_TABLE2_TEXT_PROCESS, 'field' => ''), array('title' => $s_message, 'field' => ''), ) ); return $confirmation; } function process_button() { global $currencies; global $HTTP_POST_VARS; global $order; // email_footer に使用する文字列 $s_message = $HTTP_POST_VARS['codt_fee_error'] ? $HTTP_POST_VARS['codt_fee_error'] : sprintf(MODULE_PAYMENT_COD_TABLE2_TEXT_MAILFOOTER, $currencies->format($order->info['total']), $currencies->format($HTTP_POST_VARS['codt_fee'])); return tep_draw_hidden_field('codt_message', $s_message) . tep_draw_hidden_field('codt_fee',$HTTP_POST_VARS['codt_fee']); // for ot_codt } function before_process() { global $HTTP_POST_VARS; $this->email_footer = $HTTP_POST_VARS['codt_message']; } function after_process() { return false; } function get_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_COD_TABLE2_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('代金引換払いを有効にする', 'MODULE_PAYMENT_COD_TABLE2_STATUS', 'True', '代金引換による支払いを受け付け ますか?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ',now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('代引手数料の計算表', 'MODULE_PAYMENT_COD_TABLE2_COST', '9999:250,29999:250,99999:250,299999:250', '支払い金額に連動する代引手数料. 例: 9999:250,29999:250,99999:250,299999:250 ... 9999円まで250円, 29999円まで 250円, ...', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('表示の整列順', 'MODULE_PAYMENT_COD_TABLE2_SORT_ORDER', '0', '表示の 整列順を設定できます。数字が小さいほど上位に表示されます.', '6', '0' , now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('適用地域', 'MODULE_PAYMENT_COD_TABLE2_ZONE', '0', '適用地域を選択すると、選択した地域の みで利用可能となります.', '6', '3', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('初期注文ステータス', 'MODULE_PAYMENT_COD_TABLE2_ORDER_STATUS_ID', '0', '設定したステータスが受注 時に適用されます.', '6', '4', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array( 'MODULE_PAYMENT_COD_TABLE2_STATUS', 'MODULE_PAYMENT_COD_TABLE2_COST', 'MODULE_PAYMENT_COD_TABLE2_SORT_ORDER', 'MODULE_PAYMENT_COD_TABLE2_ZONE', 'MODULE_PAYMENT_COD_TABLE2_ORDER_STATUS_ID' ); } } ?> | 佐藤@キャプテンです。 | | 標準モジュール以外の話となるとソースを掲示していただかないと | なんともアドバイスのしようがないと思うのですが。 | ちなみに自分の場合はソースにデバッグ用コードとして、print_r() | を埋め込み、変数(主にセッション変数かな?)をダンプしています。 | | ********************************* | | 〒990-0043 山形市本町一丁目7-54 | キャプテン山形株式会社 | 佐藤 浩 | TEL 023-622-6611 | Fax 023-622-6733 | E-mail: s.hir****@mmy***** | | ********************************* | | | _______________________________________________ | Tep-j-general mailing list | Tep-j****@lists***** | http://lists.sourceforge.jp/mailman/listinfo/tep-j-general | |