簡體   English   中英

類別列表頁面的類別描述

[英]Category description to category list page

如何獲取列出子類別的類別列表頁面的類別描述。 例如,我有列出所有子類別的鞋類頁面:

Nike, Adidas, Puma

現在我想在這個鞋子頁面上有描述文字,比如:

Nike - This is description text.
Adidas - This is description text2.
Puma - This is description text3.

此時描述文本顯示耐克頁面內,但如何將其轉到鞋頁面?

我在 category.tpl 文件中看到:

<?php if ($description) { ?>
<?php echo $description; ?>
<?php } ?>

哪個handels描述,但我需要把它放在其他地方還是需要做什么?

首先,您需要將子類別的描述從控制器傳遞到 tpl 文件,

catalog\\controller\\product\\category.php

'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),

在此行之后添加以下行

'description' => strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')),

現在在您的 tpl 文件中,即catalog\\view\\theme\\your_theme\\template\\product\\category.tpl

您必須在以下循環中添加<?php echo $category['description'];?>

<?php foreach ($categories as $category) { ?>
  <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
<?php } ?>

PS將您的問題編輯為inital one,它比現在更具解釋性

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM