구글 판매자센터 피드
- 이미지 img1~10 존재여부 확인 후 image_link 생성
This commit is contained in:
@ -30,33 +30,24 @@ $xml->addAttribute("version", "2.0");
|
|||||||
$channel = $xml->addChild("channel");
|
$channel = $xml->addChild("channel");
|
||||||
$title = $channel->addChild("title", "쇼핑몰피드");
|
$title = $channel->addChild("title", "쇼핑몰피드");
|
||||||
$link = $channel->addChild("link", G5_URL);
|
$link = $channel->addChild("link", G5_URL);
|
||||||
$description = $channel->addChild("description", "몰?루");
|
$description = $channel->addChild("description", "");
|
||||||
|
|
||||||
for ($i = 0; $row = sql_fetch_array($result); $i++ ) {
|
for ($i = 0; $row = sql_fetch_array($result); $i++ ) {
|
||||||
if(empty($row['it_id'])) continue;
|
$it_id = $row['it_id'];
|
||||||
if(empty($row['it_name'])) continue;
|
$it_title = $row['it_name'];
|
||||||
if(empty($row['it_img1'])) continue;
|
$it_link = shop_item_url($row['it_id']);
|
||||||
if(!file_exists(G5_DATA_PATH.'/item/'.$row['it_img1'])) continue;
|
$it_basic = strip_tags($row['it_basic']);
|
||||||
$ext = explode('.', $row['it_img1'])[1];
|
|
||||||
|
|
||||||
switch($ext) {
|
$it_image = "";
|
||||||
case "jpg":
|
for($i=1; $i<=10; $i++) {
|
||||||
case "jpeg":
|
$img = $row['it_img'.$i];
|
||||||
case "webp":
|
|
||||||
case "png":
|
if(empty($img)) continue;
|
||||||
case "gif":
|
|
||||||
case "bmp":
|
$it_image = G5_DATA_URL."/item/".$img;
|
||||||
case "tif":
|
break;
|
||||||
case "tiff":
|
|
||||||
$ext_check = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$ext_check = false;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ext_check == false) continue;
|
|
||||||
|
|
||||||
$stock = "in_stock";
|
$stock = "in_stock";
|
||||||
if($row['in_stock'] != null) {
|
if($row['in_stock'] != null) {
|
||||||
if($row['in_stock'] <= 0) $stock = "out_of_stock";
|
if($row['in_stock'] <= 0) $stock = "out_of_stock";
|
||||||
@ -64,11 +55,11 @@ for ($i = 0; $row = sql_fetch_array($result); $i++ ) {
|
|||||||
|
|
||||||
$item = $channel->addChild("item");
|
$item = $channel->addChild("item");
|
||||||
// 필수 입력 항목
|
// 필수 입력 항목
|
||||||
$item->addChild("g:g:id", $row['it_id']);
|
$item->addChild("g:g:id", $it_id);
|
||||||
$item->addChild("title", $row['it_name']);
|
$item->addChild("title", $it_title);
|
||||||
$item->addChild("description", strip_tags($row['it_basic']));
|
$item->addChild("description", $it_basic);
|
||||||
$item->addChild("link", G5_SHOP_URL.'/item.php?it_id='.urlencode($row['it_id']));
|
$item->addChild("link", $it_link);
|
||||||
$item->addChild("g:g:image_link", G5_DATA_URL.'/item/'.$row['it_img1']);
|
$item->addChild("g:g:image_link", $it_image);
|
||||||
$item->addChild("availability", $stock);
|
$item->addChild("availability", $stock);
|
||||||
|
|
||||||
if($row['it_cust_price'] != null && $row['it_cust_price'] > 0) {
|
if($row['it_cust_price'] != null && $row['it_cust_price'] > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user