db 연동 문의

db 연동 문의

QA

db 연동 문의

본문

현재 워드프레스 멀티사이트를 이용중인데,

각 멀티사이트별로 그누커머스 모든 db가 따로 되더라구요

하나로 통일시키고 싶은데,

어디를 건드려야 할까요~? 

이 질문에 댓글 쓰기 :

답변 1

/gnucommerce/lib/gc_board_var.class.php

 

에서 

 

이 항목을 찾아서

 

    public function get_table_array($tables=array()) {

        global $wpdb;

 

        $this->db_tables = $tables = wp_parse_args( $tables, array(

            'board_table' => $wpdb->prefix.'g5_board',

            'meta_table' => $wpdb->prefix.'g5_writemeta',

            'write_table' => $wpdb->prefix.'g5_write',

            'comment_table' => $wpdb->prefix.'g5_write_comment',

            'relation_table' => $wpdb->prefix.'g5_term_relationships',

            'taxonomy_table' => $wpdb->prefix.'g5_term_taxonomy',

            'point_table' => $wpdb->prefix.'g5_point',

            'scrap_table' => $wpdb->prefix.'g5_scrap',

            'board_good_table' => $wpdb->prefix.'g5_board_good',

        ));

 

        return $tables;

    }

 

 

아래와 같이 고쳐 주세요. ( 고친 부분은 다음 버젼에 업데이트 하겠습니다. )

 


    public function get_table_array($tables=array()) {
        global $wpdb;
 
        $board_table = apply_filters('gcboard_default_table', array(
            'board_table' => $wpdb->prefix.'g5_board',
            'meta_table' => $wpdb->prefix.'g5_writemeta',
            'write_table' => $wpdb->prefix.'g5_write',
            'comment_table' => $wpdb->prefix.'g5_write_comment',
            'relation_table' => $wpdb->prefix.'g5_term_relationships',
            'taxonomy_table' => $wpdb->prefix.'g5_term_taxonomy',
            'point_table' => $wpdb->prefix.'g5_point',
            'scrap_table' => $wpdb->prefix.'g5_scrap',
            'board_good_table' => $wpdb->prefix.'g5_board_good',
        ));
 
        $this->db_tables = $tables = wp_parse_args($tables, $board_table);
 
        return $tables;
    }

 

 

 

그리고 항상 실행되는 파일에서 아래와 같이 filter를 걸으시면 됩니다.

 

//prefix 변경 이라고 주석친 아래에 replace할 string 을 지정해 주시면 됩니다. 

 


 
add_filter('gc_default_table', 'gc_custom_set_table_names', 99);
 
if( !function_exists('gc_custom_set_table_names') ){
    function gc_custom_set_table_names($tables){    //쇼핑몰 테이블
        global $wpdb;
 
        $return_tables = array();
 
        foreach($tables as $key=>$name){
 
            //prefix 변경
            $return_tables[$key] = str_replace($wpdb->prefix, 'wp_', $name);
        }
        
        return $return_tables;
    }
}
 
add_filter('gcboard_default_table', 'gcboard_custom_table_names', 99);
 
if( !function_exists('gcboard_custom_table_names') ){
    function gcboard_custom_table_names($tables){    //게시판 테이블
        global $wpdb;
 
        $return_tables = array();
 
        foreach($tables as $key=>$name){
            
            //prefix 변경
            $return_tables[$key] = str_replace($wpdb->prefix, 'wp_', $name);
        }
        
        return $return_tables;
    }
}
 

wp_gc_shop_item_qa 테이블은 공유가 안되는 것 같아요 ㅠ
상품상세화면에서 상품문의 더보기 버튼을 클릭하면 mypage/?view=itemqalist
페이지에서 자료가 없습니다 라고 나옵니다 ㅠㅠ
분명히 상품문의 작성햇는데;

답변을 작성하시기 전에 로그인 해주세요.
전체 1,178
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT