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

Revision 6689, 4.4 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, $product_id):$arrProduct = lfGetProductsDetail($objQuery);
34   
35    // ÃͤΥ»¥Ã¥È¤·Ä¾¤·
36    foreach($arrProduct as $key => $val){
37       
38        //¾¦ÉʲÁ³Ê¤òÀǹþ¤ß¤ËÊÔ½¸
39        $arrProduct[$key]["price02"] = sfPreTax($arrProduct[$key]["price02"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
40       
41        // ²èÁü¥Õ¥¡¥¤¥ë¤ÎURL¥»¥Ã¥È
42        (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
43        $arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"];
44        (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
45        $arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"];
46        (file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"])) ? $dir = IMAGE_SAVE_URL_RSS : $dir = IMAGE_TEMP_URL_RSS;
47        $arrProduct[$key]["main_large_image"] = $dir . $arrProduct[$key]["main_large_image"];
48       
49        // ¥Ý¥¤¥ó¥È·×»»
50        $arrProduct[$key]["point"] = sfPrePoint($arrProduct[$key]["price02"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]);
51    }
52}elseif($mode == "list"){
53    //¾¦ÉʰìÍ÷¤ò¼èÆÀ
54    $arrProduct = $objQuery->getall("SELECT product_id, name AS product_name FROM dtb_products");
55}
56
57//¾¦ÉʾðÊó¤ò¥»¥Ã¥È
58$objPage->arrProduct = $arrProduct;
59if(is_array(sfswaparray($arrProduct))){
60    $objPage->arrProductKeys = array_keys(sfswaparray($arrProduct));
61}
62
63//ŹÊÞ¾ðÊó¤ò¥»¥Ã¥È
64$objPage->arrSiteInfo = $arrSiteInfo;
65
66//¥»¥Ã¥È¤·¤¿¥Ç¡¼¥¿¤ò¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤Ë½ÐÎÏ
67$objView->assignobj($objPage);
68
69//¥­¥ã¥Ã¥·¥å¤·¤Ê¤¤(ǰ¤Î¤¿¤á)
70header("Paragrama: no-cache");
71
72//XML¥Æ¥­¥¹¥È(¤³¤ì¤¬¤Ê¤¤¤ÈÀµ¾ï¤ËRSS¤È¤·¤ÆÇ§¼±¤·¤Æ¤¯¤ì¤Ê¤¤¥Ä¡¼¥ë¤¬¤¢¤ë¤¿¤á)
73header("Content-type: application/xml");
74DETAIL_P_HTML;
75
76//²èÌÌɽ¼¨
77$objView->display($objPage->tpl_mainpage, true);
78
79//---------------------------------------------------------------------------------------------------------------------
80/**************************************************************************************************************
81 * ´Ø¿ô̾:lfGetProducts
82 * ÀâÌÀ¡¡:¾¦ÉʾðÊó¤ò¼èÆÀ¤¹¤ë
83 * °ú¿ô£±:$objQuery     DBÁàºî¥¯¥é¥¹
84 * °ú¿ô£²:$product_id   ¾¦ÉÊID
85 * Ìá¤êÃÍ:$arrProduct   ¼èÆÀ·ë²Ì¤òÇÛÎó¤ÇÊÖ¤¹
86 **************************************************************************************************************/
87function lfGetProductsDetail($objQuery, $product_id = "all"){
88    $sql = "";
89    $sql .= "SELECT ";
90    $sql .= "   prod.product_id ";
91    $sql .= "   ,prod.name AS product_name ";
92    $sql .= "   ,prod.category_id ";
93    $sql .= "   ,prod.point_rate ";
94    $sql .= "   ,prod.comment3 ";
95    $sql .= "   ,prod.main_list_comment ";
96    $sql .= "   ,prod.main_list_image ";
97    $sql .= "   ,prod.main_comment ";
98    $sql .= "   ,prod.main_image ";
99    $sql .= "   ,prod.main_large_image ";
100    $sql .= "   ,cls.product_code ";
101    $sql .= "   ,cls.price01 ";
102    $sql .= "   ,cls.price02 ";
103    $sql .= "   ,cls.classcategory_id1 ";
104    $sql .= "   ,cls.classcategory_id2 ";
105    $sql .= "   ,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id1) AS classcategory_name1 ";
106    $sql .= "   ,(SELECT name FROM dtb_classcategory AS clscat WHERE clscat.classcategory_id = cls.classcategory_id2) AS classcategory_name2 ";
107    $sql .= "   ,(SELECT category_name FROM dtb_category AS cat WHERE cat.category_id = prod.category_id) AS category_name";
108    $sql .= " FROM dtb_products AS prod, dtb_products_class AS cls";
109    $sql .= " WHERE prod.product_id = cls.product_id AND prod.del_flg = 0 AND prod.status = 1";
110   
111    if($product_id != "all"){
112        $sql .= " AND prod.product_id = ?";
113        $arrval = array($product_id);
114    }
115    $sql .= " ORDER BY prod.product_id, cls.classcategory_id1, cls.classcategory_id2";
116    $arrProduct = $objQuery->getall($sql, $arrval);
117    return $arrProduct;
118}
119
120?>
Note: See TracBrowser for help on using the repository browser.