it wouldn't be that hard to add, you'd need to just add a field to the information_description table, add in the box, and update the column like the rest are. Have you searched the forums regarding this, I'm sure someone else will have wanted this before now, and there may already be exact instructions on how to add it
Hi Jay,
thanks for helping out.
Yes, I have searched the forum for this topic and only found one other person who had posted the same question, but there was no answer. http://forum.opencart.com/viewtopic.php ... ion#p90847. I do apologize if I have missed other posts about this.
Adding a field to the information_description table sounds like hacking core files, is that correct? I would rather not hack core files if I can avoid it. However, if this requires hacking core file, which files would it need to be modified? If not, then I don't know how to this via the admin.
Thanks
Vayu
thanks for helping out.
Yes, I have searched the forum for this topic and only found one other person who had posted the same question, but there was no answer. http://forum.opencart.com/viewtopic.php ... ion#p90847. I do apologize if I have missed other posts about this.
Adding a field to the information_description table sounds like hacking core files, is that correct? I would rather not hack core files if I can avoid it. However, if this requires hacking core file, which files would it need to be modified? If not, then I don't know how to this via the admin.
Thanks
Vayu
Is anyone able to help here? It seems like it should be easy but I'm not a programmer
I've done the following:
- Admin/controller/catalog/information/information.php
added in
to line 273
- Admin/language/english/catalog/information.php
added in the line
to line 17
- Admin/view/template/catalog/information_form.tpl
Added in
to line 26
I've also added a field in the database under 'information_description' called 'meta_desciption'
I can now see a field for Meta Desciption in the Information page in the admin section, but it has
"<b>Notice</b>: Undefined index: meta_description in ****/admin/view/template/catalog/information_form.tpl</b> on line <b>38</b>"
within it. Would love some help here!!!
I've done the following:
- Admin/controller/catalog/information/information.php
added in
Code: Select all
$this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
- Admin/language/english/catalog/information.php
added in the line
Code: Select all
$_['entry_meta_description'] = 'Meta Tag Description:';
- Admin/view/template/catalog/information_form.tpl
Added in
Code: Select all
<tr>
<td><?php echo $entry_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>
I've also added a field in the database under 'information_description' called 'meta_desciption'
I can now see a field for Meta Desciption in the Information page in the admin section, but it has
"<b>Notice</b>: Undefined index: meta_description in ****/admin/view/template/catalog/information_form.tpl</b> on line <b>38</b>"
within it. Would love some help here!!!
onlinesunshine- What you have done is correct but to make it work you need to add some more changes to the model file. Here are the steps I have done to add meta description and meta keywords to my information pages...
(I'm using the latest version of OpenCart V1.4.9.3)
1) Add the two fields needed to store the data for each information page.
Using PHPMyAdmin or similar, run the following SQL:
2) Add the extra text boxes to the admin page:
admin/view/template/catalog/information_form.tpl
Insert at line 36
Note: I'm being lazy here and hard coding the descriptions into the template file. Really this text should be put in the language file and loaded in the controller file. Since OnlineSunshine has shown how to do this in her post I'll leave this out. Personally I'm happy that the admin will only ever be seen in English and that the less changes I have to make the better as installing the next version of OC usually means making these changes again!
3) Add the extra fields into the model file
admin/model/catalog/information.php
lines 9 and 31 are SQL statements that insert the data into the DB when you add or edit an information page.
Replace BOTH these lines with this one which includes the extra fields on the end.
There is also a third change to make further down where the data is loaded from the DB
replace line 125 with...
4) Make the data available when you view an information page
/catalog/controller/information/information.php
line 26 add the following...
There you have it! Lets vote to add this to the next release of OC 
(I'm using the latest version of OpenCart V1.4.9.3)
1) Add the two fields needed to store the data for each information page.
Using PHPMyAdmin or similar, run the following SQL:
Code: Select all
ALTER TABLE `information_description` ADD `meta_description` VARCHAR( 255 ) NOT NULL, ADD `meta_keywords` VARCHAR( 255 ) NOT NULL
2) Add the extra text boxes to the admin page:
admin/view/template/catalog/information_form.tpl
Insert at line 36
Code: Select all
<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>
3) Add the extra fields into the model file
admin/model/catalog/information.php
lines 9 and 31 are SQL statements that insert the data into the DB when you add or edit an information page.
Replace BOTH these lines with this one which includes the extra fields on the end.
Code: Select all
$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'])."'");
replace line 125 with...
Code: Select all
'description' => $result['description'],'meta_description' => $result['meta_description'],'meta_keywords' => $result['meta_keywords']
/catalog/controller/information/information.php
line 26 add the following...
Code: Select all
$this->document->description = $information_info['meta_description']; $this->document->keywords = $information_info['meta_keywords'];

One thing to correct here is:
In Step 4 by webdude:
Rather adding this:
Add this:
This will work 100% guranteed!!!
I really appreciate the contribution done by onlinesunshine & webdude.
Tested successfully on opencart ver. 1.5.1.1
Thank You!
In Step 4 by webdude:
Rather adding this:
Code: Select all
$this->document->description = $information_info['meta_description']; $this->document->keywords = $information_info['meta_keywords'];
Code: Select all
$this->document->setDescription($information_info['meta_description']);
$this->document->setKeywords($information_info['meta_keywords']);
I really appreciate the contribution done by onlinesunshine & webdude.
Tested successfully on opencart ver. 1.5.1.1
Thank You!

does not save fields in db (meta_description, meta_keywords)
follow this instructions http://www.opencart.com/index.php?route ... on_id=4702
UPDATE:
for 1.5.5.1
working code: http://www.expertwebadvisor.com/adding- ... -opencart/
follow this instructions http://www.opencart.com/index.php?route ... on_id=4702
UPDATE:
for 1.5.5.1
working code: http://www.expertwebadvisor.com/adding- ... -opencart/
Who is online
Users browsing this forum: No registered users and 28 guests