バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > 管理機能 > 2.11.4 ポイントについての変更

管理機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
seasoft
投稿日時: 2012/3/30 14:55
対応状況: −−−
登録日: 2008/6/4
居住地:
投稿: 7367
Re: 2.11.4 ポイントについての変更
引用:

akki31さんは書きました:
seasoft様

いつもありがとうございます。

度々スイマセン、こちらを正式に編集依頼をした場合ですと
おいくらくらいになりそうでしょうか?

宜しくお願い致します。


実際には現状のカスタマイズ状況などによっても変動はございますが、お伺いしている範囲ですと、1万円以下の作業規模に収まる印象ではございます。

メールでご連絡いただければ、詳細を伺わせていただきます。


----------------
Seasoft
こちらでの投稿は、アイディア程度に留めさせていただいております。
個別案件の作業は有償で承っております。お気軽にご相談ください。

akki31
投稿日時: 2012/4/1 18:52
対応状況: −−−
常連
登録日: 2011/6/7
居住地:
投稿: 59
Re: 2.11.4 ポイントについての変更
ken-o様

ご丁寧に、修正版ありがとうございます!!
非常にありがたいです。

以下修正してみました。
今度は大丈夫かと思いますが・・

}の数が心配です・・・。


宜しくお願い致します。


// お支払い合計
$results['payment_total'] = $results['total'] - $use_point * POINT_VALUE;


if($use_point > 0){
$results['add_point'] = 0;
return $results;

}else{


// 加算ポイントの計算
if (USE_POINT !== false) {
$results['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($total_point,
$use_point);
if($objCustomer != "") {
// 誕生日月であった場合
if($objCustomer->isBirthMonth()) {
$results['birth_point'] = BIRTH_MONTH_POINT;
$results['add_point'] += $results['birth_point'];
}
}
if($results['add_point'] < 0) {
$results['add_point'] = 0;
}
return $results;
}
}
akki31
投稿日時: 2012/4/1 18:55
対応状況: −−−
常連
登録日: 2011/6/7
居住地:
投稿: 59
Re: 2.11.4 ポイントについての変更
seasoft様

引用:

実際には現状のカスタマイズ状況などによっても変動はございますが、お伺いしている範囲ですと、1万円以下の作業規模に収まる印象ではございます。



わかりました。上記検討してみます。
ありがとうございます。
ken-o
投稿日時: 2012/4/2 9:14
対応状況: −−−
長老
登録日: 2011/9/22
居住地:
投稿: 222
Re: 2.11.4 ポイントについての変更
akki31 様

上記を見る限り、{}の個数は問題ないかと思います。

実際に実装されてみて、反応はいかがでしょうか?


----------------
何分知識が浅いですが・・・
出来得る限り協力したいと思っています

akki31
投稿日時: 2012/4/5 11:49
対応状況: −−−
常連
登録日: 2011/6/7
居住地:
投稿: 59
Re: 2.11.4 ポイントについての変更
ken-o様

ありがとうございます。

修正後、再度実装してみました。


結果、最後の行でエラーが出ているということで・・
どうしてでしょうか?


全文です。

<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

/**
* カートセッション管理クラス
*
* @author LOCKON CO.,LTD.
* @version $Id: SC_CartSession.php 21296 2011-10-22 14:44:09Z Seasoft $
*/
class SC_CartSession {
/** ユニークIDを指定する. */
var $key_tmp;

/** カートのセッション変数. */
var $cartSession;

/* コンストラクタ */
function SC_CartSession($cartKey = 'cart') {
if (!isset($_SESSION[$cartKey])) {
$_SESSION[$cartKey] = array();
}
$this->cartSession =& $_SESSION[$cartKey];
}

// 商品購入処理中のロック
function saveCurrentCart($key_tmp, $productTypeId) {
$this->key_tmp = "savecart_" . $key_tmp;
// すでに情報がなければ現状のカート情報を記録しておく
if(count($_SESSION[$this->key_tmp]) == 0) {
$_SESSION[$this->key_tmp] = $this->cartSession[$productTypeId];
}
// 1世代古いコピー情報は、削除しておく
foreach($_SESSION as $k => $val) {
if($k != $this->key_tmp && preg_match("/^savecart_/", $k)) {
unset($this->cartSession[$productTypeId][$k]);
}
}
}

// 商品購入中の変更があったかをチェックする。
function getCancelPurchase($productTypeId) {
$ret = isset($this->cartSession[$productTypeId]['cancel_purchase'])
? $this->cartSession[$productTypeId]['cancel_purchase'] : "";
$this->cartSession[$productTypeId]['cancel_purchase'] = false;
return $ret;
}

// 購入処理中に商品に変更がなかったかを判定
function checkChangeCart($productTypeId) {
$change = false;
$max = $this->getMax($productTypeId);
for($i = 1; $i <= $max; $i++) {
if ($this->cartSession[$productTypeId][$i]['quantity']
!= $_SESSION[$this->key_tmp][$i]['quantity']) {

$change = true;
break;
}
if ($this->cartSession[$productTypeId][$i]['id']
!= $_SESSION[$this->key_tmp][$i]['id']) {

$change = true;
break;
}
}
if ($change) {
// 一時カートのクリア
unset($_SESSION[$this->key_tmp]);
$this->cartSession[$productTypeId][$key]['cancel_purchase'] = true;
} else {
$this->cartSession[$productTypeId]['cancel_purchase'] = false;
}
return $this->cartSession[$productTypeId]['cancel_purchase'];
}

// 次に割り当てるカートのIDを取得する
function getNextCartID($productTypeId) {
foreach($this->cartSession[$productTypeId] as $key => $val){
$arrRet[] = $this->cartSession[$productTypeId][$key]['cart_no'];
}
return max($arrRet) + 1;
}

/**
* 商品ごとの合計価格
* XXX 実際には、「商品」ではなく、「カートの明細行(≒商品規格)」のような気がします。
*
* @param integer $id
* @return string 商品ごとの合計価格(税込み)
* @deprecated SC_CartSession::getCartList() を使用してください
*/
function getProductTotal($id, $productTypeId) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
if(isset($this->cartSession[$productTypeId][$i]['id'])
&& $this->cartSession[$productTypeId][$i]['id'] == $id) {

// 税込み合計
$price = $this->cartSession[$productTypeId][$i]['price'];
$quantity = $this->cartSession[$productTypeId][$i]['quantity'];
$incTax = SC_Helper_DB_Ex::sfCalcIncTax($price);
$total = $incTax * $quantity;
return $total;
}
}
return 0;
}

// 値のセット
function setProductValue($id, $key, $val, $productTypeId) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
if(isset($this->cartSession[$productTypeId][$i]['id'])
&& $this->cartSession[$productTypeId][$i]['id'] == $id) {
$this->cartSession[$productTypeId][$i][$key] = $val;
}
}
}

// カート内商品の最大要素番号を取得する。
function getMax($productTypeId) {
$max = 0;
if (count($this->cartSession[$productTypeId]) > 0){
foreach($this->cartSession[$productTypeId] as $key => $val) {
if (is_numeric($key)) {
if($max < $key) {
$max = $key;
}
}
}
}
return $max;
}

// カート内商品数量の合計
function getTotalQuantity($productTypeId) {
$total = 0;
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
$total+= $this->cartSession[$productTypeId][$i]['quantity'];
}
return $total;
}

// 全商品の合計価格
function getAllProductsTotal($productTypeId) {
// 税込み合計
$total = 0;
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {

if (!isset($this->cartSession[$productTypeId][$i]['price'])) {
$this->cartSession[$productTypeId][$i]['price'] = "";
}

$price = $this->cartSession[$productTypeId][$i]['price'];

if (!isset($this->cartSession[$productTypeId][$i]['quantity'])) {
$this->cartSession[$productTypeId][$i]['quantity'] = "";
}
$quantity = $this->cartSession[$productTypeId][$i]['quantity'];

$incTax = SC_Helper_DB_Ex::sfCalcIncTax($price);
$total+= ($incTax * $quantity);
}
return $total;
}

// 全商品の合計税金
function getAllProductsTax($productTypeId) {
// 税合計
$total = 0;
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
$price = $this->cartSession[$productTypeId][$i]['price'];
$quantity = $this->cartSession[$productTypeId][$i]['quantity'];
$tax = SC_Helper_DB_Ex::sfTax($price);
$total+= ($tax * $quantity);
}
return $total;
}

// 全商品の合計ポイント
function getAllProductsPoint($productTypeId) {
// ポイント合計
$total = 0;
if (USE_POINT !== false) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
$price = $this->cartSession[$productTypeId][$i]['price'];
$quantity = $this->cartSession[$productTypeId][$i]['quantity'];

if (!isset($this->cartSession[$productTypeId][$i]['point_rate'])) {
$this->cartSession[$productTypeId][$i]['point_rate'] = "";
}
$point_rate = $this->cartSession[$productTypeId][$i]['point_rate'];

if (!isset($this->cartSession[$productTypeId][$i]['id'][0])) {
$this->cartSession[$productTypeId][$i]['id'][0] = "";
}
$point = SC_Utils_Ex::sfPrePoint($price, $point_rate);
$total+= ($point * $quantity);
}
}
return $total;
}

// カートへの商品追加
function addProduct($product_class_id, $quantity) {
$objProduct = new SC_Product_Ex();
$arrProduct = $objProduct->getProductsClass($product_class_id);
$productTypeId = $arrProduct['product_type_id'];
$find = false;
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {

if($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) {
$val = $this->cartSession[$productTypeId][$i]['quantity'] + $quantity;
if(strlen($val) <= INT_LEN) {
$this->cartSession[$productTypeId][$i]['quantity'] += $quantity;
}
$find = true;
}
}
if(!$find) {
$this->cartSession[$productTypeId][$max+1]['id'] = $product_class_id;
$this->cartSession[$productTypeId][$max+1]['quantity'] = $quantity;
$this->cartSession[$productTypeId][$max+1]['cart_no'] = $this->getNextCartID($productTypeId);
}
}

// 前頁のURLを記録しておく
function setPrevURL($url, $excludePaths = array()) {
// 前頁として記録しないページを指定する。
$arrExclude = array(
"/shopping/"
);
$arrExclude = array_merge($arrExclude, $excludePaths);
$exclude = false;
// ページチェックを行う。
foreach($arrExclude as $val) {
if(preg_match("|" . preg_quote($val) . "|", $url)) {
$exclude = true;
break;
}
}
// 除外ページでない場合は、前頁として記録する。
if(!$exclude) {
$_SESSION['prev_url'] = $url;
}
}

// 前頁のURLを取得する
function getPrevURL() {
return isset($_SESSION['prev_url']) ? $_SESSION['prev_url'] : "";
}

// キーが一致した商品の削除
function delProductKey($keyname, $val, $productTypeId) {
$max = count($this->cartSession[$productTypeId]);
for($i = 0; $i < $max; $i++) {
if($this->cartSession[$productTypeId][$i][$keyname] == $val) {
unset($this->cartSession[$productTypeId][$i]);
}
}
}

function setValue($key, $val, $productTypeId) {
$this->cartSession[$productTypeId][$key] = $val;
}

function getValue($key, $productTypeId) {
return $this->cartSession[$productTypeId][$key];
}

/**
* セッション中の商品情報データの調整。
* productsClass項目から、不必要な項目を削除する。
*/
function adjustSessionProductsClass(&$arrProductsClass) {
$arrNecessaryItems = array(
'product_id' => true,
'product_class_id' => true,
'name' => true,
'price02' => true,
'point_rate' => true,
'main_list_image' => true,
'main_image' => true,
'product_code' => true,
'stock' => true,
'stock_unlimited' => true,
'sale_limit' => true,
'class_name1' => true,
'classcategory_name1' => true,
'class_name2' => true,
'classcategory_name2' => true,
);

// 必要な項目以外を削除。
foreach (array_keys($arrProductsClass) as $key) {
if (!isset($arrNecessaryItems[$key])) {
unset($arrProductsClass[$key]);
}
}
}

