捕夢網 OSCommerce 便利商店外掛模組教學 (Pumo711)
本公司購物網採用 SeedNet便利商店繳款,營業額屢創新高?分享這一份喜悅,捕夢網將寫好的模組分享給大家,希望各位網路頭家可以跟我們一
樣財源廣進,當然捕夢網的購物網是由目前資源最多功能最強的開店軟體( Oscommerce)所架設的,由於各位頭家不一定都懂得如何修改程式或
增加金流模組,筆者將 step by step 將步驟說明清楚,若不清楚可以來信指教,歡迎各位先進不吝賜教
安裝 SeedNet 全省便利商店付款模組
安裝 SeedNet 全省便利商店付款模組,主要分為兩個部分,第一部分你必須將模組上傳到你的主機上,第二部分就是你必須修改你的程式碼,下面
所有的檔案都以絕對路徑來表示,上傳或修改請依照實際的檔案路徑,筆者建議上傳或是修改之前,請先備份你的檔案,詳細的安裝步驟如下:
第一部分: 所需下載檔案如下:
catalog/includes/modules/payment/p711.php
catalog/includes/languages/tchinese/modules/payment/p711.php
catalog/includes/p711.php
點這裡下載程式碼 ( 下載後請先解壓縮再上傳)
第二部分: 需要修改檔案如下:
catalog/checkout_confirmation.php
catalog/includes/functions/html_output.php
catalog/includes/classes/currencies.php
catalog/includes/classes/payment.php
catalog/account_history_info.php (補印帳單)
catalog/includes/functions/general.php (補印帳單)
STEP 1.上傳模組程式
將便利商店代收模組所需程式上傳到伺服器中
STEP 2.修改程式
此模組有些許功能為筆者自行增加的,所以與原本的程式碼有一些不一樣
,請依照文件中修改,筆者建議修改前請先備份你的檔案,再開始進行修改
STEP 3.啟動便利商店付款機制
當安裝完成後,你就可以啟動便利商店付款機制了,要正式使用超商繳費機制
請先申請商家編號,取得正式的編號後,你就可以正式上線,讓你的客戶使用這
麼方便的繳款方式了
STEP 1 上傳模組程式
首先將檔案下載到本機,並且解壓縮,解壓縮完成後上傳到你的伺服器,如下圖所示:
1.1 點選檔案下載,將檔案下載到本機中,如下圖所示:

1.2 儲存到電腦上任一目錄中,如下圖所示:

1.3 將下載的檔案 p711.zip 解壓縮,如下圖所示:
1.4 開啟壓縮後的目錄,如下圖所示:

1.5 上傳解壓縮中的檔案 p711.php (路徑位於catalog/includes/modules/payment)到你的伺服器的目錄中,伺服器
中的路徑如下圖所示:

1.6 上傳解壓縮中的檔案 p711.php (路徑位於catalog/includes/languages/tchinese/modules/payment)到
你的伺服器的目錄中,伺服器中的路徑如下圖所示:

1.7 上傳解壓縮中的檔案 p711.php (路徑位於catalog/includes/)到你的伺服器的目錄中,伺服器目錄為
/catalog/includes/ ,如下圖所示:

