如何在 Magento 中创建下拉菜单

发布于 2024-10-16 00:41:28 字数 527 浏览 2 评论 0原文

我是 Magento 的新手。我想在 Magento 中创建一个下拉菜单。当我们使用鼠标烤箱主菜单时,它将显示显示子菜单的下拉菜单。

标题导航由 top.phtml 管理

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

在标题中它显示了三个主要类别和还在前端显示子类别。在管理中,我在下面给出了三个主要类别

Admin->Catalog->Select Manage Category

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

我想创建一个下拉菜单意味着这三个主要类别为主标题导航。子类别应显示在下拉列表中。

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 below

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

隔纱相望 2024-10-23 00:41:28

当然这是可能的,但显示“下拉”菜单并不是真正的“Magento”事情。

默认情况下,Magento 在加载 $this->getchild('topmenu')'page/html/header.phtml' 中显示一棵树。从那里您可以使用 CSS/JS 使其成为您想要的下拉菜单。

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.

╰沐子 2024-10-23 00:41:28

添加此代码

<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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文