開発メモ

開発用のメモです。

EC CUBE マスターデータの追加

<?php
    $masterData = new SC_DB_MasterData_Ex ( );
    // マスターデータを更新
    $objQuery = &SC_Query_Ex :: getSingletonInstance ( );
    $objQuery -> begin ( );
    $objQuery -> insert ( "mtb_customer_status" , array (
        "id" => "3" ,
        "name" => "本会員(学生)" ,
        "rank" => "3"
    ) );
    $objQuery -> insert ( "mtb_constants" , array (
        "id" => "CUSTOMER_STUDENT" ,
        "name" => "3" ,
        "remarks" => "本会員(学生)" ,
    ) , array ( "rank" => "(SELECT max(rank)+1 FROM mtb_constants)" , ) );
    $objQuery -> commit ( );
    // mtb_customer_status
    $masterData -> clearCache ( "mtb_customer_status" );
    $masterData -> createCache ( 'mtb_customer_status' );
    // mtb_constants
    $masterData -> clearCache ( "mtb_constants" );
    $masterData -> createCache ( 'mtb_constants' , array ( ) , true , array (
        'id' ,
        'remarks'
    ) );
Twitter: @asahina_alice