How to display subcategories on category page?Exclude a specific categoryTop Menu cache problemRecently product view not workingDisplay Subcategories in TopnavigationBackend category tree slow - manage categoriesBlocks HTML Cache & Sub Category DisplayExcluding one or more subcategory in a Category Page that displays Subcategory listget attribute option image from database magentoBetter way to list subcategories instead of productsExport Category name in xml feed Magento 1.9.2
Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?
Is the infant mortality rate among African-American babies in Youngstown, Ohio greater than that of babies in Iran?
How can the US president give an order to a civilian?
Huge Heap Table and table compression on SQL Server 2016
What could be the physiological mechanism for a biological Geiger counter?
Why are almost all the people in this orchestra recording wearing headphones with one ear on and one ear off?
Should I email my professor to clear up a (possibly very irrelevant) awkward misunderstanding?
Leveraging cash for buying car
What is the precise meaning of "подсел на мак"?
How can this shape perfectly cover a cube?
How "fast" does astronomical events happen?
Can I drive in EU states and Switzerland with German proof of a surrendered U.S. license?
Basic power tool set for Home repair and simple projects
How useful is the GRE Exam?
How did space travel spread through the galaxy?
Is it a bad idea to have a pen name with only an initial for a surname?
How do I become a better writer when I hate reading?
Is it possible for underground bunkers on different continents to be connected?
At what temperature should the earth be cooked to prevent human infection?
The instant an accelerating object has zero speed, is it speeding up, slowing down, or neither?
What is this plant I saw for sale at a Romanian farmer's market?
How to make all magic-casting innate, but still rare?
Is swap gate equivalent to just exchanging the wire of the two qubits?
Is there any effect in D&D 5e that cannot be undone?
How to display subcategories on category page?
Exclude a specific categoryTop Menu cache problemRecently product view not workingDisplay Subcategories in TopnavigationBackend category tree slow - manage categoriesBlocks HTML Cache & Sub Category DisplayExcluding one or more subcategory in a Category Page that displays Subcategory listget attribute option image from database magentoBetter way to list subcategories instead of productsExport Category name in xml feed Magento 1.9.2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have used this code in view.phtml to display subcategories on category page
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<li><a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?></a></li>
<?php endforeach ?>
but this is obviously displaying only the list of subcategories, I want image and same view as products on category page
Desired Result

Getting this

Favorite community please help :)
magento-1.9 category-tree category-page
add a comment |
I have used this code in view.phtml to display subcategories on category page
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<li><a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?></a></li>
<?php endforeach ?>
but this is obviously displaying only the list of subcategories, I want image and same view as products on category page
Desired Result

Getting this

Favorite community please help :)
magento-1.9 category-tree category-page
add a comment |
I have used this code in view.phtml to display subcategories on category page
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<li><a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?></a></li>
<?php endforeach ?>
but this is obviously displaying only the list of subcategories, I want image and same view as products on category page
Desired Result

Getting this

Favorite community please help :)
magento-1.9 category-tree category-page
I have used this code in view.phtml to display subcategories on category page
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<li><a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?></a></li>
<?php endforeach ?>
but this is obviously displaying only the list of subcategories, I want image and same view as products on category page
Desired Result

Getting this

Favorite community please help :)
magento-1.9 category-tree category-page
magento-1.9 category-tree category-page
edited Jun 9 at 12:58
Ahmed Zameer
3610
3610
asked May 4 '17 at 10:26
Sanya ZahidSanya Zahid
13212
13212
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try to make a var dump of "$_subcat" inside the foreach:
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<?php var_dump($_subcat->getData()); die(); ?>
<?php endforeach ?>
You will display all the options available to use.
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
add a comment |
Use below code
$_category = Mage::registry('current_category');
$subcategories = Mage::getModel('catalog/category')->getCategories($_category->getId());
foreach ($subcategories as $subcategory) ?>
<li><a href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName() ?></a></li>
<?php
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
|
show 3 more comments
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%2f173005%2fhow-to-display-subcategories-on-category-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to make a var dump of "$_subcat" inside the foreach:
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<?php var_dump($_subcat->getData()); die(); ?>
<?php endforeach ?>
You will display all the options available to use.
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
add a comment |
Try to make a var dump of "$_subcat" inside the foreach:
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<?php var_dump($_subcat->getData()); die(); ?>
<?php endforeach ?>
You will display all the options available to use.
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
add a comment |
Try to make a var dump of "$_subcat" inside the foreach:
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<?php var_dump($_subcat->getData()); die(); ?>
<?php endforeach ?>
You will display all the options available to use.
Try to make a var dump of "$_subcat" inside the foreach:
<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>
<?php var_dump($_subcat->getData()); die(); ?>
<?php endforeach ?>
You will display all the options available to use.
answered May 4 '17 at 10:34
Andrea RivadossiAndrea Rivadossi
211
211
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
add a comment |
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
not working <br> array(7) ["entity_id"]=> string(2) "46" ["name"]=> string(2) "LG" ["path"]=> string(12) "1/2/14/45/46" ["is_active"]=> string(1) "1" ["is_anchor"]=> string(1) "0" ["request_path"]=> string(36) "tv-and-home-theater/shop-by-brand/lg" ["id"]=> string(2) "46"
– Sanya Zahid
May 4 '17 at 10:37
add a comment |
Use below code
$_category = Mage::registry('current_category');
$subcategories = Mage::getModel('catalog/category')->getCategories($_category->getId());
foreach ($subcategories as $subcategory) ?>
<li><a href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName() ?></a></li>
<?php
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
|
show 3 more comments
Use below code
$_category = Mage::registry('current_category');
$subcategories = Mage::getModel('catalog/category')->getCategories($_category->getId());
foreach ($subcategories as $subcategory) ?>
<li><a href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName() ?></a></li>
<?php
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
|
show 3 more comments
Use below code
$_category = Mage::registry('current_category');
$subcategories = Mage::getModel('catalog/category')->getCategories($_category->getId());
foreach ($subcategories as $subcategory) ?>
<li><a href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName() ?></a></li>
<?php
Use below code
$_category = Mage::registry('current_category');
$subcategories = Mage::getModel('catalog/category')->getCategories($_category->getId());
foreach ($subcategories as $subcategory) ?>
<li><a href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName() ?></a></li>
<?php
answered May 4 '17 at 10:44
Akhil GuptaAkhil Gupta
1,6211721
1,6211721
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
|
show 3 more comments
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
not working :/ ...
– Sanya Zahid
May 4 '17 at 11:49
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
Try using direct category ID instead: $_category->getId()
– Akhil Gupta
May 5 '17 at 4:35
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
still getting names only, i want images
– Sanya Zahid
May 5 '17 at 7:26
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
For image use: <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $subcategory->getThumbnail(); ?>" alt="" /> inside foreach loop
– Akhil Gupta
May 5 '17 at 8:54
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
ibb.co/cpBFkk
– Sanya Zahid
May 5 '17 at 13:10
|
show 3 more comments
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%2f173005%2fhow-to-display-subcategories-on-category-page%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