開発メモ

開発用のメモです。

EC CUBE 会員情報を適宜アップデートを行う。

更新時間を確認し変更を確認

<?php

require_once CLASS_REALDIR . 'SC_Customer.php';

class SC_Customer_Ex extends SC_Customer {

    // セッション情報を最新の情報に更新する
    public function updateSession( ) {
        $sql = 'SELECT * FROM dtb_customer WHERE customer_id = ? AND del_flg = 0';
        $customer_id = $_SESSION[ 'customer' ][ "customer_id" ];
        $objQuery = &SC_Query_Ex::getSingletonInstance( );
        $arrRet = $objQuery->getAll( $sql, array( $customer_id ) );
        $this->customer_data = isset( $arrRet[ 0 ] ) ? $arrRet[ 0 ] : '';
        $_SESSION[ 'customer' ] = $this->customer_data;
    }

    // パラメーターの取得
    public function getValue( $keyname ) {
        $objQuery = &SC_Query_Ex::getSingletonInstance( );
        if( $objQuery->exists( "dtb_customer", "customer_id = ? AND del_flg = 0 update_date <> ?", array( $_SESSION[ 'customer' ][ "customer_id" ], $_SESSION[ 'customer' ][ "update_date" ], ) ) ) {

        } else {
            $this->updateSession( );
        }

        return isset( $_SESSION[ 'customer' ][ $keyname ] ) ? $_SESSION[ 'customer' ][ $keyname ] : '';
    }

}
Twitter: @asahina_alice