영카트 상품 더미 입력하기
쇼핑몰 제작할때 테스트 상품을 등록하는 용도입니다.
DummyJSON - Fake REST API of JSON data for development
위 사이트 이용해서 영카트 더미상품을 등록할 수 있습니다.
상품은 총 100개 입니다.
등록 후 카테고리는 알맞게 수정하세요.
굵은글자 표시 부분 필히 수정하세요.
<?php
include_once "./_common.php";
function GetJsonFeed($json_url)
{
$feed = file_get_contents($json_url);
return json_decode($feed, true);
}
$it_img_dir = G5_DATA_PATH . '/item';
//아래 100 숫자를 100이하로 수정하면 해당 개수만큼만 가져옵니다.
$res = GetJsonFeed('https://dummyjson.com/products?limit=100');
$count = count($res['products']);
for ($i = 0; $i < $count; $i++) {
//상품 id
$it_id = 2000000000 + $i;
$price = $res['products'][$i]['price'] * 1000;
$cust_price = $res['products'][$i]['price'] * 900;
//업로드 폴더 생성
if (!is_dir($it_img_dir . '/' . $it_id)) {
mkdir($it_img_dir . '/' . $it_id, G5_DIR_PERMISSION);
chmod($it_img_dir . '/' . $it_id, G5_DIR_PERMISSION);
}
//이미지파일 저장
$img_tag = '';
$attach_file = '';
for ($a = 0; $a < count($res['products'][$i]['images']); $a++) {
$imgfile = file_get_contents($res['products'][$i]['images'][$a]);
$name = basename($res['products'][$i]['images'][$a]);
//저장
file_put_contents($it_img_dir . '/' . $it_id . '/' . $name, $imgfile);
$attach_file .= "it_img" . ($a + 1) . " = '{$it_id}/{$name}',";
$img_tag .= "<p class='img-fluid'><img src='/data/item/{$it_id}/{$name}' class='goods-img'/></p>";
}
$img_tag = addslashes($img_tag);
$title = addslashes($res['products'][$i]['title']);
$brand = addslashes($res['products'][$i]['brand']);
$desc = addslashes($res['products'][$i]['description']);
$sql = " INSERT g5_shop_item
set it_id = '{$it_id}',
ca_id = '카테고리번호넣으세요 - 필수',
ca_id2 = '카테고리번호넣으세요-필요없으면 지우세요',
ca_id3 = '카테고리번호넣으세요-필요없으면 지우세요',
it_skin = 'theme/basic',
it_mobile_skin = 'theme/basic',
it_name = '{$title}',
it_maker = 'ASK-SEO',
it_origin = '한국',
it_brand = '{$brand}',
it_model = 'ASK-SEO',
it_option_subject = '',
it_supply_subject = '',
it_type1 = '1',
it_type2 = '1',
it_type3 = '1',
it_type4 = '1',
it_type5 = '1',
it_basic = '{$desc}',
it_explan = '<p>{$desc}</p>{$img_tag}',
it_mobile_explan = '',
it_cust_price = '{$price}',
it_price = '{$cust_price}',
it_point = '0.1',
it_point_type = '2',
it_supply_point = '0',
it_notax = '0',
it_sell_email = '',
it_use = '1',
it_nocoupon = '',
it_soldout = '',
it_stock_qty = '99999',
it_stock_sms = '',
it_noti_qty = '0',
it_sc_type = '0',
it_sc_method = '0',
it_sc_price = '0',
it_sc_minimum = '0',
it_sc_qty = '0',
it_buy_min_qty = '0',
it_buy_max_qty = '0',
it_head_html = '',
it_tail_html = '',
it_mobile_head_html = '',
it_mobile_tail_html = '',
it_ip = '111.111.111.111',
it_order = '0',
it_tel_inq = '',
it_info_gubun = 'wear',
it_info_value = 'a:8:{s:8:\"material\";s:22:\"상품페이지 참고\";s:5:\"color\";s:22:\"상품페이지 참고\";s:4:\"size\";s:22:\"상품페이지 참고\";s:5:\"maker\";s:22:\"상품페이지 참고\";s:7:\"caution\";s:22:\"상품페이지 참고\";s:16:\"manufacturing_ym\";s:22:\"상품페이지 참고\";s:8:\"warranty\";s:22:\"상품페이지 참고\";s:2:\"as\";s:22:\"상품페이지 참고\";}',
it_shop_memo = '',
ec_mall_pid = '',
{$attach_file}
it_1_subj = '',
it_2_subj = '',
it_3_subj = '',
it_4_subj = '',
it_5_subj = '',
it_6_subj = '',
it_7_subj = '',
it_8_subj = '',
it_9_subj = '',
it_10_subj = '',
it_1 = 'dummy',
it_2 = '',
it_3 = '',
it_4 = '',
it_5 = '',
it_6 = '',
it_7 = '',
it_8 = '',
it_9 = '',
it_10 = ''
, it_time = '" . G5_TIME_YMDHIS . "' , it_update_time = '" . G5_TIME_YMDHIS . "' ";
sql_query($sql, true);
echo "$it_id <br/>";
}
댓글 3개
게시판 목록
영카트5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 371 |
이로홀딩스
|
2년 전 | 1555 | |
| 370 |
페이투페이
|
2년 전 | 1557 | |
| 369 | 2년 전 | 1306 | ||
| 368 | 2년 전 | 1720 | ||
| 367 | 2년 전 | 2062 | ||
| 366 | 2년 전 | 2276 | ||
| 365 | 2년 전 | 2081 | ||
| 364 | 2년 전 | 1608 | ||
| 363 | 3년 전 | 1350 | ||
| 362 | 3년 전 | 3121 | ||
| 361 | 3년 전 | 1924 | ||
| 360 |
|
3년 전 | 2674 | |
| 359 | 3년 전 | 2431 | ||
| 358 | 3년 전 | 1591 | ||
| 357 |
welcome
|
3년 전 | 1321 | |
| 356 | 3년 전 | 1634 | ||
| 355 | 3년 전 | 1897 | ||
| 354 | 3년 전 | 1564 | ||
| 353 | 3년 전 | 1272 | ||
| 352 | 3년 전 | 1322 | ||
| 351 | 3년 전 | 1431 | ||
| 350 | 3년 전 | 2519 | ||
| 349 | 3년 전 | 1677 | ||
| 348 | 3년 전 | 3277 | ||
| 347 | 4년 전 | 4072 | ||
| 346 | 4년 전 | 2826 | ||
| 345 | 4년 전 | 4494 | ||
| 344 |
별지기천사
|
4년 전 | 3990 | |
| 343 | 4년 전 | 3413 | ||
| 342 | 4년 전 | 2029 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기