Magento 1.7:Show category image on category page in full width in a 2 column template

佐手、 提交于 2019-12-07 16:36:07

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/14186458/magento-1-7show-category-image-on-category-page-in-full-width-in-a-2-column-tem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!