Page 1 of 4

Extension Developers Prepare for the Cloud!

Posted: Fri Mar 03, 2017 2:04 pm
by Daniel
We plan to release the cloud in the next few weeks. It is very important that as many extension developers have their extensions ready to work on the cloud as possible.

You can download the latest version from the opencart dev branch.

https://github.com/opencart/opencart/tree/dev

In the latest dev version you will find we have added a template editor, language editor, language importer and extension store built into the opencart admin. We also using twig as the template language.

There are going to be a few rules before we approve extension to be allowed on the cloud.

1. You are not allowed to modify any DB tables. If you need to store any data for your extension you need to create a new table and use joins.

2. You are not allowed to overwrite any files.

3. All files are only allowed to be written in extension folders, except templates which of course go under the template folder.

4. All extension should have a admin page that allows configuration.

5. Extensions are now prefixed by their category. so paypal_status would become payment_papal_status

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 03, 2017 7:46 pm
by JNeuhoff
Will you be able to override core file behavior via events?

And what is the reason for using twig as the template engine when the php template engine was working just fine?

And what exactly makes it a cloud version?

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 03, 2017 9:52 pm
by OpenCart Addons
Daniel wrote:
Fri Mar 03, 2017 2:04 pm
1. You are not allowed to modify any DB tables. If you need to store any data for your extension you need to create a new table and use joins.
We can still store data in the Settings table, correct?

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 03, 2017 10:06 pm
by Daniel
Yes u can store data in settings table. Just no core table modifications.

Re: Extension Developers Prepare for the Cloud!

Posted: Sat Mar 04, 2017 12:04 am
by Johnathan
3. All files are only allowed to be written in extension folders, except templates which of course go under the template folder.

What about log files? Some of my extensions create their own log files (in the proper DIR_LOGS directory). Is that fine?

Also, is vQmod going to be installable on the "cloud" version, or is it ocMod only? I would assume ocMod-only given the requirements you've outlined, but I wanted to check.

Re: Extension Developers Prepare for the Cloud!

Posted: Sat Mar 04, 2017 12:58 am
by JNeuhoff
Johnathan wrote:
Sat Mar 04, 2017 12:04 am
Also, is vQmod going to be installable on the "cloud" version, or is it ocMod only? I would assume ocMod-only given the requirements you've outlined, but I wanted to check.
Looking at github, there is no more a modification.php file with the OCmod logic. I think this is a good choice, we need to get away from XML-based modification systems. I can see that it still supports event handlers which is the way forward for modifications of core files.

Re: Extension Developers Prepare for the Cloud!

Posted: Sat Mar 04, 2017 8:06 pm
by Louis7777
If only you could have a one-click upgrade button in the admin panel, that would be great...

Re: Extension Developers Prepare for the Cloud!

Posted: Sat Mar 04, 2017 8:35 pm
by imdevlper18
JNeuhoff wrote:
Sat Mar 04, 2017 12:58 am
Looking at github, there is no more a modification.php file with the OCmod logic. I think this is a good choice, we need to get away from XML-based modification systems. I can see that it still supports event handlers which is the way forward for modifications of core files.

Its there in admin - controller - marketplace - modification.php
So ocmod is obviously there.. Don't know about vqmod.

Re: Extension Developers Prepare for the Cloud!

Posted: Sat Mar 04, 2017 9:31 pm
by JNeuhoff
imdevlper18 wrote:
Sat Mar 04, 2017 8:35 pm
Its there in admin - controller - marketplace - modification.php
So ocmod is obviously there.. Don't know about vqmod.
Thanks for locating it. Still, I think using events where possible is a more robust way for core file modifications. Having said that, I'll probably add the Integrated VQmod into the modification.php, and will also port the Override Engine to this new OpenCart version. The latter will need added support for the Twig template engine.

Re: Extension Developers Prepare for the Cloud!

Posted: Wed Mar 08, 2017 8:13 pm
by i2Paq
I rather see these forums finally get a readable theme!

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 10, 2017 1:57 am
by uksitebuilder
I am assuming that core files can be overriden using OCMoD ?

e.g. Edit Product Template tpl can have additional code added to it etc such as new tabs

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 10, 2017 6:41 pm
by JNeuhoff
uksitebuilder wrote:
Fri Mar 10, 2017 1:57 am
I am assuming that core files can be overriden using OCMoD ?

e.g. Edit Product Template tpl can have additional code added to it etc such as new tabs
Yes. Though the prefered way of modifying core files would be via events. XML-based specifications for core file modifications often cause clashes between different 3rd party extensions when trying to modify the same core file.

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 10, 2017 7:57 pm
by uksitebuilder
Events for templates would be great

