Can't add layered navigation block into CMS page - magento

I need to show new products on a CMS page. It works fine. Then I need to add the layered navigation block on the left to filter out the selection. But it never works. I add this code into the Layout Update XML field:
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left.phtml"></block>
</reference>
I tried with block type core/template, but it still doesn't work. Does anyone know why it never works?

you can not call layer navigation using this type of code.For layer navigation on cms yo
u need a category or if you do not have category then put root category id,whose id 2(Default category)
here details of link
https://stackoverflow.com/questions/21241181/cms-page-with-layered-navigation-not-working/21242296#21242296https://stackoverflow.com/questions/21241181/cms-page-with

Related

Magento top navigation in CMS page

I need to display magento top navigation in a CMS page. How is it possbile to call the nested layout xml in cms format like {{block type="page/html_topmenu" template="page/html/topmenu.phtml"}}
Layout xml for top navigation
<block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml">
<block type="page/html_topmenu_renderer" name="catalog.topnav.renderer" template="page/html/topmenu/renderer.phtml"/>
</block>
You need to do small modification in the topmenu.phtml file of your current theme. Here is the complete description for your solution.
You can reorder the category menu and cms page menu with the solution
Go to system -> Permisisons -> Block and make sure the block "page/html_topmenu" is allowed.

Adding a block to magento category page using local.xml

Before posting this, i have looked in to the following, but all of them did not helped me and i was not able to add the block.
magento - adding and positioning a block using local.xml
Magento - Add phtml file to layout block
Magento 1.7:Show category image on category page in full width in a 2 column template
I want to add the category image on top of the page. Currently it is displayed under the product list view, and i want it to be above the left navigation, so that it takes full page width.
I created a template file in mytheme/template/catalog/category/image.phtml and i just added some text "I am here".
After that i add the following xml to my local.xml file under catalog_category_default
<reference name="content">
<block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>
But it is still not working and the text is not displayed there. When this text is displayed, then i will display the category image, but for now i just want to make the block working and display it on top of the page.
Thank you
Maybe your category does not load the layout handle catalog_category_default. There are 2 handles for categories _default and _layered.
To make sure you cover both cases and so you won't duplicate markup try this approach.
define your custom handle.
<my_awsome_category_handle>
<reference name="content">
<block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>
</my_awsome_category_handle>
Then include that handle in both category handles.
<catalog_category_default>
<update handle="my_awsome_category_handle" />
</catalog_category_default>
<catalog_category_layered>
<update handle="my_awsome_category_handle" />
</catalog_category_layered>

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

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

Adding custom Magento menu

I've looked for literally over an hour and cannot find an answer to a seemingly simple task. I want to add links to a custom menu that link to pages within Magento, as opposed to a category page.
Does anyone have an answer?
Thanks in advance.
Do you want it to automatically generate the page links?
If not you could just use a static block to create your menu, and then add the block to your layout.
1) Create a new static block with name: left_menu andd add the HTML to the static block.
2) Add this layout update to show the block in the left column:
<reference name="left">
<block type="cms/block" name="left_menu_block" before="-">
<action method="setBlockId"><block_id>left_menu</block_id></action>
</block>
</reference>

Move Layered Navigation below Widget/Banner display

I am on EE but I believe the issue is the same for CE. What I want to do seems very simple. I want all banners in the left hand navigation on a category page to appear above the filter navigation. What I have tried is to change the XML file (search.xml in the case of EE, catalog.xml in the case of CE) by adding the after="-" call.
<catalog_category_layered>
<reference name="left">
<remove name="catalog.leftnav"/>
<block type="enterprise_search/catalog_layer_view" name="enterprisecatalog.leftnav" template="catalog/layer/view.phtml" after="-" />
</reference>
</catalog_category_layered>
However this does not change anything and Banners still load below Layered Navigation.
If I set the Widget to load in the left column on "All Pages", it will load properly at the top of the column. This solution is undesirable because it also loads the widget on the home page. We only want this to affect Category Pages.
I can also remove the XML block all together and load it as a banner in the widget which allows me to position it anywhere in the left column. This is also undesirable as it breaks our AJAX loading of the page when a layered navigation option is selected.
Does the widget/banner block have a name so I can say after="widget.banner.block.name" in the XML?
The only way I found to do this was to use JQuery to push the Widget containing the banners above the Layered Navigation after load.
//Move Category Widget zone above the layered navigation
jQuery(".catalog-category-view .col2-left-layout .col-left .widget").insertBefore(jQuery(".catalog-category-view .col2-left-layout .col-left .block-layered-nav"));
You should give your blocks names, and then order them as you wish like so:
<block type="whatever" name="something" as="something"
template="bla.phtml" before="-" />
<block type="whatever" name="something_else" as="something_else"
template="bla.phtml" after="something" />
<block type="whatever" name="something_new" as="something_new"
template="bla.phtml" after="something_else" />
If you wanted to show the widget on all pages APART from the home page you can set it to show on all pages, and then remove from the homepage only like this:
1) goto CMS -> Pages, then edit homepage
2) add layout update to the page, and specifically remove the widget block:
<reference name="left">
<action method="unsetChild"><alias>child_block_name</alias></action>
</reference>

Resources