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

상품관리에서 상품일괄등록할 경우 질문이 있습니다 채택완료

namichoi 10년 전 조회 3,585

엑셀파일에서 상품일괄등록을 할 경우 상품코드를 필수로 써야 하는데

 

입력하지 않고 자동으로 넣는 방법이 있을까요??

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

답변 2개

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

상품코드는 영카트를 이용하시려면 반드시 넣으셔야 하는데.. 어떤 이유로 그러시는지 모르겠네요.

상품코드없이는 일괄등록을 하셔서 상품을 DB에 넣으셔도 의미가 없는데..

 

처리하는 방법은 실제 업로드된 엑셀파일을 읽어와 DB에 입력하는 프로세스를 처리하는 

/adm/shop_admin/itemexcelupdate.php 파일에서 아래 부분을 수정해주시면 됩니다.

</p><p>        if(!$it_id || !$ca_id || !$it_name) {</p><p>            $fail_count++;</p><p>            continue;</p><p>        }</p><p> </p><p>        // it_id 중복체크</p><p>        $sql2 = " select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";</p><p>        $row2 = sql_fetch($sql2);</p><p>        if($row2['cnt']) {</p><p>            $fail_it_id[] = $it_id;</p><p>            $dup_it_id[] = $it_id;</p><p>            $dup_count++;</p><p>            $fail_count++;</p><p>            continue;</p><p>        }</p><p><span style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">

 

위 코드를 아래처럼 it_id 를 체크하는 부분을 삭제 및 주석처리하는 형태로 바꿔보세요.

 

</span></p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        if(!$ca_id || !$it_name) { //<span style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">!$it_id ||</span><span style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;"> </span><span style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">​</span></p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;"> </p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            $fail_count++;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            continue;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        }</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;"> </p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        // it_id 중복체크</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        /*$sql2 = " select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        $row2 = sql_fetch($sql2);</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        if($row2['cnt']) {</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            $fail_it_id[] = $it_id;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            $dup_it_id[] = $it_id;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            $dup_count++;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            $fail_count++;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">            continue;</p><p style="font-size: 13.3333330154419px; line-height: 18.1818180084229px;">        }*/</p><p><span style="font-size: 10pt; line-height: 1.5;">

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

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

jinnychoi89
10년 전

답변 정말 감사합니다 :-)

 

근데 상품코드를 안 넣겠다는 것이 아니라 사용자의 편의를 위해

엑셀에서 굳이 입력하지 않아도 자동으로 값이 들어갈 수 있게 하는 방법을 알고 싶었던거였어서요 ^^;

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

답변에 대한 댓글 1개

카츠
10년 전
자동으로 넣으시려면 원소스는 그대로 두시고..
아래 코드 바로 윗부분에
[code]
if(!$it_id || !$ca_id || !$it_name) {
$fail_count++;
continue;
}
[/code]

아래 내용 넣어보세요.
[code]
if (!$it_id) {
$it_id = time();
sleep(1);
}
[/code]

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

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

로그인