To meet the needs of the client the Opencart has to be modified and the developer that will do the job will have to modify the core code and here is the reason for my post and suggestion. I found one opinion from opencart developer who suggested all modification of the opencart to be putted in a separate folder. Thus the modification could be controlled and they will not hamper the updates to new versions of the opencart. The best practices how the core development team could act together with all volunteer developers are Drupal, Wordpress and Firefox.
If a plug-in concept is implemented in the Opencart this will drive a lot of developers to create a powerful plug-ins and to keep them up to date with the new versions of the Opencart.
The questions are - is it possible to be done? and is it necessary?
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
For example, say I wanted to add another content box on the homepage above the latest products box.
Code: Select all
class NewBox
{
function info()
{
return array("NewBox", "Adds a new content box to the homepage");
}
function is_installed()
{
// Check a table or something exists here, which would only be there if the plugin was installed.
// If a plugin doesn't require installation, the is_installed, install and uninstall functions wouldn't be included in this file.
}
function install()
{
// Add tables etc stuff here.
}
function uninstall()
{
// Remove tables etc stuff here that were added by the install function.
}
function activate()
{
/*
Modify view and controller files etc here.
A way to do this would possibly use a function like find_replace_file, which would find text in a file, replace it with what is specified, and save the file.
This would allow any number of mods to make changes to any OC files, and still allow upgrading of the system.
*/
find_replace_file('<div id="content">', '<div class="content2"></div><div id="content">', 'catalog/view/theme/default/template/common/home.tpl');
// Other call to find_replace_file to add css here etc.
}
function deactivate()
{
// Reverse everything done in the activate function.
find_replace_file('<div class="content2"></div><div id="content">', '<div id="content">', 'catalog/view/theme/default/template/common/home.tpl');
}
}
The other segment to MyBB's plugins is a hooks system. This would allow information to be changed live by plugins on each page load with the use of plugins. Something similar to above, but it would be used at runtime.
Code: Select all
$this->plugins->hook("home_display",
function($htmlcontent)
{
$htmlcontent = str_replace('<div class="content2"></div><div id="content">', '<div id="content">', $htmlcontent);
}
);
This would GREATLY open up OpenCart to modifications, and I think it would massively benefit development.
I am currently working on a system myself to do this, as my employer requires a lot of changes to OC, but also requires the most up to date version of OC at all times.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
we really don't care what you call them as long as you put them in so we can get get things in there without editing core files.Daniel wrote:hooks are really just observer patterns. I don't know why people start renaming thing.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
I just think that this would be one of the things that could make opencart just that much better, look at wordpress almost everybody uses it if they blog. I would think as the developer of this you would want the same thing for your project.
Daniel, you really have the potential to make opencart the best ecommerce platform on the net, but the only way it will happen is if you listen to people and their requests.
Code: Select all
<?php
class ControllerModuleXXX extends Controller {
public function index() {
.......
}
public function install() {
/* module specific installation code */
/* e.g. creating DB tables */
}
public function uninstall() {
/* module specific uninstall code */
}
}
?>
admin/controller/extension/module.php from its install and uninstall methods.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Wow you are a bit behind the timesJNeuhoff wrote:What would be useful to have install and uninstall methods in the module code, e.g. file admin/controller/module/xxx.php looks like this:
And these methods would then be automatically called in theCode: Select all
<?php class ControllerModuleXXX extends Controller { public function index() { ....... } public function install() { /* module specific installation code */ /* e.g. creating DB tables */ } public function uninstall() { /* module specific uninstall code */ } } ?>
admin/controller/extension/module.php from its install and uninstall methods.
Welcome to 4 weeks ago:
http://forum.opencart.com/viewtopic.php ... 165#p86477 (2nd bullet under Added)
Just testing whether you are still paying attentionWow you are a bit behind the times
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Users browsing this forum: No registered users and 34 guests