Ignore:
Timestamp:
2013/03/05 08:52:08 (13 years ago)
Author:
pineray
Message:

#2166 カテゴリーブロックのロジックを見直し.

Location:
branches/version-2_12-dev/data
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/Smarty/templates/default/frontparts/bloc/category.tpl

    r22586 r22602  
    3131        <div class="block_body"> 
    3232            <h2><img src="<!--{$TPL_URLPATH}-->img/title/tit_bloc_category.gif" alt="商品カテゴリ" /></h2> 
    33             <!--{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$arrTree treeID="categorytreelist"}--> 
     33            <!--{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$arrTree treeID="categorytreelist" display=1}--> 
    3434        </div> 
    3535    </div> 
  • branches/version-2_12-dev/data/Smarty/templates/default/frontparts/bloc/category_tree_fork.tpl

    r22586 r22602  
    2121 *}--> 
    2222 
    23 <ul<!--{if $treeID != ""}--> id="<!--{$treeID}-->"<!--{/if}-->> 
     23<ul<!--{if $treeID != ""}--> id="<!--{$treeID}-->"<!--{/if}--><!--{if !$display}--> style="display: none;"<!--{/if}-->> 
    2424<!--{foreach from=$children item=child}--> 
    25     <li<!--{if !in_array($child.category_id, $arrDispID)}--> style="display: none;"<!--{/if}--> class="level<!--{$child.level}--><!--{if in_array($child.category_id, $tpl_category_id)}--> onmark<!--{/if}-->"> 
     25    <li class="level<!--{$child.level}--><!--{if in_array($child.category_id, $tpl_category_id)}--> onmark<!--{/if}-->"> 
    2626        <p><a href="<!--{$smarty.const.ROOT_URLPATH}-->products/list.php?category_id=<!--{$child.category_id}-->"<!--{if in_array($child.category_id, $tpl_category_id)}--> class="onlink"<!--{/if}-->><!--{$child.category_name|h}-->(<!--{$child.product_count|default:0}-->)</a></p> 
     27        <!--{if in_array($child.category_id, $arrParentID)}--> 
     28            <!--{assign var=disp_child value=1}--> 
     29        <!--{else}--> 
     30            <!--{assign var=disp_child value=0}--> 
     31        <!--{/if}--> 
    2732        <!--{if isset($child.children|smarty:nodefaults)}--> 
    28             <!--{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$child.children}--> 
     33            <!--{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$child.children display=$disp_child}--> 
    2934        <!--{/if}--> 
    3035    </li> 
  • branches/version-2_12-dev/data/Smarty/templates/sphone/frontparts/bloc/category.tpl

    r22586 r22602  
    2525    <h2 class="title_block">商品カテゴリ</h2> 
    2626    <nav id="categorytree"> 
    27         <!--{include file="`$smarty.const.SMARTPHONE_TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$arrTree treeID="categorytreelist"}--> 
     27        <!--{include file="`$smarty.const.SMARTPHONE_TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$arrTree treeID="categorytreelist" display=1 level=0}--> 
    2828 
    2929        <script>//<![CDATA[ 
    30             initCategoryList(); //カテゴリリストの初期化 
    3130        //]]></script> 
    3231    </nav> 
  • branches/version-2_12-dev/data/Smarty/templates/sphone/frontparts/bloc/category_tree_fork.tpl

    r22586 r22602  
    2121 *}--> 
    2222 
    23 <ul<!--{if $treeID != ""}--> id="<!--{$treeID}-->"<!--{/if}-->> 
     23<ul<!--{if $treeID != ""}--> id="<!--{$treeID}-->"<!--{/if}--><!--{if $level > 5 || !$display}--> style="display: none;"<!--{/if}-->> 
    2424<!--{foreach from=$children item=child}--> 
    25     <li<!--{if $child.view_flg == "2" || $child.level > 5 || !in_array($child.category_id, $arrDispID)}--> style="display: none;"<!--{/if}--> class="level<!--{$child.level}--><!--{if in_array($child.category_id, $tpl_category_id)}--> onmark<!--{/if}-->"> 
     25    <li class="level<!--{$child.level}--><!--{if in_array($child.category_id, $tpl_category_id)}--> onmark<!--{/if}-->"> 
    2626        <span class="category_header"></span><span class="category_body"><a rel="external" href="<!--{$smarty.const.ROOT_URLPATH}-->products/list.php?category_id=<!--{$child.category_id}-->"<!--{if in_array($child.category_id, $tpl_category_id)}--> class="onlink"<!--{/if}-->><!--{$child.category_name|h}-->(<!--{$child.product_count|default:0}-->)</a></span> 
     27        <!--{if in_array($child.category_id, $arrParentID)}--> 
     28            <!--{assign var=disp_child value=1}--> 
     29        <!--{else}--> 
     30            <!--{assign var=disp_child value=0}--> 
     31        <!--{/if}--> 
    2732        <!--{if isset($child.children|smarty:nodefaults)}--> 
    28             <!--{include file="`$smarty.const.SMARTPHONE_TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$child.children treeID=""}--> 
     33            <!--{include file="`$smarty.const.SMARTPHONE_TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$child.children treeID="" display=$disp_child level=$child.level}--> 
    2934        <!--{/if}--> 
    3035    </li> 
  • branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php

    r22595 r22602  
    3737    // }}} 
    3838    // {{{ functions 
     39    public $arrParentID; 
    3940 
    4041    /** 
     
    133134        $arrTree = $objCategory->getTree(); 
    134135 
    135         $arrCategory = $objCategory->getList(); 
     136        $this->arrParentID = array(); 
    136137        foreach ($arrParentCategoryId as $category_id) { 
    137138            $arrParentID = $objCategory->getTreeTrail($category_id); 
    138             $arrBrothersID = SC_Utils_Ex::sfGetBrothersArray( 
    139                 $arrCategory, 
    140                 'parent_category_id', 
    141                 'category_id', 
    142                 $arrParentID 
    143             ); 
    144             $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray( 
    145                 $arrCategory, 
    146                 'parent_category_id', 
    147                 'category_id', 
    148                 $category_id 
    149             ); 
     139            $this->arrParentID = array_merge($this->arrParentID, $arrParentID);  
    150140            $this->root_parent_id[] = $arrParentID[0]; 
    151             $this->arrDispID = array_merge($arrBrothersID, $arrChildrenID); 
    152141        } 
    153142 
  • branches/version-2_12-dev/data/class/util/SC_Utils.php

    r22597 r22602  
    10931093    } 
    10941094 
    1095     /* 階層構造のテーブルから与えられたIDの兄弟を取得する */ 
    1096     function sfGetBrothersArray($arrData, $pid_name, $id_name, $arrPID) 
    1097     { 
    1098         $max = count($arrData); 
    1099  
    1100         $arrBrothers = array(); 
    1101         foreach ($arrPID as $id) { 
    1102             // 親IDを検索する 
    1103             for ($i = 0; $i < $max; $i++) { 
    1104                 if ($arrData[$i][$id_name] == $id) { 
    1105                     $parent = $arrData[$i][$pid_name]; 
    1106                     break; 
    1107                 } 
    1108             } 
    1109             // 兄弟IDを検索する 
    1110             for ($i = 0; $i < $max; $i++) { 
    1111                 if ($arrData[$i][$pid_name] == $parent) { 
    1112                     $arrBrothers[] = $arrData[$i][$id_name]; 
    1113                 } 
    1114             } 
    1115         } 
    1116         return $arrBrothers; 
    1117     } 
    1118  
    11191095    /* 階層構造のテーブルから与えられたIDの直属の子を取得する */ 
    11201096    function sfGetUnderChildrenArray($arrData, $pid_name, $id_name, $parent) 
Note: See TracChangeset for help on using the changeset viewer.