How to show the category description for a product category page in prestashop?
I want to add a custom content for a product category page in prestashop just above the footer area.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
Step1:
Go to below file location and change “Tools::truncateString($this->category->description, 350),” to “Tools::truncateString($this->category->description, 3500),“.Otherwise it will cutoff your description .
Path: /controllers/front/CategoryController.php
$this->context->smarty->assign(array(
‘category’ => $this->category,
‘description_short’ => Tools::truncateString($this->category->description, 350),
‘products’ => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null,
‘id_category’ => (int)$this->category->id,
‘id_category_parent’ => (int)$this->category->id_parent,
‘return_category_name’ => Tools::safeOutput($this->category->name),
‘path’ => Tools::getPath($this->category->id),
‘add_prod_display’ => Configuration::get(‘PS_ATTRIBUTE_CATEGORY_DISPLAY’),
‘categorySize’ => Image::getSize(ImageType::getFormatedName(‘category’)),
‘mediumSize’ => Image::getSize(ImageType::getFormatedName(‘medium’)),
‘thumbSceneSize’ => Image::getSize(ImageType::getFormatedName(‘m_scene’)),
‘homeSize’ => Image::getSize(ImageType::getFormatedName(‘home’)),
‘allow_oosp’ => (int)Configuration::get(‘PS_ORDER_OUT_OF_STOCK’),
‘comparator_max_item’ => (int)Configuration::get(‘PS_COMPARATOR_MAX_ITEM’),
‘suppliers’ => Supplier::getSuppliers(),
‘body_classes’ => array($this->php_self.’-‘.$this->category->id, $this->php_self.’-‘.$this->category->link_rewrite)
));
Step2:
Go to below file location and add the below code end of the file and remove the below code from <div class=”content_scene_cat_bg”> section
Path: /themes/theme_niketan/category.tpl
{if Tools::strlen($category->description) > 3500}
<div id=”category_description_short” class=”rte”>{$description_short}</div>
<div id=”category_description_full” class=”unvisible rte”>{$category->description}</div>
<a href=”{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:’html’:’UTF-8′}” class=”lnk_more”>{l s=’More’}</a>
{else}
<div class=”rte”>{$category->description}</div>
{/if}