dtxooq1020 2015-06-10 08:46
浏览 64
已采纳

在CMS页面中不调用Magento自定义扩展

I create an extension on Magento, but when I include it into a CMS page, it isn't called. There is no error or warning. I tried to put debug line in the extension, but those lines aren't displayed too. So I think that it's a configuration issue.

Here is my config.xml file:

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

And Here is my template 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>

Thanks for your help, I passed a few days on that and I have no idea to deal with it.

  • 写回答

1条回答 默认 最新

  • dounao5856 2015-06-18 16:01
    关注

    Moving the solution, provided by @VigneshBala in the comments, to an answer instead:

    There is a problem with the block declaration for promo/product_list in the layout. It looks like you have mistakenly put the template path in the as attribute, when it should be declared as template.

    Before

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

    After

    <block type="promo/product_list" name="promo_list" template="medialta/promo/view.phtml">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效