Forums / Code Collaboration / Requiring "Other" Mods for new Plugin

Requiring "Other" Mods for new Plugin

Views: 3,753

Results 1 to 13 of 13
27 Dec 2021, 3:09 PM
#1
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Requiring "Other" Mods for new Plugin

I want to create a new plugin (actually a couple lol). I need to add certain fields to the database as I have previously mentioned. Numinix Product Fields will give me about 90% of what I need.

If you were doing this, would you just require this mod and add the other 10%?

Or

Just add everything you need ...?

Thanks!

27 Dec 2021, 3:12 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Requiring "Other" Mods for new Plugin

I'd go down path #2 (just add everything you need) to make it easier on people that want to use your newly-minted plugin.

27 Dec 2021, 3:20 PM
#3
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Requiring "Other" Mods for new Plugin

lat9:

I'd go down path #2 (just add everything you need) to make it easier on people that want to use your newly-minted plugin.

that is what I was learning towards. Then upgrades are easier in one package.

Thanks!

27 Dec 2021, 4:26 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Requiring "Other" Mods for new Plugin

g2ktcf:

that is what I was learning towards. Then upgrades are easier in one package.

Thanks!
Exactly ... and then you're more in-control of your package!

27 Dec 2021, 6:40 PM
#5
swguy avatar

swguy

Administrator

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

Re: Requiring "Other" Mods for new Plugin

Seconded. Unless absolutely necessary, I discourage people from submitting plugins that have preconditions for other plugins.

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.

27 Dec 2021, 6:57 PM
#6
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Requiring "Other" Mods for new Plugin

swguy:

Seconded. Unless absolutely necessary, I discourage people from submitting plugins that have preconditions for other plugins.

Do how would YOU handle "duplicates" from those other mods? I need product dimensions -> Length, Width and Height for example. If someone already has that additional mod installed then that would cause issues. If it was JUST the database, that is easy enough to look and test for. But changes for inputs on the Admin Products edit page would not be.

Thoughts?

PS I have been known to start an idea...and leave it there. I am actively coding this one...slowly, but a little more every day! :D

27 Dec 2021, 8:32 PM
#7
swguy avatar

swguy

Administrator

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

Re: Requiring "Other" Mods for new Plugin

For this particular case, I would say:

  • if you have Canada Post with dimensional pricing installed, skip this step
  • if you have so-and-so plugin installed, skip this step.

otherwise, run this sql file ....

THEN later on you may need to say:

Note: if your product table already has dimensions, you may need to modify this plugin to reconcile the field names I used (length, width, height) with whatever you already have, if the names are different. Just change these files:

foo.php
bar.php
etc.

and change "length" to "name-of-your-length-field"
Something like that.

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.

27 Dec 2021, 8:59 PM
#8
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Requiring "Other" Mods for new Plugin

That makes total sense. I never considered offering options on how to get the field names into the DB! That is great input.

Thanks!
Chris

27 Dec 2021, 9:04 PM
#9
swguy avatar

swguy

Administrator

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

Re: Requiring "Other" Mods for new Plugin

You could even make the field names defined constants and tell people to just update those.

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.

27 Dec 2021, 9:06 PM
#10
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Requiring "Other" Mods for new Plugin

swguy:

You could even make the field names defined constants and tell people to just update those.

exactly what I was thinking!

28 Dec 2021, 2:05 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Requiring "Other" Mods for new Plugin

While there may be some known caveats about whether to run a section of the installation or not, it is also important that the sql be written to recognize that the field(s) may already exist. This cuts down on questions about the operation failing and how to figure out why.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Dec 2021, 4:12 PM
#12
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Requiring "Other" Mods for new Plugin

mc12345678:

While there may be some known caveats about whether to run a section of the installation or not, it is also important that the sql be written to recognize that the field(s) may already exist. This cuts down on questions about the operation failing and how to figure out why.

for field names the exact same name, that would be an easy thing to do for the sql side. For some plugins, we can even check or a list of popular used ones like Numinix's.

But I am wondering about the forms that go into the Admin product pages for the input forms. I guess comment out the code and have the user uncomment what is needed IF they have certain plugins already installed?

28 Dec 2021, 4:36 PM
#13
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Requiring "Other" Mods for new Plugin

g2ktcf:

for field names the exact same name, that would be an easy thing to do for the sql side. For some plugins, we can even check or a list of popular used ones like Numinix's.

But I am wondering about the forms that go into the Admin product pages for the input forms. I guess comment out the code and have the user uncomment what is needed IF they have certain plugins already installed?

The historical tenet of Zen Cart is to provide more allowing the user to edit/remove what is not needed or wanted. This is instead of providing some sort of "hidden" content to then uncomment. I saw above that seemed to be asking about how to address the form part, unfortunately because we almost all of the form data is captured by hard coding instead of some sort of array of information, the addsit I nal fields likely should be included with some sort of documentation about how to prevent that/those fields from being duplicated.

A long long time ago, data was put together using a sort of table class which could then be searched through to identify the existence of a type of data or in this case a specific field. To get away from the pure "table" structure, where table tags were used, all natural div tags have been used. In the admin this means a lot of code has to be touched to adapt to a new "template" instead of some few key logic or construct changes.

Also it's been a while since I've looked at or caused duplicate fields in a form, but I expect one of them to take priority over the other in some way. I'd have to do more research again to advise further on how to handle that possibility of two "plugins" offering the same field(s) in a single form.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...