layout - Magento Insert Sub Category Navigation before breadcrumbs -


i trying create sub navigation of main navigation in magento , insert before breadcrumbs module. when navigate root catalogue sub menu of main child categories appears navigation bar above breadcrumbs below root navigation. in catalogue click root category , main categories under root category appear horizontal navigation bar below it.

i able insert under category title not above breadcrums module. created app/design/frontend/theme/template/catalog/navigation/topsub.phtml , entered following code:

<?php //get sub categories current category $_category          = $this->getcurrentcategory(); $_category_children    = $_category->getchildren(); $catids                 = explode(',',$_category_children);  $categories = array();  foreach($catids $catid) {     $category = mage::getmodel('catalog/category')->load($catid);       $categories[$category->getname()] = array(         'url' => $category->geturl(),         'img' => $category->getimageurl()     ); } ?> <ul class="subnav">     <?php if($category->getisactive()): ?>         <?php foreach($categories $name => $data): ?>             <li>                 <a href="<?php echo $data['url']; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>">                     <img src="<?php echo $data['img']; ?>" />                     <div class="category-title"><?php echo $name; ?></div>                 </a>                 <span>/ </span>             </li>            <?php endforeach; ?>     <?php endif; ?> </ul> 

in local.xml have entered

<reference name="mtopsub">  <block type="catalog/navigation" name="topsub" as="topsub" template="catalog/navigation/topsub.phtml"/>   </reference> 

in template file have called

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getlang() ?>" lang="<?php echo $this->getlang() ?>"> <head> <?php echo $this->getchildhtml('head') ?> </head> <body<?php echo $this->getbodyclass()?' class="'.$this->getbodyclass().'"':'' ?>> <?php echo $this->getchildhtml('after_body_start') ?> <div class="wrapper">     <?php echo $this->getchildhtml('global_notices') ?>     <div class="page">         <?php echo $this->getchildhtml('header') ?>         <div class="main-container col1-layout">             <div class="main">                 <div class="msubnav">                 <?php echo $this->getchildhtml('mtopsub') ?>                  </div>                 <?php echo $this->getchildhtml('breadcrumbs') ?>                 <div class="col-main">                     <?php echo $this->getchildhtml('global_messages') ?>                     <?php echo $this->getchildhtml('content') ?>                 </div>             </div>         </div>         <?php echo $this->getchildhtml('footer') ?>         <?php echo $this->getchildhtml('before_body_end') ?>     </div> </div> <?php echo $this->getabsolutefooter() ?> </body> </html> 

now until point nothing appears. if create static block , enter following code it:

<p>{{block type="catalog/navigation" name="catalog.navigation" template="catalog/navigation/topsub.phtml"}}</p> 

the sub navigation menu appears should in wrong position. instead of appearing above breadcrumbs module appears below , below category page title.

i sure missing something, if can point me in right direction appreciate it.

you're there :-)

as you're adding code layout template view, need modify layout xml add block child of root element:

layout/page.xml (or local.xml)

<reference name="root">      <block type="catalog/navigation" name="mtopsub" as="mtopsub"             template="catalog/navigation/topsub.phtml" />  </reference> 

now when call:

<?php echo $this->getchildhtml('mtopsub') ?> 

inside layout template, block available , should render correctly.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -