The Joff
The Joff

Reputation: 33

OCmod doesn't work/overwrite files in OpenCart 3.0.1.1

I am trying to mod the admin in OpenCart (3.0.1.1) slightly. I have written the following XML code as a test to see if I can mod the product form:

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Test</name>
    <code>Test</code>
    <version>1.0</version>
    <author>Test</author>
    <link>http://web.com</link>
    <file path="admin/view/template/catalog/product_form.twig">
        <operation>
            <search><![CDATA[
            <div id="content">
            ]]></search>
            <add position="replace"><![CDATA[
            <div id="content" class="yeah">
            ]]></add>
        </operation>
    </file>
</modification>

Because I can't get the Extensions Installer to upload an XML file (separate issue) I have to save the xml file and install.xml in a folder along side an empty upload folder and then zip the parent folder like you would with a more complex mod. This works - ie it uploads and installs:

upload success

I then go to the Modification List and refresh to see there is nothing there (an no reference in the Log either): nothing in mod list

And, of course, the mod hasn't worked:

mod hasn't worked

Any ideas?

Upvotes: 0

Views: 1936

Answers (3)

Gaurav kumar
Gaurav kumar

Reputation: 1

I am explaining by example

Suppose we have an extension that has the following files as upload install.xml

then we need to zip both files as extension_name.ocmod.zip. But if we extract this zip file, then files should not be extracted in the extension_name directory.

The .ocmod.zip file should contain the following at its root: upload install.xml

Hope it will solve your issue

Upvotes: 0

K. B.
K. B.

Reputation: 1430

do not leave spaces in search tags. The code should look like this: <?xml

version="1.0" encoding="utf-8"?>
<modification>
    <name>Test</name>
    <code>Test</code>
    <version>1.0</version>
    <author>Test</author>
    <link>http://web.com</link>
    <file path="admin/view/template/catalog/product_form.twig">
        <operation>
            <search><![CDATA[<div id="content">]]></search>
            <add position="replace"><![CDATA[
            <div id="content" class="yeah">
            ]]></add>
        </operation>
    </file>
</modification>

Upvotes: 0

Sainul Abid
Sainul Abid

Reputation: 99

3.x support only archived files, You need to archive the file before upload . eg: change the xml file name to 'install.xml' then archive the file as filename.ocmod.zip.

Upvotes: 3

Related Questions