I want to add some content in footer file using VQMod my XML file has the following content but it's not working
<code>
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>VQMOD CODE test data</id>
<version>1.0</version>
<vqmver>2.0.1</vqmver>
<author>authore name</author>
<file name="catalog/view/theme/default/template/common/footer.tpl">
<operation error="skip">
<search position="after"><![CDATA[
</footer>
]]></search>
<add><![CDATA[
this is test content
]]></add>
</operation>
</file>
</modification>
</code>
what is version of your opencart ?
it's dependent of your footer.tpl content. you need to make sure that </footer> is available in footer.tpl
and also you need to check in vqmod/logs you will see error log there.
Can you tell me if any custom theme is applied on top of your default opencart theme?
Edit :
Try this code, it'll work for you.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE modification [
<!ENTITY adminFolder "admin">
<!ENTITY themeFolder "default">
]>
<modification>
<version>1.0</version>
<vqmver>2.X</vqmver>
<author>umesh</author>
<file name="catalog/view/theme/&themeFolder;/template/common/footer.tpl">
<operation info="To add custom data at footer">
<search position="after" ><![CDATA[
</footer>
]]></search>
<add><![CDATA[
test content
]]></add>
</operation>
</file>
Related
I am trying to write my mod file to simply change a text in a footer. here is my install.xml code:
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Modify PowerBy Text</name>
<version>1.0</version>
<author>Shehzad</author>
<file path="catalog/language/en-gb/common/footer.php">
<operation>
<search>
<![CDATA[
$_['text_powered'] = 'Powered By OpenCart<br /> %s © %s';
]]></search>
<add position="replace"><![CDATA[
$_['text_powered'] = 'Powered By Shehzad<br /> %s © %s';
]]></add>
</operation>
</file>
</modification>
I have also created an empty folder called upload and along with install.xml zipped it to mod_footer.ocmod.zip as per standard. When I install it via installer, It uploads and installs successfully , at least I get a successful installation message. However, when I go to the Modifications page, I do not see it even after clicking the Refresh button. In addition, when I refresh my site, the modification is not seen.
Add a unique code to your xml file: <code>modify_powerby_text</code>
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Modify PowerBy Text</name>
<version>1.0</version>
<author>Shehzad</author>
<code>modify_powerby_text</code>
<file path="catalog/language/en-gb/common/footer.php">
<operation>
<search>
<![CDATA[
$_['text_powered'] = 'Powered By OpenCart<br /> %s © %s';
]]></search>
<add position="replace"><![CDATA[
$_['text_powered'] = 'Powered By Shehzad<br /> %s © %s';
]]></add>
</operation>
</file>
</modification>
You have to have a folder in the ocmod.zip called upload even if you only have a XML file in the modification leave the upload folder empty but still include it in the Zip it has to be in there for version 3 of OpenCart.
I found this out the hard way! trying to figure out why it wont show up in the modifications and that's all it was.
I am trying to add a variable in language file using opencart extension, but there is no change in the file.
My code:
<file path="admin/language/english/catalog/product.php">
<operation>
<search><![CDATA[// Error]]></search>
<add position="before"><![CDATA[
$_['entry_a_start_date'] = 'Start Date/Time';
]]>
</add>
</operation>
</file>`
Please let me know what is wrong with the code.
Thanks in advance
When you want to call a single file use name not path.
This should work:
<file name="admin/language/english/catalog/product.php">
<operation>
<search position="before"><![CDATA[// Error]]></search>
<add><![CDATA[
$_['entry_a_start_date'] = 'Start Date/Time';
]]>
</add>
</operation>
</file>
Why does this opencart 2 OCMod not work?
<modification>
<file name="catalog/language/english/english.php">
<operation>
<search><![CDATA[
$_['text_home'] = '<i class="fa fa-home"></i>';
]]></search>
<add position="replace"><![CDATA[
$_['text_home'] = 'Home';
]]></add>
</operation>
</file>
</modification>
I upload it and refresh the mods cache, but my changes do not appear.
Add Search Tag "<search position="replace">"
<modification>
<file name="catalog/language/english/english.php">
<operation>
<search position="replace"><![CDATA[
$_['text_home'] = '<i class="fa fa-home"></i>';
]]></search>
<add position="replace"><![CDATA[
$_['text_home'] = 'Home';
]]></add>
</operation>
</file>
Try this,
<modification>
<name><![CDATA[<font color="#0000"><b>Home link</font>]]></name>
<version><![CDATA[<b>1.0</b>]]></version>
<code>home_link</code>
<author><![CDATA[<font color="#CC0000"><b>zec Blackbeard</b></font>]]></author>
<link><![CDATA[abcd.com]]></link>
<file path="catalog/language/english/english.php">
<operation>
<search><![CDATA[$_['text_home'] = '<i class="fa fa-home"></i>';]]></search>
<add position="replace"><![CDATA[$_['text_home'] = 'Home';]]></add>
</operation>
</file>
</modification>
You have mode sily mistake. In ocmod, file name attribute does not work. You need to replace with path.
You need to change following line.
Find
<file name="catalog/language/english/english.php">
Replace with
<file path="catalog/language/english/english.php">
I am using Opencart 1.5.6.4
I am able to set Permissions to All other pages but I am not getting option to set permission to set permission for dashborad or common/home.
I am trying follow link http://forum.opencart.com/viewtopic.php?t=32561
But I am not able to get options to set permission.
I found the answer. To HIDE Dashboard from certain users following are the steps we need to take.
Open admin\controller\user\user_permission.php
FIND
$ignore = array('common/home',
'common/startup',
'common/login',
'common/logout',
'common/forgotten',
'common/reset',
'error/not_found',
'error/permission',
'common/footer',
'common/header'
);
REMOVE
'common/home',
Create XML file and add under vqmod xml folder.
<modification>
<id>Add a permission check to the admin dashboard, and provide with an alternate forwarding target</id>
<version>1.0.0</version>
<vqmver>1.0.2</vqmver>
<author>ckonig</author>
<file name="admin/controller/user/user_permission.php">
<operation>
<search position="replace">
<![CDATA['common/home',]]>
</search>
<add>
<![CDATA[]]>
</add>
</operation>
</file>
<file name="admin/view/template/common/home.tpl">
<operation>
<search position="after">
<![CDATA[<?php echo $header; ?>]]>
</search>
<add>
<![CDATA[
<?php
if(!$this->user->hasPermission('access','common/home')){
$this->redirect('index.php?token='.$token.'&route=catalog/product');
}
?>
]]>
</add>
</operation>
</file>
</modification>
NEXT SET Permission
I am trying to create Sub menu under Product menu using VQMOD, but unfortunately i couldn't able to display it in admin. Please see below for the code i used to create menu using VQMOD.
<modification>
<id>Add a link</id>
<version>1.5.4</version>
<vqmver>0.1</vqmver>
<author>Nagamani Naresh</author>
<!-- edit header controller -->
<file name="admin/controller/common/header.php">
<!-- create link to your page -->
<operation error="log">
<search position="after"><![CDATA[$this->data['setting'] = $this->url->link('setting/store', 'token=' . $this->session->data['token'], 'SSL');]]></search>
<add><![CDATA[
$this->data['hello_world'] = $this->url->link('custom/helloworld', 'token=' . $this->session->data['token'], 'SSL');
]]></add>
</operation>
<!-- / -->
</file>
<!-- edit header template -->
<file name="admin/view/template/common/header.tpl">
<!-- add link to your page -->
<operation error="log">
<search position="before" offset="1"><![CDATA[<ul class="right">]]></search>
<add><![CDATA[
<li><a class="top">Your link</a>
<ul>
<li>Hello World</li>
</ul>
</li>
]]></add>
</operation>
<!-- / -->
</file>
</modification>
Please share your Suggestions.
for opencart 2.0.X
save this code as name.ocmod.xml and uplaod from admin
<?xml version="1.0" encoding="utf-8"?>
<modification>
<code>extra admin menu</code>
<name>test admin menu</name>
<version>2.0</version>
<author>codertj</author>
<link>codertj.com</link>
<!-- edit header controller -->
<file name="admin/controller/common/menu.php">
<!-- create link to your page -->
<operation error="log">
<search><![CDATA[$data['setting'] = $this->url->link('setting/store', 'token=' . $this->session->data['token'], 'SSL');]]></search>
<add position="after"><![CDATA[
$data['hello_world'] = $this->url->link('custom/helloworld', 'token=' . $this->session->data['token'], 'SSL');
]]></add>
</operation>
</file>
<!-- edit header template -->
<file name="admin/view/template/common/menu.tpl">
<!-- add link to your page -->
<operation error="log">
<search><![CDATA[<li><?php echo $text_product; ?></li>]]></search>
<add position="after"><![CDATA[
<li>Hello World</li>
]]></add>
</operation>
</file>