/**
* 商品種別ごとにカート内商品の一覧を取得する.
*
* @param integer $productTypeId 商品種別ID
* @return array カート内商品一覧の配列
*/
function getCartList($productTypeId) {
$objProduct = new SC_Product_Ex();
$max = $this->getMax($productTypeId);
$arrRet = array();
for($i = 0; $i <= $max; $i++) {
if(isset($this->cartSession[$productTypeId][$i]['cart_no'])
&& $this->cartSession[$productTypeId][$i]['cart_no'] != "") {

// 商品情報は常に取得
$this->cartSession[$productTypeId][$i]['productsClass']
=& $objProduct->getDetailAndProductsClass($this->cartSession[$productTypeId][$i]['id']);

$price = $this->cartSession[$productTypeId][$i]['productsClass']['price02'];
$this->cartSession[$productTypeId][$i]['price'] = $price;

$this->cartSession[$productTypeId][$i]['point_rate'] =
$this->cartSession[$productTypeId][$i]['productsClass']['point_rate'];

$quantity = $this->cartSession[$productTypeId][$i]['quantity'];
$incTax = SC_Helper_DB_Ex::sfCalcIncTax($price);
$total = $incTax * $quantity;

$this->cartSession[$productTypeId][$i]['total_inctax'] = $total;

$arrRet[] = $this->cartSession[$productTypeId][$i];

// セッション変数のデータ量を抑制するため、一部の商品情報を切り捨てる
// XXX 上で「常に取得」するのだから、丸ごと切り捨てて良さそうにも感じる。
$this->adjustSessionProductsClass($this->cartSession[$productTypeId][$i]['productsClass']);
}
}
return $arrRet;
}

/**
* すべてのカートの内容を取得する.
*
* @return array すべてのカートの内容
*/
function getAllCartList() {
$results = array();
$cartKeys = $this->getKeys();
$i = 0;
foreach ($cartKeys as $key) {
$cartItems = $this->getCartList($key);
foreach (array_keys($cartItems) as $itemKey) {
$cartItem =& $cartItems[$itemKey];
$results[$key][$i] =& $cartItem;
$i++;
}
}
return $results;
}

// カート内にある商品IDを全て取得する
/**
* @deprected getAllProductClassID を使用して下さい
*/
function getAllProductID($productTypeId) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
if($this->cartSession[$productTypeId][$i]['cart_no'] != "") {
$arrRet[] = $this->cartSession[$productTypeId][$i]['id'][0];
}
}
return $arrRet;
}

/**
* カート内にある商品規格IDを全て取得する.
*
* @param integer $productTypeId 商品種別ID
* @return array 商品規格ID の配列
*/
function getAllProductClassID($productTypeId) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
if($this->cartSession[$productTypeId][$i]['cart_no'] != "") {
$arrRet[] = $this->cartSession[$productTypeId][$i]['id'];
}
}
return $arrRet;
}

/**
* 商品種別ID を指定して, カート内の商品をすべて削除する.
*
* @param integer $productTypeId 商品種別ID
* @return void
*/
function delAllProducts($productTypeId) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
unset($this->cartSession[$productTypeId][$i]);
}
}

// 商品の削除
function delProduct($cart_no, $productTypeId) {
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
if($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
unset($this->cartSession[$productTypeId][$i]);
}
}
}

// 数量の増加
function upQuantity($cart_no, $productTypeId) {
$quantity = $this->getQuantity($cart_no, $productTypeId);
if (strlen($quantity + 1) <= INT_LEN) {
$this->setQuantity($quantity + 1, $cart_no, $productTypeId);
}
}

// 数量の減少
function downQuantity($cart_no, $productTypeId) {
$quantity = $this->getQuantity($cart_no, $productTypeId);
if ($quantity > 1) {
$this->setQuantity($quantity - 1, $cart_no, $productTypeId);
}
}

/**
* カート番号と商品種別IDを指定して, 数量を取得する.
*
* @param integer $cart_no カート番号
* @param integer $productTypeId 商品種別ID
* @return integer 該当商品規格の数量
*/
function getQuantity($cart_no, $productTypeId) {
$max = $this->getMax($productTypeId);
for ($i = 0; $i <= $max; $i++) {
if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
return $this->cartSession[$productTypeId][$i]['quantity'];
}
}
}

/**
* カート番号と商品種別IDを指定して, 数量を設定する.
*
* @param integer $quantity 設定する数量
* @param integer $cart_no カート番号
* @param integer $productTypeId 商品種別ID
* @retrun void
*/
function setQuantity($quantity, $cart_no, $productTypeId) {
$max = $this->getMax($productTypeId);
for ($i = 0; $i <= $max; $i++) {
if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
$this->cartSession[$productTypeId][$i]['quantity'] = $quantity;
}
}
}

/**
* カート番号と商品種別IDを指定して, 商品規格IDを取得する.
*
* @param integer $cart_no カート番号
* @param integer $productTypeId 商品種別ID
* @return integer 商品規格ID
*/
function getProductClassId($cart_no, $productTypeId) {
for ($i = 0; $i <= $max; $i++) {
if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
return $this->cartSession[$productTypeId][$i]['id'];
}
}
}

/**
* カート内の商品の妥当性をチェックする.
*
* エラーが発生した場合は, 商品をカート内から削除又は数量を調整し,
* エラーメッセージを返す.
*
* 1. 商品種別に関連づけられた配送業者の存在チェック
* 2. 削除/非表示商品のチェック
* 3. 商品購入制限数のチェック
* 4. 在庫数チェック
*
* @param string $key 商品種別ID
* @return string エラーが発生した場合はエラーメッセージ
*/
function checkProducts($productTypeId) {
$objProduct = new SC_Product_Ex();
$tpl_message = "";

// カート内の情報を取得
$items = $this->getCartList($productTypeId);
foreach (array_keys($items) as $key) {
$item =& $items[$key];
$product =& $item['productsClass'];
/*
* 表示/非表示商品のチェック
*/
if (SC_Utils_Ex::isBlank($product)) {
$this->delProduct($item['cart_no'], $productTypeId);
$tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n";
} else {

/*
* 配送業者のチェック
*/
$arrDeliv = SC_Helper_Purchase_Ex::getDeliv($productTypeId);
if (SC_Utils_Ex::isBlank($arrDeliv)) {
$tpl_message .= "※「" . $product['name'] . "」はまだ配送の準備ができておりません。恐れ入りますがお問い合わせページよりお問い合わせください。\n";
$this->delProduct($item['cart_no'], $productTypeId);
}

/*
* 商品購入制限数, 在庫数のチェック
*/
$limit = $objProduct->getBuyLimit($product);
if (!is_null($limit) && $item['quantity'] > $limit) {
if ($limit > 0) {
$this->setProductValue($item['id'], 'quantity', $limit, $productTypeId);
$this->setProductValue($item['id'], 'total_inctax', SC_Helper_DB_Ex::sfCalcIncTax($item['price']) * $limit, $productTypeId);
$tpl_message .= "※「" . $product['name'] . "」は販売制限(または在庫が不足)しております。一度に数量{$limit}以上の購入はできません。\n";
} else {
$this->delProduct($item['cart_no'], $productTypeId);
$tpl_message .= "※「" . $product['name'] . "」は売り切れました。\n";
continue;
}
}
}
}
return $tpl_message;
}

