Custom top level category landing page in magento - magento

Within our magento site we have the root category for the shop (this is just "default category"). Under this we have set-up some top-level categories (let's for example call these "electronics" and "furniture"), with a bunch of sub categories.
So as an example our category structure might be
Electronics
DVD players
MP3 Players
Computers
Furniture
3 Piece's
Armchairs
Tables
Sofabeds
I have managed to edit the layout/template for the "sub categories" such as "dvd players" so that we display a custom product list view.
Now what we want to do, is for the top level categories (the very first categories under the root category), is display a custom grid of all the subcategories and their associated thumbnail images, not the product list!
How do i assign a completely different template just for those top level categories?
If someone could provide an insight on how to do this and the step's we need to take (i should be ok with the code itself, its just how to implement it such as custom modules and templates)
Thanks

Sounds like you want a custom page layout that you can apply to your top level categories. A page layout is essentially a named page template that you can select in a dropdown to apply to products or categories.
To define a layout, add it in the global/page/layouts node of a module's config.xml, like so:
<global>
<page>
<layouts>
<my_custom_layout_name translate="label">
<label>My Custom Layout</label>
<template>page/my-custom-layout.phtml</template>
<layout_handle>my_custom_layout</layout_handle>
</my_custom_layout_name>
<layouts>
<page>
<global>
Then you just need to create the page/my-custom-layout.phtml template file somewhere in the app/design template fallback chain.
The layout_handle node specifies the name of a new layout handle that will be added to any page that uses this layout, allowing you to target it in layout XML files with a <my_custom_layout> node.
The .phtml file you're referencing will be the template for the entire HTML page, so it should include <html>, <head>, <body> tags and anything else you'd find in one of the default page/*.phtml templates (1column, empty, 2columns-left, etc). Between this and targeted layout XML, you can completely customize this page from scratch.
The final step is just to select this new layout under the "Custom Design" tab when editing each of your parent categories in Catalog->Manage Categories. If you don't see your layout in the dropdown, make sure your XML is configured properly (see app/code/core/Mage/Page/etc/config.xml for reference) and refresh your cache.

One way to do this would be to create a new template which which will be your category grid, then call that template as a static block on your selected categories, which you will select via the CMS. See below.
Create the category grid template
Navigate to “app/design/frontend/default/TEMPLATE/catalog/navigation”
In this path, we will create a file call category_listing.phtml
This file will have the following code:
<?php $_maincategorylisting=$this->getCurrentCategory()?>
<?php $_categories=$this->getCurrentChildCategories()?>
<h2><?php echo $this->__('Browse Products') ?> </h2>
<div class="subcat-listing">
<ul class="subcat-products">
<? foreach ($_categories as $_category):?>
<? if($_category->getIsActive()): ?>
<?php $cur_category=Mage::getModel('catalog/category')->load($_category->getId()); ?>
<?php $layer = Mage::getSingleton('catalog/layer'); ?>
<?php $layer->setCurrentCategory($cur_category); ?>
<? if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?>
<li> <a href="<?php echo $this->getCategoryUrl($_category) ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
<img src="<?php echo $_imageUrl ?>" width="auto" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
</a>
<h3><?php echo $this->htmlEscape($_category->getName()) ?></h3>
<? if($_description=$this->getCurrentCategory()->getDescription()):?>
<p class="category-description">
<?php echo $_description ?></</p>
<?php endif; ?>
<? endif; ?>
<? endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php $layer->setCurrentCategory($_maincategorylisting); ?>
Call this template in a static block
Go to the menu “CMS/Static block” and create new block.
Add this to the content section of the CMS block:
{{block type="catalog/navigation" name="catalog.categories" template="catalog/navigation/category_listing.phtml"}} . Then save the block.
Use this static block on category pages.
Go to the menu Catalog/Manage Categories
Now we need find the category that we want to show the new grid on
Select the categorie that you want, and in the tab“DISPLAY SETTINGS we set the following information:
DISPLAY MODE: STATIC BLOCK
CMS Block: Category Listing (the block that we create before)
Is Anchor: NO
Click SAVE. Remember that in the tab “Custom Design” you may need select your template. Remember also that the category much have an image assigned to it.

Related

How to get the magento category meta description on catalog list page

I want to show the category description of each category dynamically on category list page. First I try to set condition for each category but that was not perfect solution late I found a best way to do this so I thought I should share it to prevent someone time.
By using below code you can check the current category on catalog list template of your theme.
$metaDescription = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getMetaDescription();
if(!empty($metaDescription)): ?>
<div class="col-md-12 std">
<p><?php echo $metaDescription; ?></p>
</div>
<?php endif; ?>
Follow the screenshot to add meta description of category in magento admin section.

Joomla 3.36 - Browser Page title

Hi I go to menu page display and enter text into the Browser Page title field but
It does not change the browser page title.
Does anyone have any ideas what could create this issue?
I've had this situation occur most frequently with 3rd party components. Joomla stores these values when you specify them in the menu item, but it's up to the component whether or not they're used. Below is the code I've added to the template overrides. If you don't know how to override template output, you should read How to override the output from the Joomla! core first.
Put this code before any other HTML code in the template override file. It checks to see if you've specified to show the page headings or not, and if so, it will use that, otherwise it will use whatever the menu title is.
<?php if ($this->params->get('show_page_heading',1)) : ?>
<h1><?php echo $this->params->get('page_heading') ? $this->params->get('page_heading') : JFactory::getApplication()->getMenu()->getActive()->title; ?></h1>
<?php endif; ?>
To see how Joomla does it by default, look at components\com_content\views\article\tmpl\default.php
<div class="item-page<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;

add description grid list on theme mobile shoppe

i try to add "short description" on my category list of my products but nothing happend on my list.phtml
i try on: app/design/frontend/base/default/template/catalog/product/list.phtml
in my lit view are there this code:
(and i copy this code to grid block but nothing happend)
<div class="desc std">
<h1>test</h1>
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
<?php echo $this->__('Learn More') ?>
</div>
Go to Catalog->Attributes->Manage attributes, search for the short_description attribute, edit it and set the field Used in product listing to Yes. Reindex everything and it should work.
[EDIT]
Or you can simply use this:
<?php echo $_product->getShortDescription();?>

How do I add pages to menu?

I am new to Magento; now I am trying to develop a simple example site.
My question is this: how can we add pages to main menu?
create one static block with "Your page name"
Create new category with display mode "Static block only" and "include in navigation menu = YES" and select your cms block and save category. And see in front-end side this will be added in navigation item.
Here is the official Magento recommendation on how to do this: http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar
To add a CMS page link to top navigation the hard way, you should override /mnt/www/x1886/app/design/frontend/default/default/template/catalog/navigation/top.phtml.
There are plenty tutorials out there about how to override files in Magento.
Change a change where I placed a comment:
<div class="header-nav-container">
<div class="header-nav">
<h4 class="no-display"><?php echo $this->__('Category Navigation:') ?></h4>
<ul id="nav">
<!-- ADD ADDITIONAL LINKS HERE -->
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
</ul>
</div>
<?php echo $this->getChildHtml('topLeftLinks') ?>
</div>

How to exclude 'out of stock' items from the front page?

I'm currently using Magento 1.1.6. My store only sells unique items (shirts with exclusive designs) which means at any one time, only 1 unit is available for each items.
How do I omit those items which are already sold from being displayed in the front page?
BTW, I'm using these code to show products on the front page:
{{block type="catalog/product_list" category_id="3" template="catalog/product/list_home_batik.phtml"}}
Go to System>Configuration>Catalog>Inventory>Stock Options. the dropdown for "Display Out of Stock Products" change to No.
I supposed the file catalog/product/list_home_batik.phtml is based on catalog/product/list.phtml
You can modify the file catalog/product/list_home_batik.phtml by adding
<?php if($_product->isSaleable()): ?>
just after
<?php foreach ($_productCollection as $_product): ?>
and by adding
<?php foreach ($_productCollection as $_product): ?>
just before
<?php endforeach; ?>
If it doesn't work, you should provide the complete file so I can have a look at it.

Resources