0

I try to install payment gateway plugin to Opencart (2.0.3). I'm informed that I need to use ocmod to properly install plugin. But I do not know which files I need to create besides the files in admin and catalog folders. I've followed this tut on system modification but still no avail. What should be content of install .xml? I do not know where and what to modify (system modification)? Docs is short to explain...

See my related question.

Community
  • 1
  • 1
Igor Savinkin
  • 5,669
  • 8
  • 37
  • 69

1 Answers1

0

Ocmod files are used to alter existing files on the opencart system. For example, if you wanted to change checkout.php, you could include this in your ocmod file

<file path="catalog/controller/checkout/checkout.php">
<operation>
    <search index="0"><![CDATA[public function index() {]]></search>
    <add position="after"><![CDATA[
        echo('This line will be added at the beginning of the index function');]]>
    </add>
</operation>
</file>

Here's what the structure generally looks like

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>For 2.1.0.2</id>
    <name>Stack Overflow plug-in</name>
    <code>Stack Overflow plug-in</code>
        <version>1.1</version>
        <vqmver></vqmver>
    <author>Igor Savinkin</author>
    <file path="catalog/controller/checkout/cart.php">
    <operation>
        <search index="0"><![CDATA[$data['continue'] = $this->url->link('common/home')]]></search>
        <add position="before"><![CDATA[
            //blah blah]]>
        </add>
    </operation>
    <operation>
        <search index="0"><![CDATA[unset($this->session->data['reward']);]]></search>
        <add position="after"><![CDATA[
            //blah]]>
        </add>
    </operation>
    </file>
    <file path="catalog/controller/product/product.php">
    <operation>
        <search index="0"><![CDATA[$this->load->model('catalog/product');]]></search>
        <add position="replace"><![CDATA[
            //etc]]>
        </add>
    </operation>
    </file>
</modification>

The client then will upload these files under "extension installer" in the admin.

WilliamNHarvey
  • 2,335
  • 2
  • 17
  • 26