バージョン選択

フォーラム

メニュー

オンライン状況

83 人のユーザが現在オンラインです。 (76 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 83
もっと...

サイト内検索

質問 > フロント機能 > ECcube2.13で 離島の送料設定を行う方法

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
aro
投稿日時: 2014/8/22 18:09
対応状況: −−−
半人前
登録日: 2014/4/7
居住地:
投稿: 17
ECcube2.13で 離島の送料設定を行う方法
いつもお世話になっております。


ECcubeにて、離島の送料を設定したいと思い、



http://d.hatena.ne.jp/chirubo/20130531/1369996109

上記のサイトの情報を参考にして離島の際には+540円加算するよう
カスタマイズを行なったところ、宅急便を選択した際は
意図した通りに動作したのですが、

今度は以下の2点の問題が発生しました。



(1)メール便を選択した際には離島を含めて一律料金にしたい

→ 上記のカスタマイズだとメール便でも+540円加算されてしまう。



(2)10,000円以上購入してもらった場合には送料を無料にしたい

→ 上記のカスタマイズだと送料無料条件に該当しても+540円加算されてしまう。



上記2つの条件を満たすようにカスタマイズを行いたいのですが、
今回のアプローチでは難しいのでしょうか?



もし可能のようでしたらどのように記述すればよいか
ご指導いただけないでしょうか。



カスタマイズを行ったファイルは
data/class_extends/page_extends/shopping/LC_Page_Shopping_Confirm_Ex.php



で、
以下の記述を追加しました。



ーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
//LC_Page_Shopping_Confirm.php actionの中身を追加

function action()
{
//決済処理中ステータスのロールバック
$objPurchase = new SC_Helper_Purchase_Ex();
$objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);

$objCartSess = new SC_CartSession_Ex();
$objSiteSess = new SC_SiteSession_Ex();
$objCustomer = new SC_Customer_Ex();

$this->is_multiple = $objPurchase->isMultiple();

// 前のページで正しく登録手続きが行われた記録があるか判定
if (!$objSiteSess->isPrePage()) {
SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess);
}

// ユーザユニークIDの取得と購入状態の正当性をチェック
$this->tpl_uniqid = $objSiteSess->getUniqId();
$objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);

$this->cartKey = $objCartSess->getKey();

// カート内商品のチェック
$this->tpl_message = $objCartSess->checkProducts($this->cartKey);
if (!SC_Utils_Ex::isBlank($this->tpl_message)) {
SC_Response_Ex::sendRedirect(CART_URL);
SC_Response_Ex::actionExit();
}

// カートの商品を取得
$this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
$this->arrCartItems = $objCartSess->getCartList($this->cartKey);
// 合計金額
$this->tpl_total_inctax[$this->cartKey] = $objCartSess->getAllProductsTotal($this->cartKey);
// 税額
$this->tpl_total_tax[$this->cartKey] = $objCartSess->getAllProductsTax($this->cartKey);
// ポイント合計
$this->tpl_total_point[$this->cartKey] = $objCartSess->getAllProductsPoint($this->cartKey);

// 一時受注テーブルの読込
$arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
// カート集計を元に最終計算
$arrCalcResults = $objCartSess->calculate($this->cartKey, $objCustomer,
$arrOrderTemp['use_point'],
$objPurchase->getShippingPref($this->is_multiple),
$arrOrderTemp['charge'],
$arrOrderTemp['discount'],
$arrOrderTemp['deliv_id'],
$arrOrderTemp['order_pref'], // 税金計算の為に追加 注文者基準
$arrOrderTemp['order_country_id'] // 税金計算の為に追加 注文者基準
);

//離島の計算(540円追加する)
$ritouFee = 540;
foreach($this->arrShipping as $aSv) {
$zipcode = $aSv['shipping_zip01'].'-'. $aSv['shipping_zip02'];
$fp = fopen(DATA_REALDIR . 'downloads/ritou.csv',"r");
while($data = fgetcsv($fp)){
if($data[0] == $zipcode) {
$arrCalcResults['deliv_fee'] += $ritouFee;
$arrCalcResults['total'] += $ritouFee;
$arrCalcResults['payment_total'] += $ritouFee;
break;
}
}
}

$this->arrForm = array_merge($arrOrderTemp, $arrCalcResults);

// 会員ログインチェック
if ($objCustomer->isLoginSuccess(true)) {
$this->tpl_login = '1';
$this->tpl_user_point = $objCustomer->getValue('point');
}

// 決済モジュールを使用するかどうか
$this->use_module = SC_Helper_Payment_Ex::useModule($this->arrForm['payment_id']);

switch ($this->getMode()) {
// 前のページに戻る
case 'return':
// 正常な推移であることを記録しておく
$objSiteSess->setRegistFlag();

SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
SC_Response_Ex::actionExit();
break;
case 'confirm':
/*
* 決済モジュールで必要なため, 受注番号を取得
*/
$this->arrForm['order_id'] = $objPurchase->getNextOrderID();
$_SESSION['order_id'] = $this->arrForm['order_id'];

// 集計結果を受注一時テーブルに反映
$objPurchase->saveOrderTemp($this->tpl_uniqid, $this->arrForm,
$objCustomer);

// 正常に登録されたことを記録しておく
$objSiteSess->setRegistFlag();

// 決済モジュールを使用する場合
if ($this->use_module) {
$objPurchase->completeOrder(ORDER_PENDING);

SC_Response_Ex::sendRedirect(SHOPPING_MODULE_URLPATH);
}
// 購入完了ページ
else {
$objPurchase->completeOrder(ORDER_NEW);
SC_Helper_Purchase_Ex::sendOrderMail($this->arrForm['order_id'], $this);

SC_Response_Ex::sendRedirect(SHOPPING_COMPLETE_URLPATH);
}
SC_Response_Ex::actionExit();
break;
default:
break;
}

}

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーー


なにぶん未熟なため、初歩的な部分で躓いてしまっており
回答が難しい点もあるかと思いますが、
なにとぞご指導のほど、よろしくお願いいたします。




oda
投稿日時: 2014/8/22 18:54
対応状況: −−−
半人前
登録日: 2012/2/17
居住地:
投稿: 16
Re: ECcube2.13で 離島の送料設定を行う方法
本来はSC_CartSession calculate
に対してカスタマイズを行うべきだとは思いますが

引用:

(1)メール便を選択した際には離島を含めて一律料金にしたい
(2)10,000円以上購入してもらった場合には送料を無料にしたい


の条件の時は追加されている加算処理(foreachの所)を実行しないというような対応になるかと思います。
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,856名です
総投稿数は109,989件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1291
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.