2013-02-15 36 views
2

我想分離類別頁面上的2列左側模板。如何將Magento頁面標題移動到側欄上

現在它看起來是這樣的:

_________________________________ 
|   |     | 
|   | Page Title   | 
|   |     | 
|(sidebar) | (main content)  | 
|   |     | 
|   |     | 
|__________|____________________| 

我需要的類別名稱和描述,在左邊的菜單上移,並填寫寬度100%這樣的:

_________________________________ 
|        | 
| Page Title     | 
|_______________________________| 
|   |     | 
|(sidebar) | (main content)  | 
|   |     | 
|   |     | 
|__________|____________________| 

我不知道從哪裏開始。當我查看XML時,它似乎不是我可以放置在別處的單獨部分。

+0

您是在類別設置中使用描述還是在您想要移動的類別文本中使用靜態塊? – Rounder 2013-02-15 22:30:24

+0

你可以用css或者更改模板來做到這一點 – dagfr 2013-02-15 23:20:21

+0

@Jeff - 使用類別描述,而不是靜態模塊 – 2013-02-15 23:28:20

回答

2

首先更新目錄佈局以使用單列模板。然後將catalog.leftnav塊複製到category.products塊中。

<!-- {THEME_PATH}/design/layout/catalog.xml --> 
<catalog_category_default translate="label"> 

    <!-- Update the layout to use the single column template --> 
    <reference name="root"> 
     <action method="setTemplate"><template>page/1column.phtml</template></action> 
    </reference> 

    <reference name="content"> 
     <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml"> 
      <!-- Move the catalog navigation block into the category view block --> 
      <block type="catalog/navigation" name="catalog.leftnav" before="-" template="catalog/navigation/left.phtml"/> 
     </block> 
    </reference> 

</catalog_category_default> 

一旦catalog.leftnav塊是category.products塊的子級,則可以使用,直到最底層()方法來顯示它在category.products視圖模板。

<!-- {THEME_PATH}/design/template/catalog/category/view.phtml --> 
<div class="category-view"> 

    <div class="page-header"> 
     ... 
    </div> 

    <div class="category-nav"> 
     <?php echo $this->getChildHtml('catalog.leftnav'); ?> 
    </div> 

    <div class="category-content"> 
     ... 
     <?php echo $this->getProductListHtml(); ?> 
     ... 
    </div> 

</div> 

款式你喜歡。希望有所幫助。

+0

當然,我非常專注於使用2columns模板。當你第一次得到這個想法時很簡單。非常感謝你。 – 2013-02-16 07:54:33

+0

@Nathan Stokes:這可以用於右列而不是左列嗎?我沒有使用分層導航,但我希望在右側顯示購物車邊欄,類別標題和說明(和/或靜態塊)跨越整個寬度。我嘗試了幾件事情,但它不起作用。任何想法?謝謝。 – todd 2013-12-04 21:11:34

相關問題