STEP 2 修改程式 GoTop
Oscommerce 便利商店付費模組,需要修改的模組有六個檔案,其中兩個是補印帳單用,筆者建議
修改之前請先備份你的檔案,避免造成嚴重錯誤後無法修復,詳細修改步驟如下:
catalog/checkout_confirmation.php
catalog/includes/functions/html_output.php
catalog/includes/classes/currencies.php
catalog/includes/classes/payment.php
catalog/account_history_info.php (補印帳單)
catalog/includes/functions/general.php (補印帳單)
2.1 修改 catalog/checkout_confirmation.php
搜尋到檔案中下面區塊的程式碼:
<?php
if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
} else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
}
echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
if (is_array($payment_modules->modules)) {
echo $payment_modules->process_button();
}
echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
?> |
將上面的程式碼替換成下面的程式碼:
<?php
if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
} else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
}
echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
if (is_array($payment_modules->modules)) {
echo $payment_modules->process_button();
}
if($$payment->code=='p711'){
echo tep_image_submit_p711($payment_modules->process_button_p711(),'button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
}else{
echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
}
?>
|
2.2 修改 catalog/includes/functions/html_output.php
搜尋到檔案中下面區塊的程式碼:
function tep_image_submit($image, $alt = '', $parameters = '') {
global $language;
$image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';
if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';
if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;
$image_submit .= '>';
return $image_submit;
} |
在這段程式碼下面插入下面區塊的程式碼:
function tep_image_submit_p711($url,$image, $alt = '', $parameters = '') {
global $language;
$image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';
if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';
if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;
$image_submit .= ' onClick="p711(\''.$url.'\');">';
return $image_submit;
} |
2.3 修改 catalog/includes/classes/currencies.php
搜尋到檔案中下面區塊的程式碼:
function display_price($products_price, $products_tax, $quantity = 1) {
return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
} |
在這段程式碼下面插入下面區塊的程式碼:
function display_price_p711($products_price, $products_tax, $quantity = 1) {
return tep_add_tax($products_price, $products_tax) * $quantity;
} |
2.4 修改 catalog/includes/classes/payment.php
搜尋到檔案中下面區塊的程式碼:
function process_button() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->process_button();
}
}
} |
在這段程式碼下面插入下面區塊的程式碼:
function process_button_p711() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->process_button_p711();
}
}
}
|
2.5 修改 catalog/account_history_info.php (補印帳單)
搜尋到檔案中下面區塊的程式碼:
<tr>
<td class="main"><?php echo $order->info['payment_method']; ?></td>
</tr>
|
將上面的程式碼替換成下面的程式碼:
<!-- start seednet payment method -->
<?php require(DIR_WS_INCLUDES . 'p711.php'); ?>
<tr>
<td class="main"><?php echo $order->info['payment_method'];
if($order->info['payment_method']=='便利商店代收貨款'){
?></td>
</tr>
<tr>
<td STYLE="cursor:hand"
onClick="p711('<?php echo $url;?>','SeedNet 便利商店付款','width=350,height=40')"><FONT SIZE="2" COLOR="#0000FF"><U>補印帳單</U></FONT></td>
<?}?>
</tr>
<!-- end seednet payment method --> |
2.6 修改 catalog/includes/functions/general.php (補印帳單)
搜尋到檔案中下面區塊的程式碼:
function tep_date_short($raw_date) {
if ( ($raw_date == '0000-00-00 00:00:00') || empty($raw_date) ) return false;
$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);
if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {
return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
} else {
return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));
}
} |
在這段程式碼下面插入下面區塊的程式碼:
function tep_date_p711($raw_date) {
if ( ($raw_date == '0000-00-00') || empty($raw_date) ) return false;
$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
if (@date('Y', mktime($month, $day, $year)) == $year) {
return date('Y-m-d', mktime($month, $day, $year));
} else {
return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($month, $day, 2037)));
}
} |
STEP 3 啟動便利商店付款機制 GoTop
完成上面所有步驟後,啟動便利商店繳款機制,進入管理者介面->外掛模組->付款方式->便利商店代收貨款
點選安裝,你的模組就算安裝完成了,詳細說明如下圖所示:
3.1 安裝便利商店代收貨款

3.2 立即申請便利商店代收貨款,若您尚未申請SeedNet 商家編號,請點選立即申請,詳細說明如下圖所示:

3.3 SEEDNET 商家編號,預設值為SEEDNET所提供的測試帳號,當您進行測試的時候,每一筆交易都會
使用SEEDNET的的預設帳號 SCITY000 進行交易,所以當你申請商家編號後,請把欄位中的值更正,以
免產生交易失敗
3.4 繳費到期天數,設定你每一筆交易允許消費者在幾天內繳款,帳單若超過繳費日期,便利商店就無法
收取這一筆款項,所以請店家依照自己的需求做調整
3.5 廠商管理介面網址: https://service.seed.net.tw/proxy_portal.htm
( 未正式上線之前可先以測試帳號 login 使用: 測試帳號: SCITY000 密碼 scity000)
詳細說明請閱讀 帳單代收廠商使用手冊
|
|