Things seem to have changed since OC 3.x but I can't find any documentation on how to structure my extension so that it uploads correctly and works.
1. OpenCart Version: 4.0.2.3 (latest)
2. Used Template/Theme: default
3. (Additional) Installed Extension(s): none
4. (Additional) Installed Translation(s): none
5. Used PHP Version: 8.3.3
6. Used Browser and Version (and if used, installed extensions like Ads-Blocker, etc.): Firefox (latest). I have uBlock Origin but I've disabled it for my test site.
My test installation is local: WAMP Server on my C: drive.
What I have found so far:
– In OC 3.x, the extension needs to have the following folder structure: [upload] > [admin] and [catalog] > [language] > [language code] > [subfolders and files]
– In OC 4.x, the structure needs to be: [administrator] and [catalog] and [extension] > [language] > [language code] > [subfolders and files]. However, an install.json file is also required, which needs to be placed in the root folder, next to [administrator], [catalog], [extension].
* The "admin" folder is called "administrator" because this is what I renamed the "admin" directory to when prompted upon first log in to the admin panel. I realise the user may be using a different name. So, my first question is How should I name the "admin" folder in my extension?
Second question: Is what I have included in the install.json file sufficient? I opened the same file from the extensions already in /storage/marketplace and copied the contents, editing them as necessary:
Code: Select all
{
"name": "Bulgarian translation of OpenCart 4.x UI",
"version": "1.0",
"author": "Asphodel Works",
"link": "https://asphodel-works.com"
}
I then added the new language under System > Localisation > Languages.
I then went to System > Settings > My Store > [edit] > Local > selected my country, region, time zone, and chose my language for both "Language" and "Administrative language". But when I click "Save", I get an error message saying "Warning: Please check the form carefully for errors!"
But there are no errors anywhere! No fields in any of the tabs are highlighted red. I then used the Firefox inspector to try and find out more details: Inspect > Network > click the Save button again > a POST method is executed with status 200 > when I select it and go to the Response tab, I see:
Code: Select all
JSON
error Object { processing_status: "You must choose at least 1 order process status", complete_status: "You must choose at least 1 order complete status", warning: "Warning: Please check the form carefully for errors!" }
Ultimately, I checked the actual directories where my translations should have been uploaded to:
/administrator/language – a "bg-bg" folder should have been added here
/catalog/language – same as above
/extension/opencart/admin and /extension/opencart/catalog – with the corresponding subfolders – nothing uploaded here, either.
Instead, my extension had been unpacked directly under /extension/, creating a new folder.
So, my third question is: How do I structure the extension installer package so that everything is moved to its correct destination? Is there a detailed guide that explains this? This here: https://docs.opencart.com/en-gb/developer/module/ does not provide any such details.
I read this thread: viewtopic.php?t=231912, where the OP explains they manually pasted each folder where it needs to be. Of course, I can do that, too. Indeed, this is what I did when I tested my translation on 4.0.2.3. But I can't expect the users who buy my translation to move everything manually.
I hope you can help me. Thank you!