source: branches/version-2_13-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php @ 22857

Revision 22857, 3.5 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';
25
26/**
27 * Recommend のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id: LC_Page_FrontParts_Bloc_Best5 - Copy.php -1   $
32 */
33class LC_Page_FrontParts_Bloc_Recommend extends LC_Page_FrontParts_Bloc_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43    }
44
45    /**
46     * Page のプロセス.
47     *
48     * @return void
49     */
50    function process()
51    {
52        $this->action();
53        $this->sendResponse();
54    }
55
56    /**
57     * Page のアクション.
58     *
59     * @return void
60     */
61    function action()
62    {
63        // 基本情報を渡す
64        $objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData();
65        $this->arrInfo = $objSiteInfo->data;
66
67        //おすすめ商品表示
68        $this->arrBestProducts = $this->lfGetRanking();
69    }
70
71    /**
72     * デストラクタ.
73     *
74     * @return void
75     */
76    function destroy()
77    {
78        parent::destroy();
79    }
80
81    /**
82     * おすすめ商品検索.
83     *
84     * @return array $arrBestProducts 検索結果配列
85     */
86    function lfGetRanking()
87    {
88        $objRecommend = new SC_Helper_BestProducts_Ex();
89
90        // おすすめ商品取得
91        $arrRecommends = $objRecommend->getList(RECOMMEND_NUM);
92
93        $response = array();
94        if (count($arrRecommends) > 0) {
95            // 商品一覧を取得
96            $objQuery =& SC_Query_Ex::getSingletonInstance();
97            $objProduct = new SC_Product_Ex();
98            // where条件生成&セット
99            $arrProductId = array();
100            foreach ($arrRecommends as $key => $val) {
101                $arrProductId[] = $val['product_id'];
102            }
103            $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
104
105            // 税込金額を設定する
106            SC_Product_Ex::setIncTaxToProducts($arrProducts);
107
108            // おすすめ商品情報にマージ
109            foreach ($arrRecommends as $key => $value) {
110                if (isset($arrProducts[$value['product_id']])) {
111                    $product = $arrProducts[$value['product_id']];
112                    if (!NOSTOCK_HIDDEN || ($product['status'] == 1 && ($product['stock_max'] >= 1 || $product['stock_unlimited_max'] == 1))) {
113                        $response[] = array_merge($value, $arrProducts[$value['product_id']]);
114                    }
115                } else {
116                    // 削除済み商品は除外
117                    unset($arrRecommends[$key]);
118                }
119            }
120        }
121
122        return $response;
123    }
124}
Note: See TracBrowser for help on using the repository browser.