开发者

How to create drop down in Magento

开发者 https://www.devze.com 2023-02-09 05:32 出处:网络
I am new on Magento. I want to create a dropdown for menu in Magento. When we take mouse oven main menu it will show drop down that display sub menu.

I am new on Magento. I want to create a dropdown for menu in Magento. When we take mouse oven main menu it will show drop down that display sub menu.

Header navigation manage by top.phtml

location:app/design/frontend/default/shalu_theme/template/catalog/navigation/top.phtml

In header it shows three main category and also showing sub category on frontend. In admin I am having three main category given 开发者_StackOverflowbelow

Admin->Catalog->Select Manage Category

      CATEGORY:
              Furniture(6)
              Electronics(42)
              Apparel(66) 

I want to create a drop down menu mean that these three main category as a main header navigation. And sub category should be shown in drop down.


Well ofcorse this is possible, but it isn't really a "Magento" thing to show a "dropdown" menu.

By default Magento is showing a tree in the 'page/html/header.phtml' where $this->getchild('topmenu') is loaded. From there you can play with CSS/JS to make it a dropdown menu you wish.


Add this code

<option value="<?php echo $this->getOrderUrl('name', 'asc') ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
Name A-Z
</option>

<option value="<?php echo $this->getOrderUrl('name', 'desc') ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
Name Z-A
</option>

<option value="<?php echo $this->getOrderUrl('price', 'asc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
Price - Low to High
</option>

<option value="<?php echo $this->getOrderUrl('price', 'desc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
Price - High to Low
</option>

<option value="<?php echo $this->getOrderUrl('entity_id', 'desc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
Newest Products
</option>

<option value="<?php echo $this->getOrderUrl('entity_id', 'asc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
Oldest Products
</option>
0

精彩评论

暂无评论...
验证码 换一张
取 消