/**
* 送料無料条件を満たすかどうかチェックする
*
* @param integer $productTypeId 商品種別ID
* @return boolean 送料無料の場合 true
*/
function isDelivFree($productTypeId) {
$objDb = new SC_Helper_DB_Ex();

$subtotal = $this->getAllProductsTotal($productTypeId);

// 送料無料の購入数が設定されている場合
if (DELIV_FREE_AMOUNT > 0) {
// 商品の合計数量
$total_quantity = $this->getTotalQuantity($productTypeId);

if($total_quantity >= DELIV_FREE_AMOUNT) {
return true;
}
}

// 送料無料条件が設定されている場合
$arrInfo = $objDb->sfGetBasisData();
if ($arrInfo['free_rule'] > 0) {
// 小計が無料条件を超えている場合
if($subtotal >= $arrInfo['free_rule']) {
return true;
}
}

return false;
}

/**
* カートの内容を計算する.
*
* カートの内容を計算し, 下記のキーを保持する連想配列を返す.
*
* - tax: 税額
* - subtotal: カート内商品の小計
* - deliv_fee: カート内商品の合計送料
* - total: 合計金額
* - payment_total: お支払い合計
* - add_point: 加算ポイント
*
* @param integer $productTypeId 商品種別ID
* @param SC_Customer $objCustomer ログイン中の SC_Customer インスタンス
* @param integer $use_point 今回使用ポイント
* @param integer|array $deliv_pref 配送先都道府県ID.
複数に配送する場合は都道府県IDの配列
* @param integer $charge 手数料
* @param integer $discount 値引
* @param integer $deliv_id 配送業者ID
* @return array カートの計算結果の配列
*/
function calculate($productTypeId, &$objCustomer, $use_point = 0,
$deliv_pref = "", $charge = 0, $discount = 0, $deliv_id = 0) {
$objDb = new SC_Helper_DB_Ex();

$total_point = $this->getAllProductsPoint($productTypeId);
$results['tax'] = $this->getAllProductsTax($productTypeId);
$results['subtotal'] = $this->getAllProductsTotal($productTypeId);
$results['deliv_fee'] = 0;

// 商品ごとの送料を加算
if (OPTION_PRODUCT_DELIV_FEE == 1) {
$cartItems = $this->getCartList($productTypeId);
foreach ($cartItems as $item) {
$results['deliv_fee'] += $item['productsClass']['deliv_fee'] * $item['quantity'];
}
}

// 配送業者の送料を加算
if (OPTION_DELIV_FEE == 1
&& !SC_Utils_Ex::isBlank($deliv_pref)
&& !SC_Utils_Ex::isBlank($deliv_id)) {
$results['deliv_fee'] += $objDb->sfGetDelivFee($deliv_pref, $deliv_id);
}

// 送料無料チェック
if ($this->isDelivFree($productTypeId)) {
$results['deliv_fee'] = 0;
}

// 合計を計算
$results['total'] = $results['subtotal'];
$results['total'] += $results['deliv_fee'];
$results['total'] += $charge;
$results['total'] -= $discount;

// お支払い合計
$results['payment_total'] = $results['total'] - $use_point * POINT_VALUE;


if($use_point > 0){
$results['add_point'] = 0;
return $results;

}else{


// 加算ポイントの計算
if (USE_POINT !== false) {
$results['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($total_point,
$use_point);
if($objCustomer != "") {
// 誕生日月であった場合
if($objCustomer->isBirthMonth()) {
$results['birth_point'] = BIRTH_MONTH_POINT;
$results['add_point'] += $results['birth_point'];
}
}
if($results['add_point'] < 0) {
$results['add_point'] = 0;
}
return $results;
}
}

/**
* カートが保持するキー(商品種別ID)を配列で返す.
*
* @return array 商品種別IDの配列
*/
function getKeys() {
$keys = array_keys($this->cartSession);
// 数量が 0 の商品種別は削除する
foreach ($keys as $key) {
$quantity = $this->getTotalQuantity($key);
if ($quantity < 1) {
unset($this->cartSession[$key]);
}
}
return array_keys($this->cartSession);
}
}

/**
* カートに設定された現在のキー(商品種別ID)を登録する.
*
* @param integer $key 商品種別ID
* @return void
*/
function registerKey($key) {
$_SESSION['cartKey'] = $key;
}

/**
* カートに設定された現在のキー(商品種別ID)を削除する.
*
* @return void
*/
function unsetKey() {
unset($_SESSION['cartKey']);
}

/**
* カートに設定された現在のキー(商品種別ID)を取得する.
*
* @return integer 商品種別ID
*/
function getKey() {
return $_SESSION['cartKey'];
}

/**
* 複数配送扱いかどうか.
*
* @return boolean カートが複数配送扱いの場合 true
*/
function isMultiple() {
return count($this->getKeys()) > 1;
}

/**
* 引数の商品種別の商品がカートに含まれるかどうか.
*
* @param integer $product_type_id 商品種別ID
* @return boolean 指定の商品種別がカートに含まれる場合 true
*/
function hasProductType($product_type_id) {
return in_array($product_type_id, $this->getKeys());
}
}
?>
ken-o
投稿日時: 2012/4/5 13:45
対応状況: −−−
長老
登録日: 2011/9/22
居住地:
投稿: 222
Re: 2.11.4 ポイントについての変更
ただいま、確認しておりますが、純粋に上記ソースをdreamweaverにコピペしても何もエラー表記はでませんでした。

