バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > 外部サイトよりpostして、カートセッションに情報を渡したい

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
ndamon
投稿日時: 2015/3/12 11:51
対応状況: −−−
半人前
登録日: 2013/11/29
居住地:
投稿: 21
Re: 外部サイトよりpostして、カートセッションに情報を渡したい
お世話になります。
無事解決に至りましたので、ご報告いたします。
yuh様ありがとうございました。

次に悩まれる方のためにコードを記述しておきます。

LC_Page_Products_List_Ex.php

    function OutPostSet(){ 
        if($_POST['name']){
            $_SESSION['outpost']['namae'] = htmlentities($_POST['namae'], ENT_QUOTES, mb_internal_encoding());
        }
        if($_POST['day'] AND preg_match('/^[0-9]+$/',$_POST['day'])){
            $_SESSION['outpost']['day'] = $_POST['day'];
        }
        if($_POST['maker_name']){
            $_SESSION['outpost']['maker_name'] = htmlentities($_POST['maker_name'], ENT_QUOTES, mb_internal_encoding());
        }


SC_Helper_Session.php

		function isValidToken($is_unset = false) {
		// token の妥当性チェック
		//不正な移動になる場合の回避
		if ($_SERVER[HTTP_REFERER] == "http://hoge.com/test.html") {
		SC_Helper_Session_Ex::destroyToken();
		SC_Helper_Session_Ex::createToken();
		return true;
		}


SC_CartSession.php

    // カートへの商品追加
    public function addProduct($product_class_id, $quantity,$out1,$out2,$out3)
    {
        $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);
//追加
$this->cartSession[$productTypeId][$max+1]['namae'] = $out1;
$this->cartSession[$productTypeId][$max+1]['day'] = $out2;
$this->cartSession[$productTypeId][$max+1]['maker_name'] = $out3;
        }
    }

    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,
//追加
	'namae' => true,
	'day' => true,
	'maker_name' => true,
        );

    public function calculate($productTypeId, &$objCustomer, $use_point = 0,
        $deliv_pref = '', $charge = 0, $discount = 0, $deliv_id = 0,
        $order_pref = 0, $order_country_id = 0,$out1,$out2,$out3
    ) {

        $results = array();
$results['namae']=$out1;
$results['day']=$out2;
$results['maker_name']=$out3;


フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   外部サイトよりpostして、カートセッションに情報を渡したい ndamon 2015/3/4 15:13
     Re: 外部サイトよりpostして、カートセッションに情報を渡したい yuh 2015/3/4 15:57
       Re: 外部サイトよりpostして、カートセッションに情報を渡したい ndamon 2015/3/5 12:41
         Re: 外部サイトよりpostして、カートセッションに情報を渡したい yuh 2015/3/5 14:02
     Re: 外部サイトよりpostして、カートセッションに情報を渡したい ndamon 2015/3/5 18:32
     » Re: 外部サイトよりpostして、カートセッションに情報を渡したい ndamon 2015/3/12 11:51
         Re: 外部サイトよりpostして、カートセッションに情報を渡したい yuh 2015/3/12 11:56
           Re: 外部サイトよりpostして、カートセッションに情報を渡したい ndamon 2015/3/12 12:13

 



ログイン


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

統計情報

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

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1651
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.