バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > 商品情報取得の項目追加について

フロント機能

新規スレッドを追加する

スレッド表示 | 古いものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
gk60win
投稿日時: 2013/12/17 1:05
対応状況: −−−
新米
登録日: 2013/12/8
居住地:
投稿: 3
Re: 商品情報取得の項目追加について
ご返信遅くなりすみません。私事ですがその他開店準備が忙しくPGがなかなかできておりません。

上記アドバイス頂いたとおり対応してみましたが、上手く取得してこれませんでした。

参考書Sampleでは、LC_Page_Shopping_Confirm.phpにて、
getCartListを使用して、(cool_flgを含む)商品情報を取得
してきているようなのですが、どうもそこが上手く取得できていないようです。。
何かアドバイスございましたら、よろしくお願い申し上げます。


// カートの商品を取得
$this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);

$this->arrCartItems = $objCartSess->getCartList($this->cartKey);

// 冷凍・冷蔵便料金計算
$cool_fee = $this->lfGetCoolFee($this->is_multiple, $objQuery, $this->arrCartItems, $this->arrShipping);

〰中略〰

/**
* 冷凍・冷蔵便の料金を商品情報り抽出し料金を返す
*
* @param $is_multiple 複数配送かどうか
* @param $objQuery
* @param $arrCartItems 商品情報
* @param $arrShipping 商品情報
* @return integer 料金
*/
function lfGetCoolFee($is_multiple, &$objQuery, $arrCartItems, $arrShipping){
$arrStatusId = array();
$cool_fee = 0;
if ($is_multiple) {
foreach ($arrShipping as $product) {
$arrCoolFlg = array();
foreach ($product["shipment_item"] as $value) {
$arrCoolFlg[] = $value["productsClass"]["cool_flg"];
}
$arrCoolFlg = array_unique($arrCoolFlg);
foreach ($arrCoolFlg as $cool_flg) {
$cool_fee += $this->arrCoolFee[$cool_flg];
}
}
} else {

$arrCoolFlg = array();
foreach ($arrCartItems as $value) {
$arrCoolFlg[] = $value["productsClass"]["cool_flg"];
}
$arrCoolFlg = array_unique($arrCoolFlg);

foreach ($arrCoolFlg as $cool_flg) {
$cool_fee += $this->arrCoolFee[$cool_flg];
}
}

return $cool_fee;
}
}


■getcartlistは、SC_CartSession.phpにあります。

/**
* 商品種別ごとにカート内商品の一覧を取得する.
*
* @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'] != '') {

// 商品情報は常に取得
// TODO 同一インスタンス内では1回のみ呼ぶようにしたい
$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;
}
sumida
投稿日時: 2013/12/9 11:07
対応状況: −−−
仙人
登録日: 2013/2/10
居住地: 広島県呉市ときどき瀬戸内海
投稿: 641
Re: 商品情報取得の項目追加について
SC_CartSession.php

    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'] != '') {

                // 商品情報は常に取得
                // TODO 同一インスタンス内では1回のみ呼ぶようにしたい
                $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;
    }

で、cool_flgを$this->cartSession[$productTypeId][$i]['cool_flg']に設定してみては。
gk60win
投稿日時: 2013/12/9 0:48
対応状況: −−−
新米
登録日: 2013/12/8
居住地:
投稿: 3
Re: 商品情報取得の項目追加について
sumida さま

ご連絡ありがとうございます。
adjustSessionProductsClass に追記してみましたが、
取得できませんでした。。

LC_Page_Shopping_Confirm.phpで、
$this->arrCartItems = $objCartSess->getCartList($this->cartKey);

として商品情報を取得したときに、
追加したcool_flgを取得できていないようで、、
$arrCoolFlg[] = $value["productsClass"]["cool_flg"];としても、値がでないようです。



sumida
投稿日時: 2013/12/8 21:18
対応状況: −−−
仙人
登録日: 2013/2/10
居住地: 広島県呉市ときどき瀬戸内海
投稿: 641
Re: 商品情報取得の項目追加について
(v2.12.6のソースからの)あてずっぽうですが、
SC_CartSession.php

    /**
     * セッション中の商品情報データの調整。
     * productsClass項目から、不必要な項目を削除する。
     */
    public 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 ($arrProductsClass as $key => $value) {
            if (!isset($arrNecessaryItems[$key])) {
                unset($arrProductsClass[$key]);
            }
        }
    }

ここに、cool_flgを追加?
gk60win
投稿日時: 2013/12/8 19:43
対応状況: −−−
新米
登録日: 2013/12/8
居住地:
投稿: 3
商品情報取得の項目追加について
お世話になります。

ver2.12.3にて、クール便対応のため、公式ガイドブックを参考に、
商品情報テーブル dtb_productsへ、cool_flgという項目を追加しました。
(マスタテーブルmtb_cool_flgを作成して、冷蔵、クール時それぞれの追加料金マスタを保持するようにも対応しました)


LC_Page_Shopping_Confirm.phpにて、同項目の値を取得して、
クール料金を加算したいのですが、
$value["productsClass"]["cool_flg"] としても、
NULLが返ってきてしまいます。

(SC_CartSession.phpの「商品詳細の SQL を取得する」function alldtlSQLのSELECT句へも同項目を追加していますが、
なぜか取得できてきません・・・)

何方かお詳しい方、お助けください。
よろしくお願い申し上げます。
スレッド表示 | 古いものから 前のトピック | 次のトピック | トップ


 



ログイン


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

統計情報

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

投稿数ランキング

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