簡體   English   中英

Magento:將cms塊移到頂部

[英]Magento: moving a cms block to top

我是Magento的新手,經過一番掙扎,我設法為我的Facebook Likebox創建了一個CMS塊,並通過編輯2columns-right.phtml.使其顯示在目錄側邊欄上2columns-right.phtml. 我在其中插入以下代碼:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('fbfanbox')->toHtml() ?> 

`

但是,likebox始終顯示在底部,並且不知道如何更改將其向上移動的順序。 經過研究,我得出的結論是,必須查看catalog.xml來進行CMS塊排序。 我知道塊代碼行應該是這樣的:

<block type="cms/block" name="fbfanbox" before="-" template="don't know what to put here"/>

但是我沒有在catalog.xml中放置它以及在template =“”中放置什么。

我的catalog.xml看起來像:

<layout version="0.1.0">
<default>

    <!-- Mage_Catalog -->
    <reference name="right">
        <!--<block type="core/template" name="left.permanent.callout" template="callouts/left_col.phtml">
            <action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
            <action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action>
            <action method="setLinkUrl"><url>checkout/cart</url></action>
        </block>-->
    </reference>
    <reference name="right">
        <block type="catalog/product_compare_sidebar" after="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
        <!--<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">
            <action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>
            <action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
        </block>-->
    </reference>
    <reference name="footer_links">
        <action method="addLink" translate="label title" module="catalog" ifconfig="catalog/seo/site_map"><label>Site Map</label><url helper="catalog/map/getCategoryUrl" /><title>Site Map</title></action>
    </reference>
    <block type="catalog/product_price_template" name="catalog_product_price_template" />
</default>
<catalog_category_default translate="label">
    <label>Catalog Category (Non-Anchor)</label>
    <reference name="right">
        <block type="catalog/navigation" name="catalog.leftnav" before="-" template="catalog/navigation/left.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">
                <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>9</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>
                    -->
                </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>

希望有人可以提供幫助,因為這是啟動網站的最后一步。

將其放置在catalog.xml中<reference name="right">的開頭,並以此方式定義before屬性

<reference name="right">
    <block type="cms/block" name="fbfanbox" before="cart_sidebar">
        <action method="setBlockId"><block_id>fbfanbox</block_id></action>
    </block>
...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM