Showing posts with label Homepage meta keyword OpenCart. Show all posts
Showing posts with label Homepage meta keyword OpenCart. Show all posts

Wednesday, 3 September 2014

Meta keywords on home page OpenCart


Meta keywords on home page OpenCart

In the admin

Go to admin/controller/setting/setting.php file

you will find a line $this->data['entry_meta_description'] = $this->language->get('entry_meta_description'); and put below line after that

$this->data['entry_meta_keywords'] = $this->language->get('entry_meta_keywords');

Now search for config_meta_description word, put below code after this

if (isset($this->request->post['config_meta_keywords'])) {
    $this->data['config_meta_keywords'] = $this->request->post['config_meta_keywords'];
} else {
    $this->data['config_meta_keywords'] = $this->config->get('config_meta_keywords');
}



Open the file admin/language/english/setting/setting.php and add a line after the entry_meta_description line that says

$_['entry_meta_keywords']     = 'Meta Tag Keywords:';


open the file admin/view/template/setting/setting.tpl, find the config_meta_description and paste this after it.

<tr>
    <td><?php echo $entry_meta_keywords; ?></td>
    <td><input type="text" name="config_meta_keywords" value="<?php echo $config_meta_keywords; ?>" /></td>
</tr>



Now come In the front end

Open the file catalog/view/theme/yourtheme/template/common/header.tpl and add the following code after the definition of the description meta tag:

<?php if ($keywords) { ?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<?php } ?>


Finally, open catalog/controller/common/home.php and find $this->document->setDescription($this->config->get('config_meta_description'));. Simply add below line after it....

$this->document->setKeywords($this->config->get('config_meta_keywords'));

Thats it.... Enjoy Chandresh rana's Coding... :)