'0' order by a.`ca_id`"; $result = sql_query($sql); $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", 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) $stock = "out_of_stock"; } if(empty($row['it_img1'])) continue; if(!file_exists(G5_DATA_PATH.'/item/'.$row['it_img1'])) continue; $ext = explode('.', $row['it_img1'])[1]; switch($ext) { case "jpg": case "jpeg": case "webp": case "png": case "gif": case "bmp": case "tif": case "tiff": $ext_check = true; break; default: $ext_check = false; break; } if($ext_check == false) continue; $item = $channel->addChild("item"); // 필수 입력 항목 $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'); echo $xml->asXML(); ?>