source: temp/trunk/html/rss/product.php @ 6701

Revision 6701, 7.2 KB checked in by kakinaka, 20 years ago (diff)

* empty log message *

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