Source for file LC_Page_FrontParts_Bloc_Category.php
Documentation is available at LC_Page_FrontParts_Bloc_Category.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_REALDIR . 'pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_FrontParts_Bloc_Category.php 20810 2011-04-05 01:49:30Z kimoto $
switch ( SC_Display_Ex::detectDevice() ) {
$this->arrTree = $this->lfGetCatTree($this->tpl_category_id, true);
* @param array $arrRequest リクエスト配列
* @return array $arrCategoryId 選択中のカテゴリID
if ( isset ($arrRequest['product_id']) && $arrRequest['product_id'] != '' && is_numeric($arrRequest['product_id']) ) {
$product_id = $arrRequest['product_id'];
if ( isset ($arrRequest['category_id']) && $arrRequest['category_id'] != '' && is_numeric($arrRequest['category_id']) ) {
$category_id = $arrRequest['category_id'];
$objDb = new SC_Helper_DB_Ex();
$arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id);
if (empty($arrCategoryId)) {
$arrCategoryId = array(0);
* @param array $arrParentCategoryId 親カテゴリの配列
* @param boolean $count_check 登録商品数をチェックする場合はtrue
* @return array $arrRet カテゴリーツリーの配列を返す
function lfGetCatTree($arrParentCategoryId, $count_check = false) {
$objQuery = new SC_Query_Ex();
$objDb = new SC_Helper_DB_Ex();
$from = 'dtb_category left join dtb_category_total_count using (category_id)';
$where = 'del_flg = 0 AND product_count > 0';
$objQuery->setOption('ORDER BY rank DESC');
$arrRet = $objQuery->select($col, $from, $where);
foreach ($arrParentCategoryId as $category_id) {
$arrParentID = $objDb->sfGetParents(
$arrBrothersID = SC_Utils_Ex::sfGetBrothersArray(
$arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray(
$this->root_parent_id[] = $arrParentID[0];
$arrDispID = array_merge($arrBrothersID, $arrChildrenID);
foreach($arrRet as $key => $array) {
foreach($arrDispID as $val) {
if($array['category_id'] == $val) {
$arrRet[$key]['display'] = 1;
* @param boolean $count_check 登録商品数をチェックする場合はtrue
* @return array $arrMainCat メインカテゴリーの配列を返す
$objQuery = new SC_Query_Ex();
$from = 'dtb_category left join dtb_category_total_count using (category_id)';
// メインカテゴリーとその直下のカテゴリーを取得する。
$where = 'level <= 2 AND del_flg = 0';
$where .= ' AND product_count > 0';
$objQuery->setOption('ORDER BY rank DESC');
$arrRet = $objQuery->select($col, $from, $where);
foreach ($arrRet as $cat) {
if ($cat['level'] != 1) {
$arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray(
$cat['has_children'] = count($arrChildrenID) > 0;
Documentation generated on Fri, 24 Feb 2012 14:01:59 +0900 by Seasoft
|