Step 1 : Add the two fields into the database table needed to store the data for each information page.
for adding the Meta Description and Meta Keywords it is necessary to create the new fields into the database table named as information_description by using the PHPMyAdmin or similar to it. Run the Query given below:
ALTER TABLE `information_description` ADD `meta_description` VARCHAR( 255 ) NOT NULL, ADD `meta_keywords` VARCHAR( 255 ) NOT NULL
Step 2 : Add the two extra text boxes for the admin panel
Now open the information_form.tpl file in the editor of your choice for this file navigate to the admin/view/template/catalog/information_form.tpl and search for the $entry_description code and insert the code below before it:
<tr> <td><?php //echo $entry_meta_description; ?>Meta Description</td> <td> <textarea name="information_description[<?php echo $language['language_id']; ?>][meta_description]" cols="40" rows="5"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_description'] : ''; ?></textarea> </td> </tr> <tr> <td><?php //echo $entry_meta_keywords; ?>Meta Keywords</td> <td> <textarea name="information_description[<?php echo $language['language_id']; ?>][meta_keywords]" cols="40" rows="5"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_keywords'] : ''; ?></textarea> </td> </tr>
Step 3 : Add the extra fields into the model file
Now we have to edit the model file to “Save/Update” the data into the Database for this open the model file information.php in the Editor of your choice for this navigate to the admin/model/catalog/information.php. Search for the code
$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "'");
in the addInformation() and replace it with the code below:
$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_description = '".$this->db->escape($value['meta_description'])."', meta_keywords = '".$this->db->escape($value['meta_keywords'])."'");
and search for the code block
if ($data['keyword']) { $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'information_id=" . (int)$information_id . "', keyword = '" . $this->db->escape($data['keyword']) . "'"); }
in the same function addInformation(); and replace it with the code below:
if ($data['keyword']) { $this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_description = '".$this->db->escape($value['meta_description'])."', meta_keywords = '".$this->db->escape($value['meta_keywords'])."'"); }
Now search for the editInformation() and replace the code with the code below:
foreach ($data['information_description'] as $language_id => $value) { $this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET information_id = '" . (int)$information_id . "', language_id = '" . (int)$language_id . "', title = '" . $this->db->escape($value['title']) . "', description = '" . $this->db->escape($value['description']) . "', meta_description='" . $this->db->escape($value['meta_description'])."', meta_keywords ='" . $this->db->escape($value['meta_keywords'])."'"); }
Now find the code block
foreach ($query->rows as $result) { $information_description_data[$result['language_id']] = array( 'title' => $result['title'], 'meta_keywords' => $result['meta_keywords'] ); }
into the getInformationDescriptions(); function and repcace it with the:
foreach ($query->rows as $result) { $information_description_data[$result['language_id']] = array( 'title' => $result['title'], 'description' => $result['description'], 'meta_description' => $result['meta_description'], 'meta_keywords' => $result['meta_keywords'] ); }
Step 4 : Make the data available when you view an information page
Now open the file /catalog/controller/information/information.php in the editor of your choice and search for the code block
if ($information_info) { $this->document->setTitle($information_info['title']);
in the index() and add the code block in it:
$this->document->setDescription($information_info['meta_description']); $this->document->setKeywords($information_info['meta_keywords']);
then it will looks like as :
if ($information_info) { $this->document->setTitle($information_info['title']); $this->document->setDescription($information_info['meta_description']); $this->document->setKeywords($information_info['meta_keywords']);
Now the admin side will looks like as the below image:
I hope this will be helpfull to someone else.