Re: Admin Page Registration for 3rd Party Modules
Is there any documentation yet on how to properly add 3-party plug-ins?
I'd like to be able to add a plug-in to the tools menu, and then an option under the configuration menu for settings.
I have used Conor's method (above) to get the main plug-in script to show under the tools menu, but am scratching my head on how to get the configuration settings page to show.
I can do it manually with the Admin Page Registration with these values:
Page Key: Easy Populate 4
Page Name: BOX_TOOLS_EASYPOPULATE_4
Page Filename: FILENAME_CONFIGURATION
Page Parameters: gID=32 (I look this up in phpMyAdmin)
Menu: Configuration
display: checked
sort order: 99
Any advice on how to do this automatically would be great.
Thanks!
PS: Hey Dr. Byte! Any chance you could update your Backup MYSQL Plugin to be 1.5 compatible?
Re: Admin Page Registration for 3rd Party Modules
Hi Chadd,
Hope all is well!
Quote:
Originally Posted by
chadderuski
how to get the configuration settings page to show.
I can do it manually with the Admin Page Registration with these values:
Page Key: Easy Populate 4
Page Name: BOX_TOOLS_EASYPOPULATE_4
Page Filename: FILENAME_CONFIGURATION
Page Parameters: gID=32 (I look this up in phpMyAdmin)
Menu: Configuration
display: checked
sort order: 99
Any advice on how to do this automatically would be great.
In Ceon URI Mapping I implement the following code:
PHP Code:
// Make sure configuration group can be displayed in admin menu
if (function_exists('zen_register_admin_page')) {
if (!zen_page_key_exists('ceon_uri_mapping_config_group')) {
// Add the link to the Ceon URI Mapping Config Utility to the admin menu
zen_register_admin_page('ceon_uri_mapping_config_group',
'BOX_CEON_URI_MAPPING_CONFIG_GROUP', 'FILENAME_CONFIGURATION',
'gID=' . $configuration_group_id, 'configuration', 'Y',
$configuration_group_id);
$messageStack->add('Configuration group added to admin menu.', 'success');
}
}
The value for the $configuration_group_id variable is either generated or looked up right before this call.
Adjusting that for your settings would result in the following code:
PHP Code:
// Make sure configuration group can be displayed in admin menu
if (function_exists('zen_register_admin_page')) {
if (!zen_page_key_exists('easy_populate_4')) {
// Add the link to the Easy Populate 4 to the admin menu
zen_register_admin_page('easy_populate_4',
'BOX_TOOLS_EASYPOPULATE_4', 'FILENAME_CONFIGURATION',
'gID=' . $configuration_group_id, 'configuration', 'Y',
$configuration_group_id);
$messageStack->add('Configuration group added to admin menu.', 'success');
}
}
You'd have to look up the configuration group beforehand and the messageStack notification is obviously optional but I've left it in here as I think that kind of feedback's nice for the user.
Example code for looking up configuration group ID:
PHP Code:
$check_config_group_exists_sql = "
SELECT
configuration_group_id
FROM
" . TABLE_CONFIGURATION_GROUP . "
WHERE
configuration_group_title = 'Ceon URI Mapping (SEO)';";
$check_config_group_exists_result = $db->Execute($check_config_group_exists_sql);
if (!$check_config_group_exists_result->EOF) {
$configuration_group_id =
$check_config_group_exists_result->fields['configuration_group_id'];
}
Hope that helps!
All the best...
Conor
ceon
Re: Admin Page Registration for 3rd Party Modules
It's not entirely clear what you're wanting here. If it's a way to take older add-ons that know nothing about the new security features and somehow have then automatically integrated with it, then that's not going to happen.
Responsibility for integrating add-ons into the Admin rests with the add-on's author. Most will probably add a line to the SQL executed in sql patch facility. A smaller number, such as Conor, may offer automated php-based installation using the new page registration function. The specific steps needed should be explained by each mod's installation instructions.
Older, unsupported mods present a different problem. For this the page registration page has been supplied. Explanation as to how to use it is displayed on the page itself and it seem that you've done a fine job of using it. But this is just a fallback, and you will still need to ensure that the older mod's you're using don't reintroduce the sorts of vulnerabilities that the Zen Cart have gone to great lengths to close for version 1.5.
Re: Admin Page Registration for 3rd Party Modules
Hi Conor!
Thanks for the additional info and code! I'll dig into it and we'll see how successful I am at implementing it! I'm sure other developers will also find this useful.
Hey Kuroi! --->> BTW, really like the Avatar! Very Cool! Is that new?
No, I'm not just trying to patch 'incompatible' code to work with 1.5. I have been working on an update to the Easy Populate mod for some time. It currently self detects if the configuration variables are installed and allows the user to install from within the script. You can also uninstall from within the script rather than running sql patches. Of course, this may change, and I still need to review the code to ensure it meets all the new requirements. But at this point I want to ensure the mod is easy to install for myself and others.
I have looked, but have not found any documentation on 3rd-party integration of modules. If there is, please link...
Quote:
A smaller number, such as Conor, may offer automated php-based installation using the new page registration function.
From Conor's work and Dr. Byte's statement above, I figured automated installation with the page registration function would become more the standard than just running sql patches. As it was stated in an earlier thread, this function may be removed from the admin, so I assume it would only then be available programmatically.
I'm sure the whole issue of 3rd party mods will bloom into more than just "compatible" (i.e. it works) vs being verified as secure and following all the proper guidelines for just that. Much excitement still ahead! :p
-cj
Re: Admin Page Registration for 3rd Party Modules
From what I can gather, the ability in v1.5, to install a 3rd party add-on through an SQL patch AND have the mod display in Admin>Configuration will be addressed in the final release.
Is there a way to 'simply' edit an existing .sql file to do this in the interim? I'm developing a 1.50 RC2 site and cannot get mods to show in Admin>Config..., although can navigate to them by gID
Re: Admin Page Registration for 3rd Party Modules
Quote:
Originally Posted by
simon1066
From what I can gather, the ability in v1.5, to install a 3rd party add-on through an SQL patch AND have the mod display in Admin>Configuration will be addressed in the final release.
Is there a way to 'simply' edit an existing .sql file to do this in the interim? I'm developing a 1.50 RC2 site and cannot get mods to show in Admin>Config..., although can navigate to them by gID
I have just used DrByte's http://www.zen-cart.com/forum/showpo...8&postcount=10 and conor's init_includes example on my update to Monthly Sales Tax Summary v1.4 and it works fine.
Skip
Re: Admin Page Registration for 3rd Party Modules
Thanks, Skip. I'll check this out
Cheers
Simon
Re: Admin Page Registration for 3rd Party Modules
With Skip's post having prompted me to re-read the previous posts in this thread, I now understand a bit more. I'll have to delve a bit deeper before installing SQL patches of older mods that might not be as secure as v1.50 requires.
Re: Admin Page Registration for 3rd Party Modules
Like many, I guess, this seems a bit of a round about way to install some database changes but those are the hoops PCI makes you jump through :-)
What about having a separate directory for the install files that was cleaned out after every run. What I am thinking of is a almost clone of the init_includes system but at the end of the process the directory is always cleared of files. So that any file placed in that folder would only be executed the one time.
(Or perhaps it would be better to have a directory for install files. Then create an 'available installs' admin page that scanned that folder and presented any available files along with an 'install' button. Then the user could choose to install and the file would be deleted at the end of the process. All the module developer would need to do is put a file in the install directory and it would appear in the 'Available Installs' page. )
I just think that it would at least standardise the installation process. Anyone have any thoughts?
Security risks in having a directory that contains files that are executed in this way?
------------------------
Of course, once I am thinking about that I start thinking that:
-- a module's files should be uploaded in a separate directory at root level, say /module-image-handler/
-- a file should be uploaded to the new init_install directory when it is run it moves the files from /module-image-handler/ to their correct positions copying any overwritten files back to /module-image-handler/overridden/ using a nice set of functions supplied by the core.
-- it then runs any sql statements
-- it then zips /module-image-handler/ as a recoverable record of the installation
-- it then writes data to a new table in the database with install details (and perhaps details of all over-written files so that in future a new mod could check them for compatibility)
------------------------
Of course, if there are big changes planned for Zen 2.0 then this is not worth the time. However it might be worth creating a init_install functionality to step around the chicken and egg situation that exists at the moment?
As I say just thoughts.
Re: Admin Page Registration for 3rd Party Modules
Quote:
Originally Posted by
niccol
Of course, if there are big changes planned for Zen 2.0 then this is not worth the time.
Indeed there are big changes planned - a complete plugin architecture is in the works.
But that's an entirely separate topic.