Jumba
Jumba

Reputation: 33

How to add metadata details and description in Opencart?

Can anyone help me in adding meta data details to manufactures in opencart? I am looking for adding meta data keyword, description and manufacturer description similar to products or categories.

Upvotes: 3

Views: 888

Answers (1)

jay padaliya
jay padaliya

Reputation: 704

Open your opencart database and add the following extra field to oc_manufacturer table

ALTER TABLE oc_manufacturer ADD COLUMN `description` text NOT NULL;
ALTER TABLE oc_manufacturer ADD COLUMN `meta_title` varchar(255) NOT NULL;
ALTER TABLE oc_manufacturer ADD COLUMN `meta_description` varchar(255) NOT NULL;
ALTER TABLE oc_manufacturer ADD COLUMN `meta_keyword` varchar(255) NOT NULL;

Edit manufacturer controller file and below code

Edit file: catalog/controller/product/manufacturer.php

Find code:

$this->document->setTitle($manufacturer_info['name']);

Replace below code with that:

$this->document->setTitle($manufacturer_info['meta_title']);
$this->document->setDescription($manufacturer_info['meta_description']);
$this->document->setKeywords($manufacturer_info['meta_keyword']);
$data['description'] = $manufacturer_info['description'];

Now edit view file of manufacturer products

Edit file: catalog/view/theme/[ACTIVE THEME]/template/product/manufacturer_info.twig

And add description variable where you want to place the manufacturer description

{{ description }}

Note: Refresh modification by click on the refresh button in Extension -> modification page in admin panel

Now add your description and metadata into oc_manufacturer table

Upvotes: 1

Related Questions