From 7a2c29f19255e1e6c699e481f364f4ff9fbd4307 Mon Sep 17 00:00:00 2001 From: loves2tu Date: Mon, 27 Dec 2021 05:56:08 +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-=20query?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=20-=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=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 | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/shop/price/google_feed.php b/shop/price/google_feed.php index 2fecac52b..effef0f7c 100644 --- a/shop/price/google_feed.php +++ b/shop/price/google_feed.php @@ -1,29 +1,26 @@ '0' order by ca_id"; +$sql =" SELECT *, (SELECT MIN(`io_stock_qty`) FROM `g5_shop_item_option` WHERE `it_id` = a.`it_id` GROUP BY `it_id`) AS in_stock + FROM `{$g5['g5_shop_item_table']}` as a + where a.`it_use` = '1' and a.`it_soldout` = '0' and a.`it_tel_inq` = '0' and a.`it_price` > '0' order by a.`ca_id`"; $result = sql_query($sql); -// $xml = new SimpleXMLElement(""); $xml = new SimpleXMLElement(""); $xml->addAttribute("xmlns:xmlns:g", "http://base.google.com/ns/1.0"); $xml->addAttribute("version", "2.0"); $channel = $xml->addChild("channel"); -$title = $channel->addChild("title", "타이틀"); -$link = $channel->addChild("link", "링크"); +$title = $channel->addChild("title", "쇼핑몰피드"); +$link = $channel->addChild("link", G5_URL); $description = $channel->addChild("description", "몰?루"); for ($i = 0; $row = sql_fetch_array($result); $i++ ) { - $item = $channel->addChild("item"); + if($row['in_stock'] != null) { + if($row['in_stock'] <= 0) continue; + } if(empty($row['it_img1'])) continue; if(!file_exists(G5_DATA_PATH.'/item/'.$row['it_img1'])) continue; - $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'])); - $ext = explode('.', $row['it_img1'])[1]; switch($ext) { @@ -43,10 +40,14 @@ for ($i = 0; $row = sql_fetch_array($result); $i++ ) { } if($ext_check == false) continue; - $item->addChild("xmlns:g:image_link", G5_DATA_URL.'/item/'.$row['it_img1']); - - $item->addChild("xmlns:g:condition", "new"); - $item->addChild("xmlns:g:id", $row['it_id']); + + $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']); } header('Content-type: text/xml');