From 8faa9ba9a2c49d30384bce510da4c2a15fb8643f Mon Sep 17 00:00:00 2001 From: loves2tu Date: Tue, 21 Dec 2021 07:58:42 +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-=20echo?= =?UTF-8?q?=20xml=20=EC=83=9D=EC=84=B1=20=EA=B4=80=EB=A0=A8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=A0=81=EC=9A=A9=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shop/price/google_feed.php | 43 +++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/shop/price/google_feed.php b/shop/price/google_feed.php index 77e0314f9..3578a7be4 100644 --- a/shop/price/google_feed.php +++ b/shop/price/google_feed.php @@ -1,6 +1,19 @@ $val) { + if(is_numeric($key)) { + $result .= array_xml($val); + } else { + $result .= "<{$key}>".array_xml($val).""; + } + } + return $result; +} + ob_end_clean(); ob_start(); @@ -8,23 +21,33 @@ ob_start(); $sql =" select * from {$g5['g5_shop_item_table']} where it_use = '1' and it_soldout = '0' and it_tel_inq = '0' and it_price > '0' order by ca_id"; $result = sql_query($sql); -$xml = array(); -$xml['rss'] = "version=\"2.0\" xmlns:g=\"http:base.google.com/ns/1.0\""; -$xml['channel'] = array( +$xml = array( "channel" => array( "title" => "타이틀", "link" => "링크", "description" => "몰?루" -); +)); $items = array(); -while($row = sql_fetch_array($result)) { - $items['title'] = $row['it_name']; - $items['link'] = G5_SHOP_URL.'/item.php?it_id='.$row['it_id']; - $items['description'] = $row['it_basic']; - // $items['g:image_link'] = G5_DATA_PATH.'/item/'.$row[''] +for ($i = 0; $row = sql_fetch_array($result); $i++ ) { + if(empty($row['it_img1'])) continue; + if(!file_exists(G5_DATA_PATH.'/item/'.$row['it_img1'])) continue; + + $xml['channel']['item'][$i]['title'] = $row['it_name']; + $xml['channel']['item'][$i]['link'] = G5_SHOP_URL.'/item.php?it_id='.$row['it_id']; + $xml['channel']['item'][$i]['description'] = $row['it_basic']; + $xml['channel']['item'][$i]['g:image_link'] = G5_DATA_URL.'/item/'.$row['it_img1']; + $xml['channel']['item'][$i]['g:condition'] = "new"; + $xml['channel']['item'][$i]['g:id'] = $row['it_id']; } header('Content-type: text/xml'); -echo "\n"; +echo ""; +echo ""; + +foreach($xml as $key => $var) { + echo array_xml($var); +} + +echo ""; ?> \ No newline at end of file