简体   繁体   English

Magento:将cms块移到顶部

[英]Magento: moving a cms block to top

I'm new to Magento and after some struggle I've managed to create a CMS block for my Facebook Likebox and get it to display on the catalogs sidebar by editing the 2columns-right.phtml. 我是Magento的新手,经过一番挣扎,我设法为我的Facebook Likebox创建了一个CMS块,并通过编辑2columns-right.phtml.使其显示在目录侧边栏上2columns-right.phtml. where i inserted the following code:` 我在其中插入以下代码:

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

` `

However the likebox is displayed all the way at the botttom and don't know how to change it's order to move it upwards. 但是,likebox始终显示在底部,并且不知道如何更改将其向上移动的顺序。 After some research I've came to the conclusion that I have to look at catalog.xml for CMS block ordering. 经过研究,我得出的结论是,必须查看catalog.xml来进行CMS块排序。 I know the block code line should be something like : 我知道块代码行应该是这样的:

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

but I don't where in the catalog.xml to put it and what to put in template="". 但是我没有在catalog.xml中放置它以及在template =“”中放置什么。

My catalog.xml looks like: 我的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>

Hopefully someone will manage to help since it's the last step towards launching the website. 希望有人可以提供帮助,因为这是启动网站的最后一步。

Place it in the beginning of <reference name="right"> in your catalog.xml and define before attribute this way 将其放置在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