2026, 새로운 도약을 시작합니다.

db 연동 문의 채택완료

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

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

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

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

답변 1개

채택된 답변
+20 포인트

/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;

    }

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

Copy
    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 을 지정해 주시면 됩니다. 

Copy
 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;    }} 
로그인 후 평가할 수 있습니다

답변에 대한 댓글 3개

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

item_qa 조인 item 조인 post 조인

이렇게 데이터를 불러오기 때문에,

post 테이블에 해당 데이터가 없으면 아무것도 안나옵니다...
감사합니다! 하나만 더 여쭤봐도 될까요?
상품 목록화면에서
처음에 갤러리 형식으로 뜨는데,
애초에 리스트 형식으로 뜨게 할 수 없을까요?

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고