Page 1 of 1

Meta keywords for OpenCart

Posted: Tue Jan 17, 2012 8:07 pm
by leew87
hi

i wonder if anyone can help me i am trying to write my 1st vqmod to add meta keywords field to the admin side of opencart.

i am trying to make the following changes to my opencart store running 1.5.1.2 found in http://www.guru.net.nz/blog/2011/11/met ... ncart.html

but when i upload my xml file to the /vqmod/xmland reload my ste my site does not load and i get a white page i have checked for the vqmod.og file to show me where the errors aare but this is empty.

Code: Select all

<modification>

	<id>metakeywords 2 admin</id>
	<version>1.0</version>
	<vqmver>2.0</vqmver>
	
	<file name="admin/controller/setting/setting.php">
		<operation>
			<search position="after"><![CDATA[
			$this->data['entry_meta_description'] = $this->language->get('entry_meta_description');
			]]></search>
			<add><![CDATA[
			$this->data['entry_meta_keywords'] = $this->language->get('entry_meta_keywords');
			]]></add>
		</operation>
	</file>
	
	<file name="admin/controller/setting/setting.php">
		<operation>
			<search position="after"><![CDATA[
			config_meta_description 
			]]></search>
			<add><![CDATA[
			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');
}
			]]></add>
		</operation>
	</file>
	
	<file name="admin/language/english/setting/setting.php">
		<operation>
			<search position="after"><![CDATA[
			entry_meta_description
			]]></search>
			<add><![CDATA[
			<tr>
  <td><?php echo $entry_meta_keywords; ?></td>
  <td><input type="text" name="config_meta_keywords" value="<?php echo $config_meta_keywords; ?>" />
    <?php if ($error_entry_meta_keywords) { ?>
    <span class="error"><?php echo $error_entry_meta_keywords; ?></span>
    <?php } ?></td>
</tr>
			]]></add>
		</operation>
	</file>
	
	<file name="admin/view/template/setting/setting.tpl">
		<operation>
			<search position="after"><![CDATA[
			config_meta_description </tr>
			]]></search>
			<add><![CDATA[
			$_['entry_meta_keywords']     = 'Meta Tag Keywords:';
			]]></add>
		</operation>
	</file>
	
	<file name="catalog/controller/common/home.php">
		<operation>
			<search position="after"><![CDATA[
			config_meta_description
			]]></search>
			<add><![CDATA[
			$this->document->keywords = $this->config->get('config_meta_keywords');
			]]></add>
		</operation>
	</file>
	
</modification>
any advise on where i am going wrong and how i can get this working would be a great help please PM me or reply to this message for any more information you require.

thanks in advance

Re: Meta keywords for OpenCart

Posted: Thu Jan 19, 2012 6:00 am
by philbydevil
I think that your modification of catalog/controller/common/home.php is wrong (haven't looked too closely at the rest of the code).

Here's my vqmod of the same thing. I used to run it on 1.4.9.3 and have just updated it for 1.5.1.3 (tested and working).

1.5.1.3 version

Now updated for 1.5.4.1

1.5.4.1 version


Re: Meta keywords for OpenCart

Posted: Thu Jan 19, 2012 6:23 am
by leew87
thanks so much i will compare the to mods to see where i have gone wrong and learn from your working code.

as this is my 1st vqmod that i have tried working hopefully i have more luck getting it right next time.

as they say if you don't succeed at first try try try again.

my next challenges are

1) to add my 2 social media buttons i have hard coding into the header file using Vqmod so hard coding is not needed
2) moving the cart and search bar i have on my site to new location using vqmod from the original location in template.

This will make it sooooo much easier when upgrading or installing bug fixes to my template i use have customised.

Thanks again

Re: Meta keywords for OpenCart