ということは、{}の数は少なくともあっていると思います。


私の環境が2.11.2なので、どのようなエラーが出ていますか?

調べていて思ったのですが、#calculateの{}の個数が足りていないように思えます。全体の{}の個数はあっているのでしょうが、#calculateに関しては、}で閉じられていないような気がするのですが…
気のせいかな?

取り急ぎご報告

-------------------------------------------------
追記、
ただいま、2.11.4をダウンロードして、僕のほうで本案件を実装してみました。
phpの全文を記載しますので、コピペしてみてください。

念のため、バックアップを取ってから行ってください。
おすすめ方法は、以下の記述を新しくSC_CartSession.phpとして保存して、既存のものを一度ローカルにバックアップしてあげると何かあった時にすぐに戻せると思います。


<?php
/*
 * This file is part of EC-CUBE
 *
 * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
 *
 * http://www.lockon.co.jp/
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

/**
 * カートセッション管理クラス
 *
 * @author LOCKON CO.,LTD.
 * @version $Id: SC_CartSession.php 21296 2011-10-22 14:44:09Z Seasoft $
 */
class SC_CartSession {
    /** ユニークIDを指定する. */
    var $key_tmp;

    /** カートのセッション変数. */
    var $cartSession;

    /* コンストラクタ */
    function SC_CartSession($cartKey = 'cart') {
        if (!isset($_SESSION[$cartKey])) {
            $_SESSION[$cartKey] = array();
        }
        $this->cartSession =& $_SESSION[$cartKey];
    }

    // 商品購入処理中のロック
    function saveCurrentCart($key_tmp, $productTypeId) {
        $this->key_tmp = "savecart_" . $key_tmp;
        // すでに情報がなければ現状のカート情報を記録しておく
        if(count($_SESSION[$this->key_tmp]) == 0) {
            $_SESSION[$this->key_tmp] = $this->cartSession[$productTypeId];
        }
        // 1世代古いコピー情報は、削除しておく
        foreach($_SESSION as $k => $val) {
            if($k != $this->key_tmp && preg_match("/^savecart_/", $k)) {
                unset($this->cartSession[$productTypeId][$k]);
            }
        }
    }

    // 商品購入中の変更があったかをチェックする。
    function getCancelPurchase($productTypeId) {
        $ret = isset($this->cartSession[$productTypeId]['cancel_purchase'])
            ? $this->cartSession[$productTypeId]['cancel_purchase'] : "";
        $this->cartSession[$productTypeId]['cancel_purchase'] = false;
        return $ret;
    }

    // 購入処理中に商品に変更がなかったかを判定
    function checkChangeCart($productTypeId) {
        $change = false;
        $max = $this->getMax($productTypeId);
        for($i = 1; $i <= $max; $i++) {
            if ($this->cartSession[$productTypeId][$i]['quantity']
                != $_SESSION[$this->key_tmp][$i]['quantity']) {

                $change = true;
                break;
            }
            if ($this->cartSession[$productTypeId][$i]['id']
                != $_SESSION[$this->key_tmp][$i]['id']) {

                $change = true;
                break;
            }
        }
        if ($change) {
            // 一時カートのクリア
            unset($_SESSION[$this->key_tmp]);
            $this->cartSession[$productTypeId][$key]['cancel_purchase'] = true;
        } else {
            $this->cartSession[$productTypeId]['cancel_purchase'] = false;
        }
        return $this->cartSession[$productTypeId]['cancel_purchase'];
    }

    // 次に割り当てるカートのIDを取得する
    function getNextCartID($productTypeId) {
        foreach($this->cartSession[$productTypeId] as $key => $val){
            $arrRet[] = $this->cartSession[$productTypeId][$key]['cart_no'];
        }
        return max($arrRet) + 1;
    }

