Muhammad
Muhammad

Reputation: 931

Modification requires a unique ID code! Opencart OCMOD

In Opencart 2.0.1.1, I tried to upload an OCmod configuration file with right name format .ocmod.xml but I get the error Modification requires a unique ID code!

Upvotes: 5

Views: 10919

Answers (4)

Champak
Champak

Reputation: 11

The error will also show up if you are trying to duplicate a mod that is already done.

Upvotes: 1

mfadel
mfadel

Reputation: 897

I know this wasn't your problem, but sometimes this error message has no relation with the extension id, another error for example what happened with me with OC3.0.3.2 while installing a corrupted ocmode file, I forgot tag and I got the same error mesage.

my corrupted file looked like this:

<?xml version="1.0" encoding="utf-8"?>
 <modification>
<name>Cart Modificationso</name>
<code>ocart-modif</code>
<version>1.2</version>
<author>ssss</author>
<link>https://websitg.com.tr</link>
<file path="system/library/cart/cart.php">
    <operation>
        <search><![CDATA[public function getProducts() {]]></search>
        <add position="before"><![CDATA[
        public function func($productID,$quantity){

                return "test";
            }
        ]]></add>
    
</file>
</modification>

Upvotes: 0

ber2008
ber2008

Reputation: 323

You will have to put a Modification ID on any ocmod that you upload to your website, for example

 <code>00001</code>

If you upload other time this extension with modifications, you will have to put another code

 <code>00002</code>

Upvotes: 1

Muhammad
Muhammad

Reputation: 931

Official guide for modifications of Opencart 2 is missing to mention about the <code> tag that should be included in all ocmod configuration files

The system match this <code> tag with previously uploaded modification files to check if it has already been uploaded or not so every time you upload a modification file you should put the id in <code> tag and it should be unique

So for solution you just need to add your unique modification ID between <code>HERE</code> and put that after the <modification> tag

like this

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <code>Modification ID</code>
    <name>Modification</name>
    <version>1.0</version>
    <author>Author Name</author>
    <link>http://www.author.com</link>
    <file path="catalog/controller/common/home.php">
        <operation>
            <search><![CDATA[
            Search this
            ]]></search>
            <add position="replace"><![CDATA[
            replace with this
            ]]></add>
        </operation>
    </file>  
</modification>

Upvotes: 16

Related Questions