Posted: Thu Jan 19, 2012 6:27 am
by philbydevil
When you do the "search position" (ie. <search position="after"><![CDATA[ )in your vQmod, be sure to include the entire line of code. Some of the searches in your post look like they are only a part of the line of code.

Re: Meta keywords for OpenCart

Posted: Thu Jan 19, 2012 6:33 am
by leew87

Code: Select all

<modification>

	<id>Custom Template Edits</id>
	<version>2.0.0</version>
	<vqmver>2.1.5</vqmver>
	<author>ILL IT Solutions</author>

	<file name="/catalog/view/theme/ModernStore/template/common/header.tpl">
        <operation>
            <search position="after"><![CDATA[
            <div id="header_top">
            ]]></search>
            <add><![CDATA[
            <div><a href="http://twitter.com/#!/illitsolutions"><img src="image/data/siteparts/twitter_button.png" alt="Twitter" width="118" height="59" /></a></div>
	<div><a href="http://www.facebook.com/ILLITSolutions"><img src="image/data/siteparts/facebook_button.png" alt="Facebook" width="118" height="59" /></a></div>
            ]]></add>
        </operation>


</modification>
this is what i have as in my current header.tpl file if i add that coding after the search it will give me what is hard coded but when i run it doesnt seem to do anything but i do get the follow error now Caught exception: DOMDocument::load() [<a href='domdocument.load'>domdocument.load</a>]: Opening and ending tag mismatch: file line 8 and modification in /home/illit/public_html/vqmod/xml/vqmod_Custom_Template Edits.xml, line: 20 in the vqmod.log file.

i really cant understand what i am doing wrong

Re: Meta keywords for OpenCart

Posted: Fri Jan 20, 2012 6:44 pm
by leew87
i have now found out the problem i was missing the closing tag for the file part of the XML so i added </file> before the
</modification> in the XML and all now works fine.

just a quick question do you know if it is possiable to edit css files using vqmod

Re: Meta keywords for OpenCart

Posted: Sat Jan 21, 2012 7:17 am
by philbydevil
just a quick question do you know if it is possiable to edit css files using vqmod
I haven't tried it myself but I don't see why it wouldn't work.

Re: Meta keywords for OpenCart

Posted: Sat Jan 21, 2012 6:39 pm
by leew87
do you know if or how is possiable to get the xml script just to add coding at the end of the file without adding before or after or even replacing

as if this is possiable i could use this so any Css changes i add using Vqmod would just go at the end of the main template css this would allow me to upgrade all files on the templates and not worry if they are over written as vqmod does not get over written each time.

i have found you can you a comand called bottom but can not find a script where is this used so i can see the correct syntax for it.

onces again i thank you for all your assistance

Re: Meta keywords for OpenCart

Posted: Sun Jan 22, 2012 5:31 am
by philbydevil
Try something like this:

Code: Select all

	<file name="catalog/view/theme/YOURTHEME/stylesheet/stylesheet.css">
        <operation>
            <search position="bottom"><![CDATA[
            You don't need any code here as it will be ignored
            ]]></search>
            <add><![CDATA[
            INSERT YOUR NEW CODE HERE
            ]]></add>
        </operation>
	</file>

Re: Meta keywords for OpenCart

Posted: Mon Feb 06, 2012 8:08 pm
by SVN
Hi,

is there a possibility that this vQmod works on 1.4.9.6 ?

thx !

Re: Meta keywords for OpenCart

Posted: Tue Feb 07, 2012 10:04 am
by philbydevil
There's a 1.4 version in vQmods that should

Re: Meta keywords for OpenCart

Posted: Fri Sep 07, 2012 7:04 pm
by Mr Hot Pants
Philbydevil

Thank you so much for this vQmod - it works perfectly in 1.5.4.1 and it's really easy to use.

Thanks again

Re: Meta keywords for OpenCart

Posted: Thu Oct 11, 2012 1:02 pm
by sataan2006
philbydevil wrote:I think that your modification of catalog/controller/common/home.php is wrong (haven't looked too closely at the rest of the code).

Here's my vqmod of the same thing. I used to run it on 1.4.9.3 and have just updated it for 1.5.1.3 (tested and working).
1513-vqmod_catalog_meta_keywords_for_home_page.xml
Now updated for 1.5.4.1
1541-vqmod-catalog-meta-keywords-for-home-page.xml
Thank you from thailand. I use your keyword VQMOD and work for 1.5.2.1

really thank you

Tan

Re: Meta keywords for OpenCart

Posted: Tue Feb 26, 2013 8:46 am
by tomatito
Thanks :) Works perfect with Opencart 1.5.4.1.

Re: Meta keywords for OpenCart

Posted: Fri Feb 21, 2014 12:02 am
by stokeyblokey
Also the 1.5.4.1 version works perfectly with 1.5.6 - thanks philbydevil, you just saved me writing this myself! :)

Stokey

Re: Meta keywords for OpenCart

Posted: Thu Sep 04, 2014 7:42 pm
by nico.bester
Thank you this worked great for version 1.5.4.1

I added 2 images to show what it looks like under the settings menu and the Keyword line that is added to the homepage html.

Re: Meta keywords for OpenCart

Posted: Fri Oct 17, 2014 5:24 pm
by M4ketech
Thanks, worked on my store (1.5.6.4), great job!