EC-CUBE ログイン時に前回ログイン時のカート情報を読み込む
※参考にしないで!
とりあえずデバッグは下記コード。
data/logs/site.logに出力される。
GC_Utils_Ex::gfDebugLog('xxx');
1)ユーザー情報(dtb_customer)にフィールド追加
dtb_customerカートセッション情報を追加できるフィールドを追加
session_cart (longtext )
2)カート追加時にsession_cartにカート情報を追加
SC_CartSession_Ex.php
private function addUserSession() { if (isset($_SESSION['customer']['customer_id'])) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $sqlval = array('session_cart' => serialize($this->cartSession)); $where = 'customer_id = ? AND del_flg = 0'; $objQuery->update('dtb_customer', $sqlval, $where, array($_SESSION['customer']['customer_id'])); $objCustomer = new SC_Customer(); $objCustomer->setValue('session_cart', $this->cartSession); } }
3)会員ログイン時にカート情報をセッションに追加
LC_Page_FrontParts_LoginCheck_Ex.php
$_SESSION['cart'] = unserialize($_SESSION['customer']['session_cart']);