Category Fields

Introduction

Category Fields for Prestashop allows you to display additional content on your category pages in a custom location on your category page, allowing you to add more content to your category pages and therefore help you optimize your SEO campaign on your site.

Installation

The installation procedure is very much similar to most other Prestashop modules. No core changes required therefore installation is straight forward, be sure to follow the instructions below to ensure a successful installation.

  1. Upload the module folder to your stores {root}/modules folder
  2. Once uploaded, login to your Prestashop Back Office and head over to the Modules section
  3. Search for the module and click Install
  4. After a successful installation, the module configuration screen is presented to you. More details on this in the next section.

Configuration

Configuring the module

After installing the module, the first thing we will need to do is create a category field. Once created you will be able to edit the content of this field for different categories across your store.

Head over to the modules page and locate the Category Fields module under the installed modules tab. From the actions list, select the option to configure the module. This will display a screen divided into two sections. The first section displays a form to create a new category field while the second section displays existing fields you have already created.

Adding a new category content field

Let’s go ahead and create a new field. Enter the name of your field, ideally in lowercase and without any symbols or spaces. If you would like this field to be displayed as a collapsible field on the category page, then enable the option. Making a field collapsible will display the category excerpt first, with a read more link which when clicked will expand the excerpt to reveal the full content of the field.

After entering the name of the field press save and the field should now appear in the existing fields list below the form. If you need to modify the name of the field or delete the field altogether you can use the action icons in the list to do so. Beware that deleting a field also deletes any content you may have created across your categories for this field.

Please note, you do not create a individual field for each category in your store here, you need only create one field, such as description_2 and then you will fill in the content for this field for each category in your store later.

Category Field Content

Now that you have created a field or fields in the module configuration, you’ll want to start adding content for those fields for the various categories across your store. To do this head over to Catalog > Categories and locate and edit the category you wish to add additional content for.

Notice on the category edit page, scrolling down a little you’ll notice a new section called Category Fields. Under this you’ll find some new form elements.

Edit category field content for a category

The first element displayed is the dropdown. The dropdown displays a list of fields you have created in the module configuration page. Select the field you wish to add content for.

Below the dropdown are two rich text editors. Content and Excerpt. Enter the full content of the additional content you wish to display on your category page in the Content editor.

The Excerpt editor is linked to the collapsible option discussed earlier. If you wish to display a short summary of the content initially and allow the customer to expand the content, enable this option and enter the summary content into the Excerpt editor.

After you have finished entering the content for your category fields, save the category as normal.

Front End Configuration

Although we have created our category field and set up the content for it, we do have one more step left before the field content will be
displayed on the category pages on the store front.

To display the content on your category page you will need to add the short code below to your category template. Your category template can be located in the file below:

{site_root}/themes/{theme_name}/templates/catalog/listing/category.tpl

In the template file above, add the short code below:

{hook h='categoryField' name='test'}

Where the name test can be replaced with the name of the category field you wish to display.

If you wish to display the code below the product list, add the following code instead:

{block name='product_list_bottom'}
    {hook h='categoryField' name='test'}
{/block}

After saving the template and clearing your Prestashop cache if necessary, the content should be visible on your category page.

Get Category Fields on Prestashop Addons site

Get Category Fields on Prestafusion