Hot answers tagged

9

copy file from vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml and put this file in your theme location app/design/frontend/Vendor/YourTheme/Magento_Theme/templates/html/topmenu.phtml Add below <li> structure just after <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?> line in topmenu.phtml <li ...


8

$_category = Mage::getModel('catalog/category')->load(CATEGORY-ID); $_categories = $_category ->getCollection() ->addAttributeToSelect(array('name', 'image', 'description')) ->addIdFilter($_category->getChildren()); foreach ($_categories as $_category): echo $...


4

In your theme, make this file: Your/theme/Magento_Theme/templates/html/topmenu.phtml <?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ // @codingStandardsIgnoreFile ?> <?php /** * Top menu for store * * @var $block \Magento\Theme\Block\Html\Topmenu */ ?> <?php $columnsLimit = $block-...


3

The solution is to add app/design/frontend/{Vendor}/{Theme}/web/css/source/lib/_navigation.less


3

My question would be why are you trying to use two root categories in the same store? A root category is intended to be just that, the parent of all categories which are available for use on a given store. It's a means of access control, URL construction and the list goes on. There are a vast number of places you would need to (literally) hack the core to ...


2

One way to dispaly poll in different page is using xml. You can use the following code to display pole <block type="poll/activePoll" name="right.poll"> <action method="setPollTemplate"><template>poll/active.phtml</template><type>poll</type></action> <action method="setPollTemplate"><...


2

I think i found a solution, after looking for hours onto google i found it myself. Thank you all for viewing. To Tell you its in the renderer.phtml file change it like this an it will work. $html = ''; $children = $menuTree->getChildren(); $parentLevel = $menuTree->getLevel(); $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1; $counter = ...


2

$cats = Mage::getModel('catalog/category')->getCollection()->addAttributeToFilter('level', array('gteq' => 2)); $final = array(); foreach($cats as $cat) { if($cat->getLevel() > 2 && !$cat->hasChildren()) { $final[$cat->getEntityId()] = implode(',', c_getAllCategories($cat)); } } ...


2

<?php $parentCategoryId = 107; $cat = Mage::getModel('catalog/category')->load($parentCategoryId); $subcats = $cat->getChildren(); ?> // Get 1 Level sub category of Parent category. <?php foreach(explode(',',$subcats) as $subCatid) { $_category = Mage::getModel('catalog/category')->load($subCatid); if($...


2

this question answer is completely depand on the theme but I will give you answer as RWD theme. you can directly change phtml file for this and add extra ul/li structure for your requirement. in rwd theme this file located in app/design/frontend/rwd/default/template/page/html/topmenu.phtml for your custom theme you can enable template path hint from admin ...


2

Top Navigation Menu Non-Clickable Open app/design/frontend/rwd/default/template/page/html/topmenu/renderer.phtml Edit the following line of code: // COMMENT OUT THIS LINE //$html .= '<a href="'. $child->getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'</a>'; // ...


2

For the menu you are missing some bits of css code: a.level-top:hover + ul.level0{display:block; top: 100px;} And the cart issue can be solved with jQuery like this: $(".block-cart-header).click(function(){ $(".cart-content").toggle(); });


2

Loading each category individually is a lot slower then loading all at once. It's better to load all, and then just pick the ones you need. So lets assume you have a loaded base category and want to iterate over all children recursively $baseCategory->load(3); Fetch all children, regardless of depth: $allChildren = $baseCategory->getCollection() ...


2

This depends on the classes in your own menu, but this is the <CSS> that is used in the site you refer to: #mainNav .filters .title { padding-bottom: 3px; border-bottom: 2px solid #070707; } You should try and add something similar to the Cascading Styles Sheets of your own store. You can inspect the different classes by using the element ...


2

If you go to Catalog -> Manage Categories and navigate to the categories you don't want shown (in this case tshirts, pants, skirts) and scroll all the way down on the General Information page to the bottom there is a dropdown box that will allow you to select whether or not the category is shown in the navigation.


2

Here is the code to display all the categories in a select dropdown, you may have to make some modifications depending on what you need: <select id="category" name="category"> <?php $rootCat = Mage::app()->getStore()->getRootCategoryId(); $categories = explode(',',Mage::getModel('catalog/category')->load($rootCat)->getChildren()); ...


2

if you want to remove from layered navigation tou can edit app/design/frontend/template/package/layout/catalog.xml and find: <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"> and replace with: <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/...


2

Magento 2 comes built in with the jQuery UI Menu Widget that is very poorly documented in the Magento Docs. So there is no need to pull in a 3rd party solution. The issue with this one is the lack of examples in the core code. The default jQuery implementation doesn't actually work on Magento, it kicks an error because the dom is not structured in a way that ...


2

Replace menu.xml file with this :- <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"> <menu> <add id="Magento_CatalogRule::calendardisplayproductnotification" title="New basket notification date" module="...


1

1) Create a static block for your sub category from Cms->Static Blocks 2) Open your sub category from Catalog->Manage Category. 3) Under Display Setting change Display Mode to Static block only. 4) From CMS Block select your created block. Hope this helps you.


1

Use nth-child for clearing floats, like this: .nav-primary li.level1:nth-child(6n+1) { clear: left; } You can also use this method for targeting elements after the first row of menu items: .nav-primary li.level1:nth-child(n+7) { margin-top: 20px; }


1

I found a way. It is not positioning issue. I just gave the below jquery in topmenu.phtml : <script> jQuery(document).ready(function() { jQuery('.level0 ul.level0').each(function() { jQuery(this).width(parseInt(jQuery(this).children().length * 185, 10) + 'px'); }); }); </script> Now the width is set dynamically. This answer ...


1

You need edit menu tag( miss > in <action>): <menu> <report> <children> <products> <children> <stockstatus> <title>Stock Status</title> <action></action> <sort_order>10</sort_order> ...


1

Are you looking for something like this ? http://www.magentocommerce.com/knowledge-base/entry/configuration-catalog-category-top-navigation


1

The menu is rendered in the Mage_Page_Block_Html_Topmenu_Renderer so you'll need to overwrite it's drawItem method to add HTML. A better solution is using CSS, specially the :before selector .nav-container .nav-horizontal li.level1:before { content: url('../images/icon.png'); } That should do the trick


1

.nav-primary li.level0 ul { background: #f4f0de; position: absolute; left: 0; top: 40px; z-index: 10; width: 250px; padding-left: 10px; padding-right: 10px; display: none; } That works for me perfect and it goes 10px more down.


1

The category tree should be built here: \Mage_Page_Block_Html_Topmenu::_getHtml But I recommend, to overthink your concept. Everything you want, is achievable with the n-thchild() selector.


1

Not 100% sure but I think the problem comes from the skin/frontend/tatooland/default/js/app.js file. There is this section nav.find('li.level1 a.has-children').on('click', function (e) { e.preventDefault(); e.stopPropagation(); var elem = $j(this).parent(); // Check if sub-menu is open var isSubMenuActive = elem.hasClass('sub-menu-...


1

I assume you need this for a version before 1.9 (because in 1.9 this happens by default). You need to rewrite the method Mage_Page_Block_Html_Topmenu::_getHtml After the line $html .= $this->_getHtml($child, $childrenWrapClass); you need to add something like this: if ($parentLevel == 1) { $html .= '<li><a href="<?php echo $child->...


1

I recommend to no do this. You get in a lot of trouble, when you build a graph out of a tree, because you change the whole structure. Instead just create a second category with the same name and put all the products into this. Why do you want to do this?


Only top voted, non community-wiki answers of a minimum length are eligible