| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * Copyright(c) 2000-2007 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 | $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 | }elseif($mode == "list"){ |
|---|
| 52 | //¾¦ÉʰìÍ÷¤ò¼èÆÀ |
|---|
| 53 | $arrProduct = $objQuery->getall("SELECT product_id, name AS product_name FROM dtb_products"); |
|---|
| 54 | }else{ |
|---|
| 55 | $arrProduct = lfGetProductsAllclass($objQuery); |
|---|
| 56 | |
|---|
| 57 | // ÃͤΥ»¥Ã¥È¤·Ä¾¤· |
|---|
| 58 | foreach($arrProduct as $key => $val){ |
|---|
| 59 | //¾¦ÉʲÁ³Ê¤òÀǹþ¤ß¤ËÊÔ½¸ |
|---|
| 60 | $arrProduct[$key]["price01_max"] = sfPreTax($arrProduct[$key]["price01_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 61 | $arrProduct[$key]["price01_min"] = sfPreTax($arrProduct[$key]["price01_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 62 | $arrProduct[$key]["price02_max"] = sfPreTax($arrProduct[$key]["price02_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 63 | $arrProduct[$key]["price02_min"] = sfPreTax($arrProduct[$key]["price02_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]); |
|---|
| 64 | |
|---|
| 65 | // ²èÁü¥Õ¥¡¥¤¥ë¤ÎURL¥»¥Ã¥È |
|---|
| 66 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 67 | $arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"]; |
|---|
| 68 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 69 | $arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"]; |
|---|
| 70 | (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS; |
|---|
| 71 | $arrProduct[$key]["main_large_image"] = $dir . $arrProduct[$key]["main_large_image"]; |
|---|
| 72 | |
|---|
| 73 | // ¥Ý¥¤¥ó¥È·×»» |
|---|
| 74 | $arrProduct[$key]["point_max"] = sfPrePoint($arrProduct[$key]["price02_max"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]); |
|---|
| 75 | $arrProduct[$key]["point_min"] = sfPrePoint($arrProduct[$key]["price02_min"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]); |
|---|
| 76 | } |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | //¾¦ÉʾðÊó¤ò¥»¥Ã¥È |
|---|
| 80 | $objPage->arrProduct = $arrProduct; |
|---|
| 81 | if(is_array(sfswaparray($arrProduct))){ |
|---|
| 82 | $objPage->arrProductKeys = array_keys(sfswaparray($arrProduct)); |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | //ŹÊÞ¾ðÊó¤ò¥»¥Ã¥È |
|---|
| 86 | $objPage->arrSiteInfo = $arrSiteInfo; |
|---|
| 87 | |
|---|
| 88 | //¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ |
|---|
| 89 | $objView->assignobj($objPage); |
|---|
| 90 | |
|---|
| 91 | //¥¥ã¥Ã¥·¥å¤·¤Ê¤¤(ǰ¤Î¤¿¤á) |
|---|
| 92 | header("Pragma: no-cache"); |
|---|
| 93 | |
|---|
| 94 | //XML¥Æ¥¥¹¥È(¤³¤ì¤¬¤Ê¤¤¤ÈÀµ¾ï¤ËRSS¤È¤·¤ÆÇ§¼±¤·¤Æ¤¯¤ì¤Ê¤¤¥Ä¡¼¥ë¤¬¤¢¤ë¤¿¤á) |
|---|
| 95 | header("Content-type: application/xml"); |
|---|
| 96 | DETAIL_P_HTML; |
|---|
| 97 | |
|---|
| 98 | //²èÌÌɽ¼¨ |
|---|
| 99 | $objView->display($objPage->tpl_mainpage, true); |
|---|
| 100 | |
|---|
| 101 | //--------------------------------------------------------------------------------------------------------------------- |
|---|
| 102 | /************************************************************************************************************** |
|---|
| 103 | * ´Ø¿ô̾:lfGetProducts |
|---|
| 104 | * ÀâÌÀ¡¡:¾¦ÉʾðÊó¤ò¼èÆÀ¤¹¤ë |
|---|
| 105 | * °ú¿ô£±:$objQuery DBÁàºî¥¯¥é¥¹ |
|---|
| 106 | * °ú¿ô£²:$product_id ¾¦ÉÊID |
|---|
| 107 | * Ìá¤êÃÍ:$arrProduct ¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹ |
|---|
| 108 | **************************************************************************************************************/ |
|---|
| 109 | function lfGetProductsDetail($objQuery, $product_id = "all"){ |
|---|
| 110 | $sql = ""; |
|---|
| 111 | $sql .= "SELECT "; |
|---|
| 112 | $sql .= " prod.product_id "; |
|---|
| 113 | $sql .= " ,prod.name AS product_name "; |
|---|
| 114 | $sql .= " ,prod.category_id "; |
|---|
| 115 | $sql .= " ,prod.point_rate "; |
|---|
| 116 | $sql .= " ,prod.comment3 "; |
|---|
| 117 | $sql .= " ,prod.main_list_comment "; |
|---|
| 118 | $sql .= " ,prod.main_list_image "; |
|---|
| 119 | $sql .= " ,prod.main_comment "; |
|---|
| 120 | $sql .= " ,prod.main_image "; |
|---|
| 121 | $sql .= " ,prod.main_large_image "; |
|---|
| 122 | $sql .= " ,cls.product_code "; |
|---|
| 123 | $sql .= " ,cls.price01 "; |
|---|
| 124 | $sql .= " ,cls.price02 "; |
|---|
| 125 | $sql .= " ,cls.classcategory_id1 "; |
|---|
| 126 | $sql .= " ,cls.classcategory_id2 "; |
|---|
| 127 | $sql .= " ,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id1) AS classcategory_name1 "; |
|---|
| 128 | $sql .= " ,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id2) AS classcategory_name2 "; |
|---|
| 129 | $sql .= " ,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = prod.category_id) AS category_name"; |
|---|
| 130 | $sql .= " FROM dtb_products AS prod, dtb_products_class AS cls"; |
|---|
| 131 | $sql .= " WHERE prod.product_id = cls.product_id AND prod.del_flg = 0 AND prod.status = 1"; |
|---|
| 132 | |
|---|
| 133 | if($product_id != "all"){ |
|---|
| 134 | $sql .= " AND prod.product_id = ?"; |
|---|
| 135 | $arrval = array($product_id); |
|---|
| 136 | } |
|---|
| 137 | $sql .= " ORDER BY prod.product_id, cls.classcategory_id1, cls.classcategory_id2"; |
|---|
| 138 | $arrProduct = $objQuery->getall($sql, $arrval); |
|---|
| 139 | return $arrProduct; |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | /************************************************************************************************************** |
|---|
| 143 | * ´Ø¿ô̾:lfGetProductsAllclass |
|---|
| 144 | * ÀâÌÀ¡¡:¾¦ÉʾðÊó¤ò¼èÆÀ¤¹¤ë(vw_products_allclass»ÈÍÑ) |
|---|
| 145 | * °ú¿ô£±:$objQuery DBÁàºî¥¯¥é¥¹ |
|---|
| 146 | * Ìá¤êÃÍ:$arrProduct ¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹ |
|---|
| 147 | **************************************************************************************************************/ |
|---|
| 148 | function lfGetProductsAllclass($objQuery){ |
|---|
| 149 | $sql = ""; |
|---|
| 150 | $sql .= "SELECT |
|---|
| 151 | product_id |
|---|
| 152 | ,name as product_name |
|---|
| 153 | ,category_id |
|---|
| 154 | ,point_rate |
|---|
| 155 | ,comment3 |
|---|
| 156 | ,main_list_comment |
|---|
| 157 | ,main_image |
|---|
| 158 | ,main_list_image |
|---|
| 159 | ,product_code_min |
|---|
| 160 | ,product_code_max |
|---|
| 161 | ,price01_min |
|---|
| 162 | ,price01_max |
|---|
| 163 | ,price02_min |
|---|
| 164 | ,price02_max |
|---|
| 165 | ,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = allcls.category_id) AS category_name |
|---|
| 166 | ,(SELECT main_large_image FROM dtb_products AS prod WHERE prod.product_id = allcls.product_id) AS main_large_image |
|---|
| 167 | FROM vw_products_allclass as allcls |
|---|
| 168 | WHERE allcls.del_flg = 0 AND allcls.status = 1"; |
|---|
| 169 | $sql .= " ORDER BY allcls.product_id"; |
|---|
| 170 | $arrProduct = $objQuery->getall($sql); |
|---|
| 171 | return $arrProduct; |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | ?> |
|---|