在CMS页面

时间:2015-06-10 08:46:23

标签: php magento

我在Magento上创建了一个扩展程序,但是当我将它包含在CMS页面中时,它不会被调用。没有错误或警告。我试图将调试行放在扩展名中,但这些行也没有显示出来。所以我认为这是一个配置问题。

这是我的config.xml文件:

<config>
<modules>
    <Medialta_Promo>
        <version>0.1.0</version>
    </Medialta_Promo>
</modules>

<global>
    <blocks>
        <promo>
            <class>Medialta_Promo_Block</class>
        </promo>
    </blocks>

    <helpers>
        <promo>
            <class>Medialta_Promo_Helper</class>
        </promo>
    </helpers>

    <models>
        <promo>
            <class>Medialta_Promo_Model</class>
        </promo>
    </models>

    <resources>
        <promo_setup>
            <setup>
                <module>Medialta_Promo</module>
                <class>Mage_Eav_Model_Entity_Setup</class>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </promo_setup>

        <promo_write>
            <connection>
                <use>core_write</use>
            </connection>
        </promo_write>
        <promo_read>
            <connection>
                <use>core_read</use>
            </connection>
        </promo_read>
    </resources>
</global>

<frontend>
    <routers>
        <promo>
            <use>standard</use>
            <args>
                <module>Medialta_Promo</module>
                <frontName>promo</frontName>
            </args>
        </promo>
    </routers>
    <layout>
        <updates>
            <promo>
                <file>promo.xml</file>
            </promo>
        </updates>
    </layout>
</frontend>

<default>
    <promo>
        <general>
            <active>0</active>
            <price_visible>1</price_visible>
        </general>
        <cmspage>
            <heading_block>Promotions</heading_block>
            <product_sort_by>random</product_sort_by>
            <number_of_items>5</number_of_items>
            <number_of_items_per_row>3</number_of_items_per_row>
            <max-image_dimension>80</max-image_dimension>
        </cmspage>
        <standalone>
            <heading>Promo</heading>
            <layout>two_colomns_right</layout>
            <meta_title>Promo</meta_title>
            <meta_description>Retrouver tous les produits en promotions</meta_description>
            <meta_keywords>promo</meta_keywords>
        </standalone>
    </promo>
</default>
</config>

这是我的模板配置:

    <?xml version="1.0"?>
<layout version="0.1.0">
    <promo_index_index>
        <reference name="content">
            <block type="core/template" name="category.products" template="medialta/promo/view.phtml">
                <block type="promo/product_list" name="promo_list" as="medialta/promo/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="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </block>
            </block>
        </reference>
    </promo_index_index>
</layout>

感谢您的帮助,我通过了几天,我不知道如何处理它。

1 个答案:

答案 0 :(得分:0)

将@VigneshBala在评论中提供的解决方案转移到答案:

布局中promo/product_list的块声明存在问题。您似乎错误地将模板路径放在as属性中,而应将其声明为template

<强>之前

<block type="promo/product_list" name="promo_list" as="medialta/promo/view.phtml">

<强>后

<block type="promo/product_list" name="promo_list" template="medialta/promo/view.phtml">