Magento 1.7:在2列模板中以全宽显示类别页面上的类别图像 [英] Magento 1.7:Show category image on category page in full width in a 2 column template

查看:181
本文介绍了Magento 1.7:在2列模板中以全宽显示类别页面上的类别图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法找到运行Magento 1.7的此问题的解决方案。主列中显示的类别。我想在页面宽度上的两列上方显示它。以下是一个示例: http://www.vimodos.nl/schoenen?art_sex=92



任何有解决方案的人?
非常感谢您的回复!



更新



感谢您的光临答复。我按照你的指示在catalog.xml中添加了一个名为category.image的块

 < reference name =content> ; 
< block type =catalog / category_viewname =category.productstemplate =catalog / category / view.phtml>
< block type =catalog / product_listname =product_listtemplate =catalog / product / list.phtml>
< block type =catalog / category_imagename =category.imagetemplate =catalog / category / image.phtml>
< block type =catalog / product_list_toolbarname =product_list_toolbartemplate =catalog / product / list / toolbar.phtml>
< block type =page / html_pagername =product_list_toolbar_pager/>

之后我在/ template / catalog / category /

下创建了一个image.phtml文件

重新加载类别页面时,它是空的,没有错误消息。左侧栏中的小部件是可见的。



有什么建议吗?非常感谢!

解决方案

这似乎是Magento的内置功能。<​​/ p>

要启用它,请执行以下操作:




  • 登录管理面板

  • 转到目录 - >管理类别

  • 选择要添加图像的类别

  • 您将看到可以添加图像的位置(只需上传它)

  • 添加图片后,它会自动显示在类别页面中



更新



以下是获取类别图片的代码:

  $ category = Mage :: getModel('catalog / category') - > load($ catId); 
$ category-> getImageUrl(); //记得回复它

为了将其设置在分层导航之上,请执行以下步骤:




  • 将一个块添加到catalog.xml(在:< catalog_category_default translate =label> ; 部分。

  • 将上面的代码添加到模板文件中(您在上面的块中引用)



如果您需要进一步的帮助,请告知我们


Can't find a solution for this issue running Magento 1.7. The category shown above in the main column. I want to show it above both columns, on page width. Here is an example: http://www.vimodos.nl/schoenen?art_sex=92

Anyone with a solution? Your reply is much appreciated!

UPDATE

Thanks for the reply. I followed your instructions and added a block called category.image in the catalog.xml

    <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/category_image" name="category.image" template="catalog/category/image.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"/>

After that I created a image.phtml file under /template/catalog/category/

When reloading the category page it's empty, there is no error message. The widgets in the left side bar are visible.

Any suggestions? Many thanks!

解决方案

This seems to be a built in feature in Magento.

To enable it do the following:

  • Log in to the admin panel
  • Go to catalog->manage categories
  • Select the category you want to add an image
  • You will see a place where you can add an image (just upload it)
  • Once you add an image it will automatically show in category page

Update

Here is the code to get the category image:

$category = Mage::getModel('catalog/category')->load($catId);
$category->getImageUrl(); // remember to echo it out 

In order to set this up above layered navigation, do the following steps:

  • Add a block to the catalog.xml (in the: <catalog_category_default translate="label"> section.
  • Add the code above to the template file (that you referenced in the block above)

Let us know if you need further assistance with this

这篇关于Magento 1.7:在2列模板中以全宽显示类别页面上的类别图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