0

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?

HDP
  • 4,005
  • 2
  • 36
  • 58
The Joff
  • 33
  • 2
  • 7
  • I have testing this issue. & same issue created for me. So, I think, this issue is by default in this version. also, I think We will need to wait some days for stable new OpenCart version. because, I have realized. has been released OpenCart version 3.0.1.2 two days ago. and also, 3.0.1.3 (Beta) version in progress. – HDP Jul 10 '17 at 09:18
  • Thanks Hamish. I'm upgrading to 3.0.1.2 now and I'll see if that helps. – The Joff Jul 10 '17 at 13:24
  • I upgraded to 3.0.1.2 and still the same issue. OC mod doesn't seem to work at all. – The Joff Jul 10 '17 at 14:00
  • You can add your issue in github. you will get reply by OpenCart. https://github.com/opencart/opencart/issues – HDP Jul 11 '17 at 05:21

3 Answers3

3

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.

Sainul Abid
  • 99
  • 1
  • 9
  • Wow thanks, this info was lacking from the official documentation. It really makes testing modifications even harder than before – cjohansson Jun 13 '18 at 14:00
0

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

pvy4917
  • 1,768
  • 17
  • 23
0

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>
K. B.
  • 1,388
  • 2
  • 13
  • 25