Forums / Code Collaboration / Encapsulated Plugins - Payment modules

Encapsulated Plugins - Payment modules

Views: 3,437

Results 1 to 3 of 3
2 Feb 2022, 5:55 PM
#1
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Encapsulated Plugins - Payment modules

So, this is just a clarification or best-practices question.

Imagine a payment module that has all the normal stuff and then its own admin page. So, if the user uploads both the includes and the zc_plugins folders, they will immediately see the payment plugin appearing in the modules>>payment page of admin. They will have the opportunity to 'install' the module on that page.

They will also have the option to install the plugin in the plugin manager. (In order to get the admin page to show etc.)

In fact they have to do both.

This seems confusing to me. Does anyone have thoughts about how best to manage it?

(On a different note, it means that the developer gets to agonise about where is best to put db table creation. Should I put it in the module like the old days? Should I put it in the installer? Does it matter? Aaaaaa!)

On a code suggestion it would be nice if there was a flag in admin/modules.php that disabled the module from showing unless it had been enabled in the plugin manager. So, it could be a method in the payment module class itself such as requires_plugin_activation() which defaults to false if that method does not exist and only is true if the developer makes it so. So, somewhere around ln206 of modules.php you check if you need to check that the module is installed. If it requires installation and is not installed then don't display it.

Actually, the problem is sort of worse on uninstall. If I uninstall in plugins manager then I guess I would expect that the module was 'removed' in the modules page.

As you can tell, I am a bit confused about best practice. :smile:

Nick
iszent.com

2 Feb 2022, 8:09 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: Encapsulated Plugins - Payment modules

It's a good question but I think the short term answer is that you don't want to do modules (payment, shipping or order total) this way, at least yet.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

2 Feb 2022, 8:47 PM
#3
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Encapsulated Plugins - Payment modules

swguy:

It's a good question but I think the short term answer is that you don't want to do modules (payment, shipping or order total) this way, at least yet.

Thanks Scott.

Yup, I came to that conclusion too. In particular, 'disable' in the plugin manager won't actually disable the payment module which could be bad.

Maybe if and when encapsulation extends to store front, it will work better.

Nick
iszent.com