magento1.3模板升级1.4模板兼容教程

根据官方的跟新日志的提示,我做了如下实践,将1.3.2.4升级至1.4.0.1稳定版。

1.我们可以详细的对比下1.3与1.4文件的区别,文件内容的区别,不一样的就替换成新版本的内容

2.用1.4catalog/product/list/toolbar.phtml 文件替换掉1.3的文件内容

3.观察1.4中catalog.xml文件内容与1.3中的区别

4. 在catalog.xml文件中的<catalog_category_default> 与 <catalog_category_layered>这两处(注意是两处都要修改)我们观察下就发现了区别

第一步,将

<block type="page/html_pager" name="product_list_toolbar_pager"/>

加在

<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">

后面(有两处

第二步,将

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

后面(有两处

5.用1.4 page\html\pager.phtml文件替换掉1.3的文件

6.经过如上步骤,我的模板已经可以在1.4.0.1上跑了,没有发现什么问题(没有无法分页的问题),如发现新的问题,告诉我,我会更新这个文章,谢谢

在1.4.1.1上可能还是会出现:Fatal error: Call to a member function toHtml() on a non-object in /home/******/public_html/store/app/code/core/Mage/Core/Model/Layout.php on line 529

的错误,进入 app/design/frontend/模版包/模版/layout/page.xml 中 将

<block type="core/profiler" output="toHtml"/>

改为

<block type="core/profiler" output="toHtml" name="core_profiler"/>

转载标明出处:右兜钥匙 hellokeykey.com

《magento1.3模板升级1.4模板兼容教程》有17个想法

  1. 今天又做的时候,发现在1.4中出现分页功能丢失的功能.
    于是远在国外的钥匙帮我看了下.
    写下的下面的博文:
    [url]http://www.hellokeykey.com/magento-1-3-theme1-4-theme/[/url]

    我又测试了一次.依然发现丢失分页功能.
    再多次对比1.3和1.4模板的区别后我才修复成功.
    现公布代码如下:
    [b]Category default layout[/b][code]        <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="page/html_pager" name="product_list_toolbar_pager">
                        <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        </block>
                        <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                         <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>
                    </block>
                </block>
            </reference>[/code][b]Category layered navigation layout[/b][code]        <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="page/html_pager" name="product_list_toolbar_pager">
                        <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        </block>
                        <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                         <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>
                    </block>
                </block>
            </reference>[/code]

  2. 你好!在按照你的提示做了模板升级后,我的CSS文件路径不能被识别但被“http://127.0.0.1/magento/skin/frontend/base/default/css/styles.css”系统自带的样式替代了,然打印样式“http://127.0.0.1/magento/skin/frontend/w/hellomini/css/print.css”却可地址却可以正确显示。我想问下是怎么回事?

  3. 你好,我按着你的方式修改了,但部分产品页面在打开时,还是会出现Fatal error: Call to a member function toHtml() on a non-object in /home/******/public_html/store/app/code/core/Mage/Core/Model/Layout.php on line 529,请问这是什么原因呢

  4. 这个连接可以参考一下,http://php.quicoto.com/upgrade-theme-pager-to-magento-1-4/ 我是照这个搞定没有分页的问题的。

  5. zane,确实存在CSS路径错误的问题。虽然分页有了,还是要把PAGER文件的CSS内容改回原来的。

  6. Pingback: magento学习索引

评论已关闭。