From 322e5cf83a84183bc3d02225dd8a2c0c2cfe2a61 Mon Sep 17 00:00:00 2001 From: loves2tu Date: Tue, 28 Dec 2021 03:08:28 +0000 Subject: [PATCH] =?UTF-8?q?=EA=B5=AC=EA=B8=80=20=ED=8C=90=EB=A7=A4?= =?UTF-8?q?=EC=9E=90=EC=84=BC=ED=84=B0=20=ED=94=BC=EB=93=9C=20=20-=20?= =?UTF-8?q?=EC=84=B1=EC=9D=B8=EC=9D=B8=EC=A6=9D=EA=B4=80=EB=A0=A8=20catego?= =?UTF-8?q?ry=20=EC=A1=B0=ED=9A=8C=20query=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shop/price/google_feed.php | 51 ++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/shop/price/google_feed.php b/shop/price/google_feed.php index effef0f7c..10b06752c 100644 --- a/shop/price/google_feed.php +++ b/shop/price/google_feed.php @@ -1,7 +1,25 @@ '0' order by a.`ca_id`"; $result = sql_query($sql); @@ -15,9 +33,10 @@ $link = $channel->addChild("link", G5_URL); $description = $channel->addChild("description", "몰?루"); for ($i = 0; $row = sql_fetch_array($result); $i++ ) { + $stock = "in_stock"; if($row['in_stock'] != null) { - if($row['in_stock'] <= 0) continue; - } + if($row['in_stock'] <= 0) $stock = "out_of_stock"; + } if(empty($row['it_img1'])) continue; if(!file_exists(G5_DATA_PATH.'/item/'.$row['it_img1'])) continue; @@ -42,12 +61,28 @@ for ($i = 0; $row = sql_fetch_array($result); $i++ ) { if($ext_check == false) continue; $item = $channel->addChild("item"); - $item->addChild("title", $row['it_name']); - $item->addChild("link", G5_SHOP_URL.'/item.php?it_id='.urlencode($row['it_id'])); - $item->addChild("description", strip_tags($row['it_basic'])); - $item->addChild("g:g:image_link", G5_DATA_URL.'/item/'.$row['it_img1']); - $item->addChild("g:g:condition", "new"); + // 필수 입력 항목 $item->addChild("g:g:id", $row['it_id']); + $item->addChild("title", $row['it_name']); + $item->addChild("description", strip_tags($row['it_basic'])); + $item->addChild("link", G5_SHOP_URL.'/item.php?it_id='.urlencode($row['it_id'])); + $item->addChild("g:g:image_link", G5_DATA_URL.'/item/'.$row['it_img1']); + $item->addChild("availability", $stock); + + if($row['it_cust_price'] != null && $row['it_cust_price'] > 0) { + $item->addChild("g:g:price", sprintf('%.2fKRW', $row['it_cust_price'])); + $item->addChild("g:g:sale_price", sprintf('%.2fKRW', $row['it_price'])); + } else { + $item->addChild("g:g:price", sprintf('%.2fKRW', $row['it_price'])); + } + + // 선택적 입력 항목 + $item->addChild("g:g:condition", "new"); + $item->addChild("adult", "no"); + if(in_array(1, $category_array[$row['ca_id']])) { + $item->addChild("adult", "yes"); + } + } header('Content-type: text/xml');