OPENCART一頁式結帳模組-中文化與認證機制皆被我研究出來了

2017/05/31******************************************************************************************************
一頁式結帳-前台啟動條件
if ($this->config->get(‘quickcheckout_status’) && $this->validated()) {
1.$this->config->get(‘quickcheckout_status’) 該商店啟用
2.$this->validated 憑證通過vendor/equotix/quickcheckout/equotix.php 155行 用curl送值和接收
//==============================================================================================================
protected function validated() {
$this->callbackServer($this->config->get($this->code . ‘_license_license_key’), false);
return $this->config->get($this->code . ‘_license_license_key’) ? true : false;
}
//==============================================================================================================

#寫了一隻測試程式 看$this->config->get(‘quickcheckout_status’) 和 $this->validated
view-source:http://o03.test.com/index.php?route=test
========================================================================================================
protected $code = ‘quickcheckout’;
protected $extension_id = ’58’;

[quickcheckout_license_date_expired] => 29 May 2018
[quickcheckout_license_license_key] => xxxxxxx-xxxxxx-fabb673-9c40513-3b17864-ff16b4b
[quickcheckout_license_order_id] => 876666
[quickcheckout_license_name] => gggg
[quickcheckout_license_date_purchased] => 29 May 2017
[quickcheckout_field_address_1] => Array

http://o03.test.com/index.php?route=test
http://o03.test.com/index.php?route=quickcheckout/checkout #一頁結帳頁面 -手動過去
正常會返回8個值

=======================================
#POST送出的值
=======================================
[license_key] => oc52284-ceba4f2-fabb673-9c40513-3b17864-ff16b4b
[extension_id] => 58
[domain] => apm013.surehigh.com.tw //去除www.// 去除http://// 去除/ //轉小寫
=======================================
#CURL返回的值
[success] => 1 #成功或失敗
[license_key] => xxxxxxx-xxxxxx-fabb673-9c40513-3b17864-ff16b4b
[order_id] => 876666 #訂單號
[name] => gggg #購買人
[date_purchased] => 26 May 2017 #授權購買日
[date_expired] => 26 May 2018 #授權到期日
[domains] => Array([0] => Array(
[domain] => apm013.surehigh.com.tw
[date_added] => 26 May 2017
))
[services] => Array
[service] => Change Admin URL
[cost] => Only $39

[service] => OpenCart Upgrade
[cost] => Only $69

[service] => Professional Extension Installation
[cost] => Only $99

[service] => Custom Development
[cost] => From $139

[service] => Resolve Errors in Error Log
[cost] => Only $299

[service] => Website Audit
[cost] => Only $699
=======================================

//自行製造返回內容 S**********************************************************/
$response=array(‘success’ => 1,//#成功或失敗
‘license_key’=> ‘xxxxxxx-xxxxxx-fabb673-9c40513-3b17864-ff16b4b’,//許可證號
‘order_id’=> ‘874189’,//#訂單號
‘name’=> ‘gggg’,//#購買人
‘date_purchased’=> ’26 May 2017’,//#授權購買日
‘date_expired’=> ’26 May 2018’);//#授權到期日
$response[‘domains’][]=array(‘domain’ => ‘apm013.surehigh.com.tw’,’date_added’ => ’29 May 2017′);//允許授權網址
$response[‘services’][]=array(‘service’ => ‘更改管理後台網址’,’cost’=>’$39′);
$response[‘services’][]=array(‘service’ => ‘升級 OpenCart’,’cost’=>’$69′);
$response[‘services’][]=array(‘service’ => ‘專業擴展包安裝’,’cost’=>’$99′);
//自行製造返回內容 END**********************************************************/
=======================================
#有8個值 要寫入設定
=======================================
$this->code . ‘_license_license_key’ => ”,
$this->code . ‘_license_order_id’ => ”,
$this->code . ‘_license_name’ => ”,
$this->code . ‘_license_date_purchased’ => ”,
$this->code . ‘_license_date_expired’ => ”,
$this->code . ‘_license_domains’ => array(),
$this->code . ‘_license_check’ => time(),
$this->code . ‘_license_services’ => ”

=======================================
#資料表記的位置
=======================================
SELECT * FROM `OPENCART`.`oc_setting` WHERE code =’quickcheckout_license’

setting_idstore_idcodekeyvalueserialized2690quickcheckout_licensequickcheckout_license_date_expired26 May 201802700quickcheckout_licensequickcheckout_license_domains[{“domain”:”apm013.surehigh.com.tw”,”date_added”:”…12710quickcheckout_licensequickcheckout_license_check149622471302720quickcheckout_licensequickcheckout_license_services[{“service”:”\u66f4\u6539\u7ba1\u7406\u5f8c\u53f0\…12680quickcheckout_licensequickcheckout_license_date_purchased26 May 201702670quickcheckout_licensequickcheckout_license_namesuffix NO.1002650quickcheckout_licensequickcheckout_license_license_keyoc52284-ceba4f2-fabb673-9c40513-3b17864-ff16b4b02660quickcheckout_licensequickcheckout_license_order_id874189

[{“domain”:”apm013.surehigh.com.tw”,”date_added”:”26 May 2017″}]

——————————————————————————————-
#手動看他有幾種訊息
——————————————————————————————-
http://license.marketinsg.com/index.php?load=common/home/checkUpdate #按下Update時
http://license.marketinsg.com/index.php?load=common/home/validatelicense #檢查全縣 每48小時檢查一次
——————————————————————————————-
http://apm013.surehigh.com.tw/index.php?route=test #手動執行-強制認證 不等48小時
http://license.marketinsg.com/index.php?load=common/home/validatelicense #目標
成功只會返回
Array ( [error] => [success] => 1 ) {“success”:true}
失敗狀況
——————————————————————————————-
#domain 密鑰通過 網址不對 比對部分 surehigh.com.tw apm013.surehigh.com.tw 子網域也不行
Array ( [error] => License key has reached its limit. Please verify your license key and its usage on http://license.marketinsg.com. [success] => ) {“error”:”License key has reached its limit. Please verify your license key and its usage on http:\/\/license.marketinsg.com.”}
許可證密鑰已經達到極限。 請驗證您的許可證密鑰及其在http://license.marketinsg.com上的用途。
——————————————————————————————-
#沒POST license_key 過去
Array ( [error] => Invalid license key entered. [success] => ) {“error”:”Invalid license key entered.”}
輸入的許可證密鑰無效
——————————————————————————————-
D:\wamp\www\o03\catalog\controller\test.php 的內容
$license_key=”oc52284-ceba4f2-fabb673-9c40513-3b17864-ff16b4b”;
$license_info = $this->callbackServer($license_key, true); //呼叫權限檢查

——————————————————————————————-
目標
http://license.marketinsg.com/index.php?load=common/home/checkUpdate #按下Update時
//按下Update的動作
/*
正常送出
Array ( [license_key] => oc52284-ceba4f2-fabb673-9c40513-3b17864- [version] => 10.1.0
正常傳回
恭喜!您正在使用最新版本的擴展名。
{“type”:”alert alert-success”,”message”:”Congratulations! You are using the latest version of the extension.”}
——————————————————————————————-
結果
正常
{“type”:”alert alert-success”,”message”:”Congratulations! You are using the latest version of the extension.”}
{“type”:“alert alert-success”,“message”:“恭喜!您正在使用最新版本的擴展名。”}
——————————————————————————————-
{“type”:”alert-danger”,”message”:”We are unable to retrieve your license information. Please contact us if you require assistance.”}
{“type”:“alert-danger”,“message”:“我們無法檢索您的許可證信息,如果需要幫助,請與我們聯繫。”}

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *