테스트 사이트 - 개발 중인 베타 버전입니다

db 연동 문의 채택완료

티로1 9년 전 조회 5,313

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

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

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

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

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

답변 1개

채택된 답변
+20 포인트
thisgun
9년 전

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

    }

 

 

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

 

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

 

 

 

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

 

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

 

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

로그인 후 평가할 수 있습니다

답변에 대한 댓글 3개

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

item_qa 조인 item 조인 post 조인

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

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

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

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

로그인