How to display category image in top navigation menuDisplay Magebuzz Category Sidebar Navigation only on home menuExclude a specific categoryTop Menu cache problemCreate categories through installerHow to add custom attributes as top navigation menu items?How to add custom top menu navigation link not categoryMagento 1.9.2.4: Show category images in top navigation menuHow To Display Placeholder Image In CategoryDisplay child categories in the top menu in magento 1.9Magento 1.9 How to display subcategory image in top navigation menu
Looking after a wayward brother in mother's will
Is a hash a zero-knowledge proof?
How can a single Member of the House block a Congressional bill?
Accidentally cashed a check twice
Grep complete name including dot in the word
Can a rogue effectively triple their speed by combining Dash and Ready?
Can an old DSLR be upgraded to match modern smartphone image quality
Are grass strips more dangerous than tarmac?
If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?
Creating Fictional Slavic Place Names
The original word for a wild boar
What is the intuition behind uniform continuity?
Why is there a need to modify system call tables in Linux?
Why does the UK have more political parties than the US?
arcpy.GetParameterAsText not passing arguments to script?
The oldest tradition stopped before it got back to him
Where can I find the list of all tendons in the human body?
Applicants clearly not having the skills they advertise
Why use water tanks from a retired Space Shuttle?
Is the world in Game of Thrones spherical or flat?
California: "For quality assurance, this phone call is being recorded"
Why don't I have ground wiring on any of my outlets?
'chmod' would set file permission to 000 no matter what permission I try to set
Expenditure in Poland - Forex doesn't have Zloty
How to display category image in top navigation menu
Display Magebuzz Category Sidebar Navigation only on home menuExclude a specific categoryTop Menu cache problemCreate categories through installerHow to add custom attributes as top navigation menu items?How to add custom top menu navigation link not categoryMagento 1.9.2.4: Show category images in top navigation menuHow To Display Placeholder Image In CategoryDisplay child categories in the top menu in magento 1.9Magento 1.9 How to display subcategory image in top navigation menu
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have used below code to override category menu but unable to add category image in top menu.
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child)
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass)
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
. $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren())
if (!empty($childrenWrapClass))
$html .= '<div class="' . $childrenWrapClass . '">';
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass))
$html .= '</div>';
$html .= '</li>';
$counter++;
return $html;
i have applied many solutions but no luck. Can anyone help?
magento-1.9
add a comment |
I have used below code to override category menu but unable to add category image in top menu.
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child)
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass)
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
. $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren())
if (!empty($childrenWrapClass))
$html .= '<div class="' . $childrenWrapClass . '">';
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass))
$html .= '</div>';
$html .= '</li>';
$counter++;
return $html;
i have applied many solutions but no luck. Can anyone help?
magento-1.9
add a comment |
I have used below code to override category menu but unable to add category image in top menu.
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child)
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass)
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
. $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren())
if (!empty($childrenWrapClass))
$html .= '<div class="' . $childrenWrapClass . '">';
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass))
$html .= '</div>';
$html .= '</li>';
$counter++;
return $html;
i have applied many solutions but no luck. Can anyone help?
magento-1.9
I have used below code to override category menu but unable to add category image in top menu.
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
$html = '';
$children = $menuTree->getChildren();
$parentLevel = $menuTree->getLevel();
$childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
$counter = 1;
$childrenCount = $children->count();
$parentPositionClass = $menuTree->getPositionClass();
$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
foreach ($children as $child)
$child->setLevel($childLevel);
$child->setIsFirst($counter == 1);
$child->setIsLast($counter == $childrenCount);
$child->setPositionClass($itemPositionClassPrefix . $counter);
$outermostClassCode = '';
$outermostClass = $menuTree->getOutermostClass();
if ($childLevel == 0 && $outermostClass)
$outermostClassCode = ' class="' . $outermostClass . '" ';
$child->setClass($outermostClass);
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'
. $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren())
if (!empty($childrenWrapClass))
$html .= '<div class="' . $childrenWrapClass . '">';
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass))
$html .= '</div>';
$html .= '</li>';
$counter++;
return $html;
i have applied many solutions but no luck. Can anyone help?
magento-1.9
magento-1.9
asked Mar 27 '17 at 10:23
user52327user52327
111
111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Hi finally i got the answere:
$splittedArray = explode($delimiter = 'category-node-', $child->getId());
$category = Mage::getModel('catalog/category')->load(end($splittedArray));
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
if (!empty($category->getData('image')))
$html .= '<div> ';
$html .= "<a href=" . $category->getURL() . " title =" . $category->getName() . ">";
$html .= "<img src=" . Mage::getBaseUrl('media') . 'catalog/category/' . $category->getData('image') . " alt=" . $category->getName() . " >";
$html .= "</a>";
$html .= '</div>';
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166323%2fhow-to-display-category-image-in-top-navigation-menu%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Hi finally i got the answere:
$splittedArray = explode($delimiter = 'category-node-', $child->getId());
$category = Mage::getModel('catalog/category')->load(end($splittedArray));
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
if (!empty($category->getData('image')))
$html .= '<div> ';
$html .= "<a href=" . $category->getURL() . " title =" . $category->getName() . ">";
$html .= "<img src=" . Mage::getBaseUrl('media') . 'catalog/category/' . $category->getData('image') . " alt=" . $category->getName() . " >";
$html .= "</a>";
$html .= '</div>';
add a comment |
Hi finally i got the answere:
$splittedArray = explode($delimiter = 'category-node-', $child->getId());
$category = Mage::getModel('catalog/category')->load(end($splittedArray));
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
if (!empty($category->getData('image')))
$html .= '<div> ';
$html .= "<a href=" . $category->getURL() . " title =" . $category->getName() . ">";
$html .= "<img src=" . Mage::getBaseUrl('media') . 'catalog/category/' . $category->getData('image') . " alt=" . $category->getName() . " >";
$html .= "</a>";
$html .= '</div>';
add a comment |
Hi finally i got the answere:
$splittedArray = explode($delimiter = 'category-node-', $child->getId());
$category = Mage::getModel('catalog/category')->load(end($splittedArray));
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
if (!empty($category->getData('image')))
$html .= '<div> ';
$html .= "<a href=" . $category->getURL() . " title =" . $category->getName() . ">";
$html .= "<img src=" . Mage::getBaseUrl('media') . 'catalog/category/' . $category->getData('image') . " alt=" . $category->getName() . " >";
$html .= "</a>";
$html .= '</div>';
Hi finally i got the answere:
$splittedArray = explode($delimiter = 'category-node-', $child->getId());
$category = Mage::getModel('catalog/category')->load(end($splittedArray));
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
if (!empty($category->getData('image')))
$html .= '<div> ';
$html .= "<a href=" . $category->getURL() . " title =" . $category->getName() . ">";
$html .= "<img src=" . Mage::getBaseUrl('media') . 'catalog/category/' . $category->getData('image') . " alt=" . $category->getName() . " >";
$html .= "</a>";
$html .= '</div>';
answered Mar 27 '17 at 13:17
user52338user52338
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166323%2fhow-to-display-category-image-in-top-navigation-menu%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown