How to get category descrption to category list page which lists subcategories. For example I have Shoes-page which lists all subcategorys:
Nike, Adidas, Puma
Now I want to have description text on this Shoes-page like:
Nike - This is description text.
Adidas - This is description text2.
Puma - This is description text3.
At this moment description text is shown inside of Nike page, but how to get it to Shoes-page?
I see in category.tpl file thise:
<?php if ($description) { ?>
<?php echo $description; ?>
<?php } ?>
Which handels description, but do I need to place it somewhere else or what need to be done?
First you need to pass subcategories' description from controller to tpl file,
in catalog\\controller\\product\\category.php
find
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
just after this line add the following line
'description' => strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')),
Now in your tpl file that is catalog\\view\\theme\\your_theme\\template\\product\\category.tpl
you have to add <?php echo $category['description'];?>
inside the following loop
<?php foreach ($categories as $category) { ?>
<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
<?php } ?>
PS Edit your question to inital one, it was more explanatory than it is now
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.