Magento:将cms块移到顶部

时间:2013-11-23 12:42:48

标签: php xml facebook magento block

我是Magento的新手,经过一番努力,我设法为我的Facebook Likebox创建了一个CMS块,并通过编辑我插入的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中放置它以及放入模板中的内容=&#34;&#34;。

我的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>

希望有人能够提供帮助,因为它是启动网站的最后一步。

1 个答案:

答案 0 :(得分:0)

将它放在catalog.xml中的<reference name="right">的开头,并以这种方式定义属性

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