Modification: Add To Admin Menu
Lots of extensions add to the opencart menu, here's an example modification for easy copy/paste:
- Opencart 3
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>Foo</name>
<code>foo</code>
<version>3.0.0.1</version>
<author>Opencart-Templates</author>
<link>http://www.opencart-templates.co.uk</link>
<file path="admin/controller/common/column_left.php">
<operation>
<search index="0"><![CDATA[if ($marketplace) {]]></search>
<ignoreif><![CDATA[$this->url->link('extension/module/foo',]]></ignoreif>
<add position="before"><![CDATA[if ($this->user->hasPermission('access', 'extension/module/foo')) {
$marketplace[] = array(
'name' => $this->language->get('text_emailtemplate'),
'href' => $this->url->link('extension/module/foo', 'user_token=' . $this->session->data['user_token'], true),
'children' => array()
);
}]]></add>
</operation>
</file>
<file path="admin/language/*/common/column_left.php">
<operation>
<search index="0"><![CDATA[<?php]]></search>
<add position="after"><![CDATA[$_['text_event'] = 'Foo';]]></add>
</operation>
</file>
</modification>
- Opencart 2.3
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>Foo</name>
<code>foo</code>
<version>2.3.0.1</version>
<author>Opencart-Templates</author>
<link>http://www.opencart-templates.co.uk</link>
<file path="admin/controller/common/column_left.php">
<operation>
<search index="0"><![CDATA[if ($this->user->hasPermission('access', 'extension/extension')) {]]></search>
<add position="before"><![CDATA[if ($this->user->hasPermission('access', 'extension/foo')) {
$extension[] = array(
'name' => $this->language->get('text_foo'),
'href' => $this->url->link('extension/foo', 'token=' . $this->session->data['token'], true), 'children' => array()
);
}]]></add>
</operation>
</file>
<file path="admin/language/en-gb/common/column_left.php">
<operation>
<search index="0"><![CDATA[<?php]]></search>
<add position="after"><![CDATA[$_['text_foo'] = 'Foo';]]></add>
</operation>
</file>
</modification>
- Opencart 2
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name>Foo</name>
<code>foo</code>
<version>2.0.0.1</version>
<author>Opencart-Templates</author>
<link>http://www.opencart-templates.co.uk</link>
<file path="admin/language/english/common/menu.php">
<operation>
<search index="0"><![CDATA[<?php]]></search>
<add position="after"><![CDATA[$_['text_foo'] = 'Foo';]]></add>
</operation>
</file>
<file path="admin/controller/common/menu.php">
<operation>
<search index="0"><![CDATA[$data['text_review'] = $this->language->get('text_review');]]></search>
<add position="after"><![CDATA[$data['text_foo'] = $this->language->get('text_foo');]]></add>
</operation>
<operation>
<search index="0"><![CDATA[$data['review'] = $this->url->link('catalog/review', 'token=' . $this->session->data['token'], 'SSL');]]></search>
<add position="after"><![CDATA[$data['foo'] = $this->url->link('extension/foo', 'token=' . $this->session->data['token'], 'SSL');]]></add>
</operation>
</file>
<file path="admin/view/template/common/menu.tpl">
<operation>
<search index="0"><![CDATA[<li><a href="<?php echo $review; ?>"><?php echo $text_review; ?></a></li>]]></search>
<add position="before"><![CDATA[<li><a href="<?php echo $foo; ?>"><?php echo $text_foo; ?></a></li>]]></add>
</operation>
</file>
</modification>