Code:
#
# Products pagination install script for Zen Cart v1.5.0x
#
# Remove any previous installation
SELECT (@cgi:=configuration_group_id) as cgi
FROM configuration_group
WHERE configuration_group_title= 'Products Pagination';
DELETE FROM configuration WHERE configuration_group_id = @cgi AND configuration_group_id != 0;
DELETE FROM configuration_group WHERE configuration_group_id = @cgi AND configuration_group_id != 0;
DELETE FROM admin_pages WHERE page_key='configProdPagination';
# Create configuration_group
INSERT INTO configuration_group (configuration_group_title, configuration_group_description, sort_order, visible) VALUES ('Products Pagination', 'Configure Products Pagination Settings', '1', '1');
SET @cgi=last_insert_id();
UPDATE configuration_group SET sort_order = @cgi WHERE configuration_group_id = @cgi;
# Insert Product Pagination settings
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added)
VALUES ('Products Pagination — Maximum Links', 'PRODUCTS_PAGINATION_MAX', '10', 'This is the maximum number of product links to be displayed before pagination begins. This value should be greater than the number of <em>Intermediate Links</em>.<br /><br /><b>Default: 10</b><br />', @cgi, '1', NOW(), NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added)
VALUES ('Products Pagination — Intermediate Links', 'PRODUCTS_PAGINATION_MID_RANGE', '7', 'This is the number of intermediate links to be shown when the number of products in the current category is greater than the <em>Maximum Links</em>; the first and last product link is always shown. The value should be an odd number for link symmetry.<br /><br /><b>Default: 7</b><br />', @cgi, '2', NOW(), NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, use_function, set_function, date_added) VALUES ('Enable product listing link?', 'PRODUCTS_PAGINATION_LISTING_LINK', 'true', 'If enabled, a "View Product listing" link is shown on the same line as "Viewing product x of y".<br /><br /><b>Default: true</b>', @cgi, '3', NOW(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), ', NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, use_function, set_function, date_added) VALUES ('Enable links on other pages?', 'PRODUCTS_PAGINATION_OTHER', 'true', 'If enabled, the "Other pages to link" will have the pagination links applied.<br /><br /><b>Default: true</b>', @cgi, '4', NOW(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), ', NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added)
VALUES ('Other pages to link', 'PRODUCTS_PAGINATION_OTHER_MAIN_PAGES', 'account_history,advanced_search_result,featured_products,index,product_reviews,products_all,products_new,reviews,specials', 'This comma-separated list identifies the "other" pages to which the pagination display should be applied.', @cgi, '5', NOW(), NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, use_function, set_function, date_added) VALUES ('Include page-select drop-down?', 'PRODUCTS_PAGINATION_DISPLAY_PAGEDROP', 'false', 'If enabled, a drop-down menu is displayed on the <strong>other</strong> pages to allow the customer to go to a specific page number.<br /><b>Default: false</b>', @cgi, '6', NOW(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), ', NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, use_function, set_function, date_added) VALUES ('Include item-count drop-down?', 'PRODUCTS_PAGINATION_PRODUCT_COUNT', 'false', 'If enabled, a drop-down menu is displayed to allow the customer to choose the number of items displayed for the <strong>other</strong> pages. The count choices are contained in "Item Counts" (see below).<br /><b>Default: false</b>', @cgi, '7', NOW(), NULL, 'zen_cfg_select_option(array(''true'', ''false''), ', NOW());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added)
VALUES ('Item counts', 'PRODUCTS_PAGINATION_COUNT_VALUES', '10,25,50,100,*', 'This comma-separated list identifies the item-count choices that will be displayed in a drop-down menu to the customer. The value \'*\' corresponds to <em>All</em> the items being displayed.', @cgi, '8', NOW(), NOW());
# Register the page for Admin Access Control
INSERT INTO admin_pages (page_key,language_key,main_page,page_params,menu_key,display_on_menu,sort_order)
VALUES ('configProdPagination','BOX_CONFIGURATION_PRODUCT_PAGINATION','FILENAME_CONFIGURATION',CONCAT('gID=',@cgi),'configuration','Y',@cgi);
The plugin also includes the file /YOUR_ADMIN/includes/languages/english/extra_definitions/products_pagination.php that contains:
Bookmarks