Re: Extension Developers Prepare for the Cloud!

Posted: Fri Mar 10, 2017 8:23 pm
by JNeuhoff
uksitebuilder wrote:
Fri Mar 10, 2017 7:57 pm
Events for templates would be great
It already triggers pre-events and post-events for views:

Code: Select all

		// Trigger the pre events
		$result = $this->registry->get('event')->trigger('view/' . $route . '/before', array(&$route, &$data, &$output));
		.....
		// Trigger the post events
		$result = $this->registry->get('event')->trigger('view/' . $route . '/after', array(&$route, &$data, &$output));

Re: Extension Developers Prepare for the Cloud!

Posted: Sun Mar 12, 2017 4:53 am
by uksitebuilder
So, it seems that OCMoD cannot currently (in OC3.0.0.0) display OCmodified admin template twig files. Haven't tested the catalog side.

Looks like the above will be fixed soon: https://github.com/opencart/opencart/issues/5268

Quoting Daniel's rule about files, what about supporting images in the admin view image folder?
If we cannot add files here, where are we to add them on the admin side ?
Daniel wrote:
Fri Mar 03, 2017 2:04 pm
3. All files are only allowed to be written in extension folders, except templates which of course go under the template folder.

Re: Extension Developers Prepare for the Cloud!

Posted: Sun Mar 12, 2017 6:48 am
by OpenCart Addons
I submitted a PR to add support for images, stylesheets and JavaScript files.

https://github.com/opencart/opencart/pull/5247


Joel.

Re: Extension Developers Prepare for the Cloud!

Posted: Sun Mar 12, 2017 10:29 pm
by JNeuhoff
3. All files are only allowed to be written in extension folders, except templates which of course go under the template folder.
Where are the events from 3rd party extensions to go? Is it in the admin/controller/event and catalog/controller/event folders? Or should they go into the admin/controller/extension/* and catalog/controller/extension/* folders?

Also, what if a 3rd party extension does not belong to any of the analytics, captcha, dashboard, feed, fraud, marketing, menu. module, openbay, payment, report, shipping, theme, total? Should they then go in to their own extension subfolder, e.g. admin/controller/extension/my-own-folder ?

Re: Extension Developers Prepare for the Cloud!

Posted: Mon Mar 13, 2017 2:37 am
by JWire
i2Paq wrote:
Wed Mar 08, 2017 8:13 pm
I rather see these forums finally get a readable theme!
What's wrong with the theme? It seems perfectly readable on my end. Edit: Maybe the sky blue text could be darker.

Re: Extension Developers Prepare for the Cloud!

Posted: Mon Mar 13, 2017 2:46 am
by JNeuhoff
JWire wrote:
Mon Mar 13, 2017 2:37 am
i2Paq wrote:
Wed Mar 08, 2017 8:13 pm
I rather see these forums finally get a readable theme!
What's wrong with the theme? It seems perfectly readable on my end. Edit: Maybe the sky blue text could be darker.
Sorry, but this forum theme is a nightmare, I'd rather have this one.

Re: Extension Developers Prepare for the Cloud!

Posted: Wed Mar 15, 2017 10:50 pm
by Dreamvention
Ok, so the idea of organizing code is wonderful - about time. but i would like to stress out some situations that we can solve on the first step:

1. we use thrid-party libraries that we store in system/library to use PSR Autoload - we need access to that folder. moving it to catalog or admin is just bad practice.
at least system/library/extension/ ... but then we would have another folder there and so on... which is not that bad i guess.

2. for complex extensions we can move everything below the extension/ folder, yet this will create more levels - will it be possible to still create your own folders.

Example - admin/controller/d_vendor/account.php - simple route = d_vendor/account

if all under extensions

admin/controller/extension/d_vendor/account.php - simple route = extension/d_vendor/account (this should at least be available) or
admin/controller/extension/module/d_vendor/account.php - simple route = extension/module/d_vendor/account ...

3. config files . i would at least expect to see system/config/extension/ available

4. what about images - shouldn't we have access to image/catalog/extension/ at least so that a user has access to the folder and is able to modify images and add new ones.

5. also we have files that are used both on catalog and admin, so we keep them in system/ under their own folder. it is not logical to keep something in admin only to use it in catalog. So at least system/extension to be available.

6. languages - should be open language/*/extension with wildcard


I took the code of OpenCartAddons (thank you!) and edited it in this pull request https://github.com/opencart/opencart/pull/5281