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

Revision 23118, 3.4 KB checked in by pineray, 8 years ago (diff)

#2162 オススメ商品表示の条件式に誤りがあったのを訂正
括弧閉じ忘れ

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 array $arrBestProducts 検索結果配列
75     */
76    function lfGetRanking()
77    {
78        $objRecommend = new SC_Helper_BestProducts_Ex();
79
80        // おすすめ商品取得
81        $arrRecommends = $objRecommend->getList(RECOMMEND_NUM);
82
83        $response = array();
84        if (count($arrRecommends) > 0) {
85            // 商品一覧を取得
86            $objQuery =& SC_Query_Ex::getSingletonInstance();
87            $objProduct = new SC_Product_Ex();
88            // where条件生成&セット
89            $arrProductId = array();
90            foreach ($arrRecommends as $key => $val) {
91                $arrProductId[] = $val['product_id'];
92            }
93            $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
94
95            // 税込金額を設定する
96            SC_Product_Ex::setIncTaxToProducts($arrProducts);
97
98            // おすすめ商品情報にマージ
99            foreach ($arrRecommends as $key => $value) {
100                if (isset($arrProducts[$value['product_id']])) {
101                    $product = $arrProducts[$value['product_id']];
102                    if ($product['status'] == 1 && (!NOSTOCK_HIDDEN || ($product['stock_max'] >= 1 || $product['stock_unlimited_max'] == 1))) {
103                        $response[] = array_merge($value, $arrProducts[$value['product_id']]);
104                    }
105                } else {
106                    // 削除済み商品は除外
107                    unset($arrRecommends[$key]);
108                }
109            }
110        }
111
112        return $response;
113    }
114}
Note: See TracBrowser for help on using the repository browser.