Ads

Monday, August 4, 2014

Thêm thiết lập Meta Keywords cho cửa hàng trong opencart

1:45 PM - By Unknown 0

Có lẽ thẻ meta keywords từ lâu không còn được đánh giá cao trong SEO tuy nhiên nó vẫn là các chuẩn trong html vì thế tuy nó không cần thiết nhưng cũng không thể thiếu. Opencart không phải không hỗ trợ thẻ meta keywords nó hỗ trợ ở các danh mục, sản phẩm, thông tin tuy nhiên lại thiếu chỗ quan trọng nhất là trang chủ của các gian hàng. Hôm nay mình hướng dẫn các bạn thêm thiết lập meta keywords trong admin panel và hiển thị nó ra trang chủ.
Setting meta keyword 4 Opencart
Setting meta keyword 4 Opencart

Các bạn thực hiện các bước sau
- Sửa file admin/controller/setting/setting.php
+ Tìm dòng
1
$this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
Thêm bên dưới nó dòng code sau:
1
$this->data['entry_meta_keyword'] = $this->language->get('entry_meta_keyword');
+ Tìm đoạn code sau:
1
2
3
4
5
if (isset($this->request->post['config_meta_description'])) {
    $this->data['config_meta_description'] = $this->request->post['config_meta_description'];
} else {
    $this->data['config_meta_description'] = $this->config->get('config_meta_description');
}
Thêm trước nó các dòng code sau:
1
2
3
4
5
if (isset($this->request->post['config_meta_keyword'])) {
    $this->data['config_meta_keyword'] = $this->request->post['config_meta_keyword'];
} else {
    $this->data['config_meta_keyword'] = $this->config->get('config_meta_keyword');
}
- Sửa file admin/view/template/setting/setting.tpl
Tìm đoạn code sau:
1
2
3
4
<tr>
  <td><?php echo $entry_meta_description; ?></td>
  <td><textarea name="config_meta_description" cols="40" rows="5"><?php echo $config_meta_description; ?></textarea></td>
</tr>
Thêm trước nó dòng code sau:
1
2
3
4
<tr>
      <td><?php echo $entry_meta_keyword; ?></td>
      <td><textarea name="config_meta_keyword" cols="40" rows="5"><?php echo $config_meta_keyword; ?></textarea></td>
     </tr>
- Sửa file admin/language/english/setting/setting.php hoặc tùy theo ngôn ngữ của bạn đang sử dụng
Tìm dòng
1
$_['entry_meta_description']   = 'Meta Tag Description:';
Thêm sau nó dòng
1
$_['entry_meta_keyword']   = 'Meta Keywords:';
- Sửa file catalog/controller/common/home.php
Tìm dòng:
1
$this->document->setDescription($this->config->get('config_meta_description'));
Thêm sau nó dòng:
$this->document->setKeywords($this->config->get(‘config_meta_keyword’));
OK thế là xong rồi đó. Nếu bạn làm đúng các bước trên thì khi vào Admin/System/Settings để cấu hình store của bạn trong tab Store sẽ hiện ra như sau:
Setting Meta Keyword Store
Setting Meta Keyword Store
Để chắc chắn view source trang chủ cửa hàng thấy thẻ meta keywords tức là đã thành công
Thẻ meta khi xem mã nguồn trang chủ
Thẻ meta khi xem mã nguồn trang chủ

Tags:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque volutpat volutpat nibh nec posuere. A die shopuf pogest concludi cum administrasset slushie intus calidum brioche.
Follow me @Bloggertheme9
Subscribe to this Blog via Email :

0 comments:

back to top