Jump to content
thirty bees forum

How to add category short description


zimmer-media

Recommended Posts

If you want a category short description above product list and category long description under product list. Example:

step 1 - database add to "prefixcategorylang" catshortdescription - varchar(180) - utf8mb4unicodeci - yes - NULL

after 0_1521237706384_database after.png

step 2.1 modify the file “Category.php” from “/classes/Category.php”, preferably in the folder classes Override “/override/classes/Category.php” save find the line /** @var string Description */ public $description; add this /** @var string Short Description */ public $cat_short_description;

step 2.2 find the line 'description' => ['type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'], add this 'cat_short_description' => ['type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'],

step 3 change or copy your AdminCategoriesController.php from controllers / admin / to under override / controllers / admin / AdminCategoriesController.php for example and find the code (depending on where this additional field should appear.)

find the lines 'type' => 'categories', 'label' => $this->l('Parent category'), 'name' => 'id_parent', 'tree' => [ 'id' => 'categories-tree', 'selected_categories' => $selectedCategories, 'disabled_categories' => (!Tools::isSubmit('add'.$this->table) && !Tools::isSubmit('submitAdd'.$this->table)) ? [$this->_category->id] : null, 'root_category' => $context->shop->getCategory(), ], ], an add [ 'type' => 'textarea', 'label' => $this->l('Short Description'), 'name' => 'cat_short_description', 'autoload_rte' => true, 'lang' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', ],

0_1521239826130_95077859-8c87-4ac0-a0fb-5664aff233b6-grafik.png

step 4 if you want to see this field in your frontoffice categorys view - in your theme category.tpl add and change codes

add this under your

tag ```
{$category->cat_short_description}

at last move or change the full description under the pagination eg {if ($description)}

{$category->description}
            {/if}

```

0_1521239890090_5ab926f4-866e-4b49-89db-51000c7990be-grafik.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...