2014-02-27 38 views
1

默認情況下,它被稱爲在2columns-left.phtml試圖調用在list.phtml文件分層導航塊 - 在這個主題的分層導航是在左邊欄的Magento

<div class="col-left sidebar grid12-3 grid-col2-sidebar in-sidebar"><?php echo $this->getChildHtml('left') ?></div> 

當我註釋掉那裏的PHP,它消失了,如果我在2columns-left.phtml文件中移動它,分層導航會移動。不過,我想從list.phtml文件中調用此塊,因爲我希望分層導航包含在category-products div中。

當我把那個php放在list.phtml文件中時什麼也沒有發生。

我認爲這個問題與catalog.xml文件有關,但我不確定如何修改它以獲取我想要的文件中調用的該塊。

下面是從那裏它從catalog.xml文件來代碼:

<catalog_category_layered translate="label"> 
    <label>Catalog Category (Anchor)</label> 
    <reference name="left"> 
     <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/> 
    </reference> 
    <reference name="content"> 
     <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml"> 
      <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"> 
       <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> --> 
       <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> 
        <block type="page/html_pager" name="product_list_toolbar_pager"/> 
        <!-- The following code shows how to set your own pager increments --> 
        <!-- 
         <action method="setDefaultListPerPage"><limit>4</limit></action> 
         <action method="setDefaultGridPerPage"><limit>3</limit></action> 
         <action method="addPagerLimit"><mode>list</mode><limit>2</limit></action> 
         <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action> 
         <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action> 
         <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action> 
         <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action> 
         <action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action> 
         <action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action> 
         <action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action> 
         <action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action> 
        --> 
       </block> 
       <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action> 
       <action method="setToolbarBlockName"><name>product_list_toolbar</name></action> 
      </block> 
     </block> 
    </reference> 
</catalog_category_layered> 

如果任何人有任何想法,我怎麼能修改(或任何其他佈局的XML文件),以能夠調用來自list.phtml內部的分層導航塊,這將是一個很大的幫助。

回答

0

Xander的,請嘗試致電給適當的地方......

<catalog_category_layered translate="label"> 
    <label>Catalog Category (Anchor)</label> 
    <reference name="left"> 
    </reference> 
    <reference name="content"> 
     <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml"> 
      <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"> 
         <block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml"/> 
       <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> 
        <block type="page/html_pager" name="product_list_toolbar_pager"/> 
       </block> 
       <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action> 
       <action method="setToolbarBlockName"><name>product_list_toolbar</name></action> 
      </block> 
     </block> 
    </reference> 
</catalog_category_layered> 


<catalog_category_default translate="label"> 
    <label>Catalog Category (Non-Anchor)</label> 
    <reference name="content"> 
     <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml"> 
      <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"> 
         <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left.phtml"/> 

       <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> 
        <block type="page/html_pager" name="product_list_toolbar_pager"/> 
       </block> 
       <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action> 
       <action method="setToolbarBlockName"><name>product_list_toolbar</name></action> 
      </block> 
     </block> 
    </reference> 
</catalog_category_default> 

,並添加下面的代碼呼叫layernaviation在列表頁list.phtml

<?php echo $this->getChildHtml('catalog.leftnav'); ?> 
+0

謝謝!那樣做了。對不起,我仍然在學習如何開發Magento。 – Xander

+0

我可以幫忙什麼 –

+0

我唯一遇到麻煩的其他事情是讓這一點的PHP工作,並顯示一個基於時間的div,並隱藏所有其他時間。這裏已經發布了一個關於它的新問題:http://stackoverflow.com/questions/22076037/hide-div-based-on-time-php – Xander