    /**
     * 商品ごとの合計価格
     * XXX 実際には、「商品」ではなく、「カートの明細行(?商品規格)」のような気がします。
     *
     * @param integer $id
     * @return string 商品ごとの合計価格(税込み)
     * @deprecated SC_CartSession::getCartList() を使用してください
     */
    function getProductTotal($id, $productTypeId) {
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            if(isset($this->cartSession[$productTypeId][$i]['id'])
               && $this->cartSession[$productTypeId][$i]['id'] == $id) {

                // 税込み合計
                $price = $this->cartSession[$productTypeId][$i]['price'];
                $quantity = $this->cartSession[$productTypeId][$i]['quantity'];
                $incTax = SC_Helper_DB_Ex::sfCalcIncTax($price);
                $total = $incTax * $quantity;
                return $total;
            }
        }
        return 0;
    }

    // 値のセット
    function setProductValue($id, $key, $val, $productTypeId) {
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            if(isset($this->cartSession[$productTypeId][$i]['id'])
               && $this->cartSession[$productTypeId][$i]['id'] == $id) {
                $this->cartSession[$productTypeId][$i][$key] = $val;
            }
        }
    }

    // カート内商品の最大要素番号を取得する。
    function getMax($productTypeId) {
        $max = 0;
        if (count($this->cartSession[$productTypeId]) > 0){
            foreach($this->cartSession[$productTypeId] as $key => $val) {
                if (is_numeric($key)) {
                    if($max < $key) {
                        $max = $key;
                    }
                }
            }
        }
        return $max;
    }

    // カート内商品数量の合計
    function getTotalQuantity($productTypeId) {
        $total = 0;
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            $total+= $this->cartSession[$productTypeId][$i]['quantity'];
        }
        return $total;
    }

    // 全商品の合計価格
    function getAllProductsTotal($productTypeId) {
        // 税込み合計
        $total = 0;
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {

            if (!isset($this->cartSession[$productTypeId][$i]['price'])) {
                $this->cartSession[$productTypeId][$i]['price'] = "";
            }

            $price = $this->cartSession[$productTypeId][$i]['price'];

            if (!isset($this->cartSession[$productTypeId][$i]['quantity'])) {
                $this->cartSession[$productTypeId][$i]['quantity'] = "";
            }
            $quantity = $this->cartSession[$productTypeId][$i]['quantity'];

            $incTax = SC_Helper_DB_Ex::sfCalcIncTax($price);
            $total+= ($incTax * $quantity);
        }
        return $total;
    }

    // 全商品の合計税金
    function getAllProductsTax($productTypeId) {
        // 税合計
        $total = 0;
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            $price = $this->cartSession[$productTypeId][$i]['price'];
            $quantity = $this->cartSession[$productTypeId][$i]['quantity'];
            $tax = SC_Helper_DB_Ex::sfTax($price);
            $total+= ($tax * $quantity);
        }
        return $total;
    }

    // 全商品の合計ポイント
    function getAllProductsPoint($productTypeId) {
        // ポイント合計
        $total = 0;
        if (USE_POINT !== false) {
            $max = $this->getMax($productTypeId);
            for($i = 0; $i <= $max; $i++) {
                $price = $this->cartSession[$productTypeId][$i]['price'];
                $quantity = $this->cartSession[$productTypeId][$i]['quantity'];

                if (!isset($this->cartSession[$productTypeId][$i]['point_rate'])) {
                    $this->cartSession[$productTypeId][$i]['point_rate'] = "";
                }
                $point_rate = $this->cartSession[$productTypeId][$i]['point_rate'];

                if (!isset($this->cartSession[$productTypeId][$i]['id'][0])) {
                    $this->cartSession[$productTypeId][$i]['id'][0] = "";
                }
                $point = SC_Utils_Ex::sfPrePoint($price, $point_rate);
                $total+= ($point * $quantity);
            }
        }
        return $total;
    }

    // カートへの商品追加
    function addProduct($product_class_id, $quantity) {
        $objProduct = new SC_Product_Ex();
        $arrProduct = $objProduct->getProductsClass($product_class_id);
        $productTypeId = $arrProduct['product_type_id'];
        $find = false;
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {

            if($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) {
                $val = $this->cartSession[$productTypeId][$i]['quantity'] + $quantity;
                if(strlen($val) <= INT_LEN) {
                    $this->cartSession[$productTypeId][$i]['quantity'] += $quantity;
                }
                $find = true;
            }
        }
        if(!$find) {
            $this->cartSession[$productTypeId][$max+1]['id'] = $product_class_id;
            $this->cartSession[$productTypeId][$max+1]['quantity'] = $quantity;
            $this->cartSession[$productTypeId][$max+1]['cart_no'] = $this->getNextCartID($productTypeId);
        }
    }

    // 前頁のURLを記録しておく
    function setPrevURL($url, $excludePaths = array()) {
        // 前頁として記録しないページを指定する。
        $arrExclude = array(
            "/shopping/"
        );
        $arrExclude = array_merge($arrExclude, $excludePaths);
        $exclude = false;
        // ページチェックを行う。
        foreach($arrExclude as $val) {
            if(preg_match("|" . preg_quote($val) . "|", $url)) {
                $exclude = true;
                break;
            }
        }
        // 除外ページでない場合は、前頁として記録する。
        if(!$exclude) {
            $_SESSION['prev_url'] = $url;
        }
    }

    // 前頁のURLを取得する
    function getPrevURL() {
        return isset($_SESSION['prev_url']) ? $_SESSION['prev_url'] : "";
    }

    // キーが一致した商品の削除
    function delProductKey($keyname, $val, $productTypeId) {
        $max = count($this->cartSession[$productTypeId]);
        for($i = 0; $i < $max; $i++) {
            if($this->cartSession[$productTypeId][$i][$keyname] == $val) {
                unset($this->cartSession[$productTypeId][$i]);
            }
        }
    }

    function setValue($key, $val, $productTypeId) {
        $this->cartSession[$productTypeId][$key] = $val;
    }

    function getValue($key, $productTypeId) {
        return $this->cartSession[$productTypeId][$key];
    }

    /**
     * セッション中の商品情報データの調整。
     * productsClass項目から、不必要な項目を削除する。
     */
    function adjustSessionProductsClass(&$arrProductsClass) {
        $arrNecessaryItems = array(
            'product_id'          => true,
            'product_class_id'    => true,
            'name'                => true,
            'price02'             => true,
            'point_rate'          => true,
            'main_list_image'     => true,
            'main_image'          => true,
            'product_code'        => true,
            'stock'               => true,
            'stock_unlimited'     => true,
            'sale_limit'          => true,
            'class_name1'         => true,
            'classcategory_name1' => true,
            'class_name2'         => true,
            'classcategory_name2' => true,
        );

        // 必要な項目以外を削除。
        foreach (array_keys($arrProductsClass) as $key) {
            if (!isset($arrNecessaryItems[$key])) {
                unset($arrProductsClass[$key]);
            }
        }
    }

    /**
     * 商品種別ごとにカート内商品の一覧を取得する.
     *
     * @param integer $productTypeId 商品種別ID
     * @return array カート内商品一覧の配列
     */
    function getCartList($productTypeId) {
        $objProduct = new SC_Product_Ex();
        $max = $this->getMax($productTypeId);
        $arrRet = array();
        for($i = 0; $i <= $max; $i++) {
            if(isset($this->cartSession[$productTypeId][$i]['cart_no'])
               && $this->cartSession[$productTypeId][$i]['cart_no'] != "") {

                // 商品情報は常に取得
                $this->cartSession[$productTypeId][$i]['productsClass']
                    =& $objProduct->getDetailAndProductsClass($this->cartSession[$productTypeId][$i]['id']);

                $price = $this->cartSession[$productTypeId][$i]['productsClass']['price02'];
                $this->cartSession[$productTypeId][$i]['price'] = $price;

                $this->cartSession[$productTypeId][$i]['point_rate'] =
                    $this->cartSession[$productTypeId][$i]['productsClass']['point_rate'];

                $quantity = $this->cartSession[$productTypeId][$i]['quantity'];
                $incTax = SC_Helper_DB_Ex::sfCalcIncTax($price);
                $total = $incTax * $quantity;

                $this->cartSession[$productTypeId][$i]['total_inctax'] = $total;

                $arrRet[] = $this->cartSession[$productTypeId][$i];

                // セッション変数のデータ量を抑制するため、一部の商品情報を切り捨てる
                // XXX 上で「常に取得」するのだから、丸ごと切り捨てて良さそうにも感じる。
                $this->adjustSessionProductsClass($this->cartSession[$productTypeId][$i]['productsClass']);
            }
        }
        return $arrRet;
    }

    /**
     * すべてのカートの内容を取得する.
     *
     * @return array すべてのカートの内容
     */
    function getAllCartList() {
        $results = array();
        $cartKeys = $this->getKeys();
        $i = 0;
        foreach ($cartKeys as $key) {
            $cartItems = $this->getCartList($key);
            foreach (array_keys($cartItems) as $itemKey) {
                $cartItem =& $cartItems[$itemKey];
                $results[$key][$i] =& $cartItem;
                $i++;
            }
        }
        return $results;
    }

    // カート内にある商品IDを全て取得する
    /**
     * @deprected getAllProductClassID を使用して下さい
     */
    function getAllProductID($productTypeId) {
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            if($this->cartSession[$productTypeId][$i]['cart_no'] != "") {
                $arrRet[] = $this->cartSession[$productTypeId][$i]['id'][0];
            }
        }
        return $arrRet;
    }

    /**
     * カート内にある商品規格IDを全て取得する.
     *
     * @param integer $productTypeId 商品種別ID
     * @return array 商品規格ID の配列
     */
    function getAllProductClassID($productTypeId) {
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            if($this->cartSession[$productTypeId][$i]['cart_no'] != "") {
                $arrRet[] = $this->cartSession[$productTypeId][$i]['id'];
            }
        }
        return $arrRet;
    }

    /**
     * 商品種別ID を指定して, カート内の商品をすべて削除する.
     *
     * @param integer $productTypeId 商品種別ID
     * @return void
     */
    function delAllProducts($productTypeId) {
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            unset($this->cartSession[$productTypeId][$i]);
        }
    }

    // 商品の削除
    function delProduct($cart_no, $productTypeId) {
        $max = $this->getMax($productTypeId);
        for($i = 0; $i <= $max; $i++) {
            if($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
                unset($this->cartSession[$productTypeId][$i]);
            }
        }
    }

    // 数量の増加
    function upQuantity($cart_no, $productTypeId) {
        $quantity = $this->getQuantity($cart_no, $productTypeId);
        if (strlen($quantity + 1) <= INT_LEN) {
            $this->setQuantity($quantity + 1, $cart_no, $productTypeId);
        }
    }

    // 数量の減少
    function downQuantity($cart_no, $productTypeId) {
        $quantity = $this->getQuantity($cart_no, $productTypeId);
        if ($quantity > 1) {
            $this->setQuantity($quantity - 1, $cart_no, $productTypeId);
        }
    }

    /**
     * カート番号と商品種別IDを指定して, 数量を取得する.
     *
     * @param integer $cart_no カート番号
     * @param integer $productTypeId 商品種別ID
     * @return integer 該当商品規格の数量
     */
    function getQuantity($cart_no, $productTypeId) {
        $max = $this->getMax($productTypeId);
        for ($i = 0; $i <= $max; $i++) {
            if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
                return $this->cartSession[$productTypeId][$i]['quantity'];
            }
        }
    }

    /**
     * カート番号と商品種別IDを指定して, 数量を設定する.
     *
     * @param integer $quantity 設定する数量
     * @param integer $cart_no カート番号
     * @param integer $productTypeId 商品種別ID
     * @retrun void
     */
    function setQuantity($quantity, $cart_no, $productTypeId) {
        $max = $this->getMax($productTypeId);
        for ($i = 0; $i <= $max; $i++) {
            if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
                $this->cartSession[$productTypeId][$i]['quantity'] = $quantity;
            }
        }
    }

    /**
     * カート番号と商品種別IDを指定して, 商品規格IDを取得する.
     *
     * @param integer $cart_no カート番号
     * @param integer $productTypeId 商品種別ID
     * @return integer 商品規格ID
     */
    function getProductClassId($cart_no, $productTypeId) {
        for ($i = 0; $i <= $max; $i++) {
            if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {
                return $this->cartSession[$productTypeId][$i]['id'];
            }
        }
    }

    /**
     * カート内の商品の妥当性をチェックする.
     *
     * エラーが発生した場合は, 商品をカート内から削除又は数量を調整し,
     * エラーメッセージを返す.
     *
     * 1. 商品種別に関連づけられた配送業者の存在チェック
     * 2. 削除/非表示商品のチェック
     * 3. 商品購入制限数のチェック
     * 4. 在庫数チェック
     *
     * @param string $key 商品種別ID
     * @return string エラーが発生した場合はエラーメッセージ
     */
    function checkProducts($productTypeId) {
        $objProduct = new SC_Product_Ex();
        $tpl_message = "";

        // カート内の情報を取得
        $items = $this->getCartList($productTypeId);
        foreach (array_keys($items) as $key) {
            $item =& $items[$key];
            $product =& $item['productsClass'];
            /*
             * 表示/非表示商品のチェック
             */
            if (SC_Utils_Ex::isBlank($product)) {
                $this->delProduct($item['cart_no'], $productTypeId);
                $tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n";
            } else {

                /*
                 * 配送業者のチェック
                 */
                $arrDeliv = SC_Helper_Purchase_Ex::getDeliv($productTypeId);
                if (SC_Utils_Ex::isBlank($arrDeliv)) {
                    $tpl_message .= "※「" . $product['name'] . "」はまだ配送の準備ができておりません。恐れ入りますがお問い合わせページよりお問い合わせください。\n";
                    $this->delProduct($item['cart_no'], $productTypeId);
                }

                /*
                 * 商品購入制限数, 在庫数のチェック
                 */
                $limit = $objProduct->getBuyLimit($product);
                if (!is_null($limit) && $item['quantity'] > $limit) {
                    if ($limit > 0) {
                        $this->setProductValue($item['id'], 'quantity', $limit, $productTypeId);
                        $this->setProductValue($item['id'], 'total_inctax', SC_Helper_DB_Ex::sfCalcIncTax($item['price']) * $limit, $productTypeId);
                        $tpl_message .= "※「" . $product['name'] . "」は販売制限(または在庫が不足)しております。一度に数量{$limit}以上の購入はできません。\n";
                    } else {
                        $this->delProduct($item['cart_no'], $productTypeId);
                        $tpl_message .= "※「" . $product['name'] . "」は売り切れました。\n";
                        continue;
                    }
                }
            }
        }
        return $tpl_message;
    }

    /**
     * 送料無料条件を満たすかどうかチェックする
     *
     * @param integer $productTypeId 商品種別ID
     * @return boolean 送料無料の場合 true
     */
    function isDelivFree($productTypeId) {
        $objDb = new SC_Helper_DB_Ex();

        $subtotal = $this->getAllProductsTotal($productTypeId);

        // 送料無料の購入数が設定されている場合
        if (DELIV_FREE_AMOUNT > 0) {
            // 商品の合計数量
            $total_quantity = $this->getTotalQuantity($productTypeId);

            if($total_quantity >= DELIV_FREE_AMOUNT) {
                return true;
            }
        }

        // 送料無料条件が設定されている場合
        $arrInfo = $objDb->sfGetBasisData();
        if ($arrInfo['free_rule'] > 0) {
            // 小計が無料条件を超えている場合
            if($subtotal >= $arrInfo['free_rule']) {
                return true;
            }
        }

        return false;
    }

    /**
     * カートの内容を計算する.
     *
     * カートの内容を計算し, 下記のキーを保持する連想配列を返す.
     *
     * - tax: 税額
     * - subtotal: カート内商品の小計
     * - deliv_fee: カート内商品の合計送料
     * - total: 合計金額
     * - payment_total: お支払い合計
     * - add_point: 加算ポイント
     *
     * @param integer $productTypeId 商品種別ID
     * @param SC_Customer $objCustomer ログイン中の SC_Customer インスタンス
     * @param integer $use_point 今回使用ポイント
     * @param integer|array $deliv_pref 配送先都道府県ID.
                                        複数に配送する場合は都道府県IDの配列
     * @param integer $charge 手数料
     * @param integer $discount 値引
     * @param integer $deliv_id 配送業者ID
     * @return array カートの計算結果の配列
     */
    function calculate($productTypeId, &$objCustomer, $use_point = 0,
                       $deliv_pref = "", $charge = 0, $discount = 0, $deliv_id = 0) {
        $objDb = new SC_Helper_DB_Ex();

        $total_point = $this->getAllProductsPoint($productTypeId);
        $results['tax'] = $this->getAllProductsTax($productTypeId);
        $results['subtotal'] = $this->getAllProductsTotal($productTypeId);
        $results['deliv_fee'] = 0;

        // 商品ごとの送料を加算
        if (OPTION_PRODUCT_DELIV_FEE == 1) {
            $cartItems = $this->getCartList($productTypeId);
            foreach ($cartItems as $item) {
                $results['deliv_fee'] += $item['productsClass']['deliv_fee'] * $item['quantity'];
            }
        }

        // 配送業者の送料を加算
        if (OPTION_DELIV_FEE == 1
            && !SC_Utils_Ex::isBlank($deliv_pref)
            && !SC_Utils_Ex::isBlank($deliv_id)) {
            $results['deliv_fee'] += $objDb->sfGetDelivFee($deliv_pref, $deliv_id);
        }

        // 送料無料チェック
        if ($this->isDelivFree($productTypeId)) {
            $results['deliv_fee'] = 0;
        }

        // 合計を計算
        $results['total'] = $results['subtotal'];
        $results['total'] += $results['deliv_fee'];
        $results['total'] += $charge;
        $results['total'] -= $discount;

        // お支払い合計
        $results['payment_total'] = $results['total'] - $use_point * POINT_VALUE;

		if($use_point > 0){ //改造
			$results['add_point'] = 0;
			return $results;		
		}else{
        // 加算ポイントの計算
        if (USE_POINT !== false) {
            $results['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($total_point,
                                                                   $use_point);
            if($objCustomer != "") {
                // 誕生日月であった場合
                if($objCustomer->isBirthMonth()) {
                    $results['birth_point'] = BIRTH_MONTH_POINT;
                    $results['add_point'] += $results['birth_point'];
                }
            }
            if($results['add_point'] < 0) {
                $results['add_point'] = 0;
            }
        }
        return $results;
		} //改造
    }

    /**
     * カートが保持するキー(商品種別ID)を配列で返す.
     *
     * @return array 商品種別IDの配列
     */
    function getKeys() {
        $keys = array_keys($this->cartSession);
        // 数量が 0 の商品種別は削除する
        foreach ($keys as $key) {
            $quantity = $this->getTotalQuantity($key);
            if ($quantity < 1) {
                unset($this->cartSession[$key]);
            }
        }
        return array_keys($this->cartSession);
    }

    /**
     * カートに設定された現在のキー(商品種別ID)を登録する.
     *
     * @param integer $key 商品種別ID
     * @return void
     */
    function registerKey($key) {
        $_SESSION['cartKey'] = $key;
    }

    /**
     * カートに設定された現在のキー(商品種別ID)を削除する.
     *
     * @return void
     */
    function unsetKey() {
        unset($_SESSION['cartKey']);
    }

    /**
     * カートに設定された現在のキー(商品種別ID)を取得する.
     *
     * @return integer 商品種別ID
     */
    function getKey() {
        return $_SESSION['cartKey'];
    }

    /**
     * 複数配送扱いかどうか.
     *
     * @return boolean カートが複数配送扱いの場合 true
     */
    function isMultiple() {
        return count($this->getKeys()) > 1;
    }

    /**
     * 引数の商品種別の商品がカートに含まれるかどうか.
     *
     * @param integer $product_type_id 商品種別ID
     * @return boolean 指定の商品種別がカートに含まれる場合 true
     */
    function hasProductType($product_type_id) {
        return in_array($product_type_id, $this->getKeys());
    }
}
?>


----------------
何分知識が浅いですが・・・
出来得る限り協力したいと思っています

akki31
投稿日時: 2012/4/9 12:53
対応状況: 解決済
常連
登録日: 2011/6/7
居住地:
投稿: 59
Re: 2.11.4 ポイントについての変更
ken-o様

こんにちは。
いつもお世話になっております。


上記実装してみたところ無事に解決することができました。

何度も試行錯誤して頂き、結果導入できましたので
ご報告とお礼を申し上げます。

ありがとうございました!
今後とも宜しくお願い致します。
« 1 (2)
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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

統計情報

総メンバー数は89,041名です
総投稿数は110,020件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1296
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.