| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 4 | * |
|---|
| 5 | * http://www.lockon.co.jp/ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | //¶¦ÄÌÉôÉÊ¤ÎÆÉ¤ß¹þ¤ß |
|---|
| 9 | require_once("../require.php"); |
|---|
| 10 | |
|---|
| 11 | class LC_Page{ |
|---|
| 12 | function LC_Page(){ |
|---|
| 13 | $this->tpl_mainpage = "rss/product.tpl"; |
|---|
| 14 | $this->encode = "UTF-8"; |
|---|
| 15 | ($_GET['mode'] == "all") ? $this->title = "¾¦ÉʰìÍ÷¾ðÊó" : $this->title = "¾¦ÉʾܺپðÊó"; |
|---|
| 16 | } |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | $objQuery = new SC_Query(); |
|---|
| 20 | $objPage = new LC_Page(); |
|---|
| 21 | $objView = new SC_SiteView(); |
|---|
| 22 | $objSiteInfo = new SC_SiteInfo(); |
|---|
| 23 | |
|---|
| 24 | //ŹÊÞ¾ðÊó¤ò¥»¥Ã¥È |
|---|
| 25 | $arrSiteInfo = $objSiteInfo->data; |
|---|
| 26 | |
|---|
| 27 | //¾¦ÉÊID¤ò¼èÆÀ |
|---|
| 28 | $product_id = $_GET['product_id']; |
|---|
| 29 | $mode = $_GET['mode']; |
|---|
| 30 | |
|---|
| 31 | if(($product_id != "" and is_numeric($product_id)) or $mode == "all"){ |
|---|
| 32 | //¾¦Éʾܺ٤ò¼èÆÀ |
|---|
| 33 | ($mode == "all") ? $arrProduct = lfGetProductsDetail($objQuery, $mode):$arrProduct = lfGetProductsDetail($objQuery, $product_id); |
|---|
| 34 | |
|---|
| 35 | // ÃͤΥ»¥Ã¥È¤·Ä¾¤· |
|---|
| 36 | foreach($arrProduct as $key => $val){ |
|---|
| 37 | //¾¦ÉʲÁ³Ê¤òÀǹþ¤ß¤ËÊÔ½¸ |
|---|
| 38 | $arrProduct[$key]["price02"] = sfPreTax($arrProduct[$key]["price02"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 39 | |
|---|
| 40 | // ²èÁü¥Õ¥¡¥¤¥ë¤ÎURL¥»¥Ã¥È |
|---|
| 41 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 42 | $arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"]; |
|---|
| 43 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 44 | $arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"]; |
|---|
| 45 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 46 | $arrProduct[$key]["main_large_image"] = $dir . $arrProduct[$key]["main_large_image"]; |
|---|
| 47 | |
|---|
| 48 | // ¥Ý¥¤¥ó¥È·×»» |
|---|
| 49 | $arrProduct[$key]["point"] = sfPrePoint($arrProduct[$key]["price02"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]); |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | if($mode == "list"){ |
|---|
| 53 | //¾¦ÉʰìÍ÷¤ò¼èÆÀ |
|---|
| 54 | $arrProduct = $objQuery->getall("SELECT product_id, name AS product_name FROM dtb_products"); |
|---|
| 55 | }else{ |
|---|
| 56 | $arrProduct = lfGetProductsAllclass($objQuery); |
|---|
| 57 | |
|---|
| 58 | // ÃͤΥ»¥Ã¥È¤·Ä¾¤· |
|---|
| 59 | foreach($arrProduct as $key => $val){ |
|---|
| 60 | //¾¦ÉʲÁ³Ê¤òÀǹþ¤ß¤ËÊÔ½¸ |
|---|
| 61 | $arrProduct[$key]["price01_max"] = sfPreTax($arrProduct[$key]["price01_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 62 | $arrProduct[$key]["price01_min"] = sfPreTax($arrProduct[$key]["price01_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 63 | $arrProduct[$key]["price02_max"] = sfPreTax($arrProduct[$key]["price02_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 64 | $arrProduct[$key]["price02_min"] = sfPreTax($arrProduct[$key]["price02_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 65 | |
|---|
| 66 | // ²èÁü¥Õ¥¡¥¤¥ë¤ÎURL¥»¥Ã¥È |
|---|
| 67 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 68 | $arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"]; |
|---|
| 69 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 70 | $arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"]; |
|---|
| 71 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 72 | $arrProduct[$key]["main_large_image"] = $dir . $arrProduct[$key]["main_large_image"]; |
|---|
| 73 | |
|---|
| 74 | // ¥Ý¥¤¥ó¥È·×»» |
|---|
| 75 | $arrProduct[$key]["point_max"] = sfPrePoint($arrProduct[$key]["price02_max"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]); |
|---|
| 76 | $arrProduct[$key]["point_min"] = sfPrePoint($arrProduct[$key]["price02_min"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]); |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | //¾¦ÉʾðÊó¤ò¥»¥Ã¥È |
|---|
| 81 | $objPage->arrProduct = $arrProduct; |
|---|
| 82 | if(is_array(sfswaparray($arrProduct))){ |
|---|
| 83 | $objPage->arrProductKeys = array_keys(sfswaparray($arrProduct)); |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | //ŹÊÞ¾ðÊó¤ò¥»¥Ã¥È |
|---|
| 87 | $objPage->arrSiteInfo = $arrSiteInfo; |
|---|
| 88 | |
|---|
| 89 | //¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ |
|---|
| 90 | $objView->assignobj($objPage); |
|---|
| 91 | |
|---|
| 92 | //¥¥ã¥Ã¥·¥å¤·¤Ê¤¤(ǰ¤Î¤¿¤á) |
|---|
| 93 | header("Paragrama: no-cache"); |
|---|
| 94 | |
|---|
| 95 | //XML¥Æ¥¥¹¥È(¤³¤ì¤¬¤Ê¤¤¤ÈÀµ¾ï¤ËRSS¤È¤·¤ÆÇ§¼±¤·¤Æ¤¯¤ì¤Ê¤¤¥Ä¡¼¥ë¤¬¤¢¤ë¤¿¤á) |
|---|
| 96 | header("Content-type: application/xml"); |
|---|
| 97 | DETAIL_P_HTML; |
|---|
| 98 | |
|---|
| 99 | //²èÌÌɽ¼¨ |
|---|
| 100 | $objView->display($objPage->tpl_mainpage, true); |
|---|
| 101 | |
|---|
| 102 | //--------------------------------------------------------------------------------------------------------------------- |
|---|
| 103 | /************************************************************************************************************** |
|---|
| 104 | * ´Ø¿ô̾:lfGetProducts |
|---|
| 105 | * ÀâÌÀ¡¡:¾¦ÉʾðÊó¤ò¼èÆÀ¤¹¤ë |
|---|
| 106 | * °ú¿ô£±:$objQuery DBÁàºî¥¯¥é¥¹ |
|---|
| 107 | * °ú¿ô£²:$product_id ¾¦ÉÊID |
|---|
| 108 | * Ìá¤êÃÍ:$arrProduct ¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹ |
|---|
| 109 | **************************************************************************************************************/ |
|---|
| 110 | function lfGetProductsDetail($objQuery, $product_id = "all"){ |
|---|
| 111 | $sql = ""; |
|---|
| 112 | $sql .= "SELECT "; |
|---|
| 113 | $sql .= " prod.product_id "; |
|---|
| 114 | $sql .= " ,prod.name AS product_name "; |
|---|
| 115 | $sql .= " ,prod.category_id "; |
|---|
| 116 | $sql .= " ,prod.point_rate "; |
|---|
| 117 | $sql .= " ,prod.comment3 "; |
|---|
| 118 | $sql .= " ,prod.main_list_comment "; |
|---|
| 119 | $sql .= " ,prod.main_list_image "; |
|---|
| 120 | $sql .= " ,prod.main_comment "; |
|---|
| 121 | $sql .= " ,prod.main_image "; |
|---|
| 122 | $sql .= " ,prod.main_large_image "; |
|---|
| 123 | $sql .= " ,cls.product_code "; |
|---|
| 124 | $sql .= " ,cls.price01 "; |
|---|
| 125 | $sql .= " ,cls.price02 "; |
|---|
| 126 | $sql .= " ,cls.classcategory_id1 "; |
|---|
| 127 | $sql .= " ,cls.classcategory_id2 "; |
|---|
| 128 | $sql .= " ,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id1) AS classcategory_name1 "; |
|---|
| 129 | $sql .= " ,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id2) AS classcategory_name2 "; |
|---|
| 130 | $sql .= " ,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = prod.category_id) AS category_name"; |
|---|
| 131 | $sql .= " FROM dtb_products AS prod, dtb_products_class AS cls"; |
|---|
| 132 | $sql .= " WHERE prod.product_id = cls.product_id AND prod.del_flg = 0 AND prod.status = 1"; |
|---|
| 133 | |
|---|
| 134 | if($product_id != "all"){ |
|---|
| 135 | $sql .= " AND prod.product_id = ?"; |
|---|
| 136 | $arrval = array($product_id); |
|---|
| 137 | } |
|---|
| 138 | $sql .= " ORDER BY prod.product_id, cls.classcategory_id1, cls.classcategory_id2"; |
|---|
| 139 | $arrProduct = $objQuery->getall($sql, $arrval); |
|---|
| 140 | return $arrProduct; |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | /************************************************************************************************************** |
|---|
| 144 | * ´Ø¿ô̾:lfGetProductsAllclass |
|---|
| 145 | * ÀâÌÀ¡¡:¾¦ÉʾðÊó¤ò¼èÆÀ¤¹¤ë(vw_products_allclass»ÈÍÑ) |
|---|
| 146 | * °ú¿ô£±:$objQuery DBÁàºî¥¯¥é¥¹ |
|---|
| 147 | * Ìá¤êÃÍ:$arrProduct ¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹ |
|---|
| 148 | **************************************************************************************************************/ |
|---|
| 149 | function lfGetProductsAllclass($objQuery){ |
|---|
| 150 | $sql = ""; |
|---|
| 151 | $sql .= "SELECT |
|---|
| 152 | product_id |
|---|
| 153 | ,name as product_name |
|---|
| 154 | ,category_id |
|---|
| 155 | ,point_rate |
|---|
| 156 | ,comment3 |
|---|
| 157 | ,main_list_comment |
|---|
| 158 | ,main_image |
|---|
| 159 | ,main_list_image |
|---|
| 160 | ,product_code_min |
|---|
| 161 | ,product_code_max |
|---|
| 162 | ,price01_min |
|---|
| 163 | ,price01_max |
|---|
| 164 | ,price02_min |
|---|
| 165 | ,price02_max |
|---|
| 166 | ,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = allcls.category_id) AS category_name |
|---|
| 167 | ,(SELECT main_large_image FROM dtb_products AS prod WHERE prod.product_id = allcls.product_id) AS main_large_image |
|---|
| 168 | FROM vw_products_allclass as allcls |
|---|
| 169 | WHERE allcls.del_flg = 0 AND allcls.status = 1"; |
|---|
| 170 | $sql .= " ORDER BY allcls.product_id"; |
|---|
| 171 | $arrProduct = $objQuery->getall($sql); |
|---|
| 172 | return $arrProduct; |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | ?> |
|---|