Received some feedback on an installation of the plugin on ZC 1.5.4. For those that downloaded the plugin following the above post, there is an issue in the installation script for ZC versions 1.5.4 and below that is now corrected. For those that downloaded, the changes are identified at this commit difference and the file is available from this commit. For those curious, the issue was that the function zen_register_admin_page was considered/incorporated into the code, but in looking at the ZC 1.5.5 version, the sort order (relates to where in the menu list the option is supposed to appear) is "auto-determined" if not provided. Prior to this (yes a simple comparison/review) as in ZC 1.5.1 - 1.5.4 (versions considered applicable for this plugin), the sort order had to be provided when using the function. The sort_order calculation already existed without using this ZC function, but when zen_register_admin_page was incorporated the code was not rearranged to support backwards compatibility. That has been resolved as of a few minutes ago. A few further code improvements were incorporated into the associated function as well. While I was there, figured I should address them.
For those that like to just "see" the code changes, they are from:
Code:
if (function_exists('zen_register_admin_page')) {
zen_register_admin_page('productsWithAttributesStockSetup', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', '', 'configuration', 'Y');
zen_register_admin_page('productsWithAttributesStockAjax', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', '', 'catalog', 'N');
} else {
//get current max sort number used, then add 1 to it.
//this will place the new entry 'productsWithAttributesStock' at the bottom of the list
$sql = "SELECT ap.sort_order
FROM ".TABLE_ADMIN_PAGES." ap
WHERE ap.menu_key = 'configuration'
order by ap.sort_order desc limit 1";
$result = $db->Execute($sql);
$result = $result->fields['sort_order'] + 1;
$sql = "INSERT INTO `".TABLE_ADMIN_PAGES."` (page_key, language_key, main_page, page_params, menu_key, display_on_menu, sort_order)
VALUES
('productsWithAttributesStockSetup', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', '', 'configuration', 'Y', ".$result.")";
$db->Execute($sql);
$sql = "INSERT INTO `".TABLE_ADMIN_PAGES."` (page_key, language_key, main_page, page_params, menu_key, display_on_menu, sort_order)
VALUES
('productsWithAttributesStockAjax', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', '', 'catalog', 'N', ".$result.")";
$db->Execute($sql);
}
To:
Code:
// get current max sort number used, then add 1 to it.
// this will place the new entry 'productsWithAttributesStock' at the bottom of the list
$sql = "SELECT MAX(ap.sort_order) as sort_order_max
FROM " . TABLE_ADMIN_PAGES . " ap
WHERE ap.menu_key = 'configuration'";
$result = $db->Execute($sql);
$result = $result->fields['sort_order_max'] + 1;
if (function_exists('zen_register_admin_page')) {
zen_register_admin_page('productsWithAttributesStockSetup', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', '', 'configuration', 'Y', $result);
$result = $result + 1; // provide an increased sort order for the next non-displayed menu.
zen_register_admin_page('productsWithAttributesStockAjax', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', '', 'catalog', 'N', $result);
} else {
$sql = "INSERT INTO `".TABLE_ADMIN_PAGES."` (page_key, language_key, main_page, page_params, menu_key, display_on_menu, sort_order)
VALUES
('productsWithAttributesStockSetup', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_SETUP', '', 'configuration', 'Y', :sort_order:)";
$sql = $db->bindVars($sql, ':sort_order:', $result, 'integer');
$db->Execute($sql);
$result = $result + 1; // provide an increased sort order for the next non-displayed menu.
$sql = "INSERT INTO `".TABLE_ADMIN_PAGES."` (page_key, language_key, main_page, page_params, menu_key, display_on_menu, sort_order)
VALUES
('productsWithAttributesStockAjax', 'BOX_CONFIGURATION_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', 'FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK_AJAX', '', 'catalog', 'N', :sort_order:)";
$sql = $db->bindVars($sql, ':sort_order:', $result, 'integer');
$db->Execute($sql);
}
Bookmarks