Forums / General Questions / HOW TO INSTALL OLDER VERSION PLUGINS WITH install.sql on the latest zencart version

HOW TO INSTALL OLDER VERSION PLUGINS WITH install.sql on the latest zencart version

Views: 1,060

Results 1 to 4 of 4
28 Jan 2019, 9:41 AM
#1
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

HOW TO INSTALL OLDER VERSION PLUGINS WITH install.sql on the latest zencart version

Hello all, the new version of zencart have number of new changes and the most common problem you will get is that all the plugins with install.sql should contain one new statement...

Its the ",NULL" right before every closing ")" on confuguration,

At this point I dont know if ,NULL will do the job with every plugin but it worked for me so far with the tested plugins, so it will work in most cases

Here is an example of not working install.sql:

DELETE FROM configuration_group WHERE `configuration_group_title` LIKE 'Manufacturers All Config' LIMIT 2;
DELETE FROM configuration WHERE `configuration_description` LIKE 'Manufacturers All Listing:%' LIMIT 7;

INSERT INTO configuration_group VALUES ('', 'Manufacturers All Config', 'Manufacturers All Config', '1', '1');
SELECT @gida := configuration_group_id FROM `configuration_group` where `configuration_group_title` LIKE 'Layout Settings';
SELECT @gid := configuration_group_id FROM `configuration_group` where `configuration_group_title` LIKE 'Manufacturers All Config';
UPDATE configuration_group SET sort_order = @gid WHERE configuration_group_id = @gid;

INSERT INTO configuration VALUES ('', 'Categories Box - Show Manufacturers All Link', 'SHOW_CATEGORIES_BOX_MANUFACTURERS_ALL', '1', 'Manufacturers All Listing: Set this to 1 if you want to show the All Manufacturers link to show in the Categories Box.', @gida, '0', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),");
INSERT INTO configuration VALUES ('', 'Display Empty Manufacturers', 'MANUFACTURERS_ALL_EMPTY_SHOW', '0', 'Manufacturers All Listing: Set this to 1 if you want manufacturers with no products to show on the list.', @gid, '7', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),");
INSERT INTO configuration VALUES ('', 'Display Manufacturer Image', 'MANUFACTURERS_ALL_IMAGE_SHOW', '1', 'Manufacturers All Listing: Set this to 1 if you want the manufacturers logo to appear with the listing.', @gid, '7', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),");
INSERT INTO configuration VALUES ('', 'Display Manufacturer URL', 'MANUFACTURERS_ALL_URL_SHOW', '1', 'Manufacturers All Listing: Set this to 1 if you want the manufacturers URL to appear with the listing.', @gid, '7', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),");
INSERT INTO configuration VALUES ('', 'Manufacturers Per Row', 'MANUFACTURERS_ALL_COLUMNS', '4', 'Manufacturers All Listing: Set the number of manufacturers per row to display.<br>(default 4)', @gid, '7', now(), now(), NULL, NULL);
INSERT INTO configuration VALUES ('', 'Manufacturer Image Width', 'MANUFACTURERS_ALL_WIDTH', '100px', 'Manufacturers All Listing: Set the maximum width of the manufacturers image.<br>(default 100px)', @gid, '7', now(), now(), NULL, NULL);
INSERT INTO configuration VALUES ('', 'Manufacturer Image Height', 'MANUFACTURERS_ALL_HEIGHT', '100px', 'Manufacturers All Listing: Set the maximum height of the manufacturers image<br>(default 100px)', @gid, '7', now(), now(), NULL, NULL);


/*
Admin page (Zen-cart 1.5.0)
*/
INSERT INTO `admin_pages` (`page_key` ,`language_key` ,`main_page` ,`page_params` ,`menu_key` ,`display_on_menu` ,`sort_order`)VALUES 
('configManufacturersList', 'BOX_CONFIGURATION_MANUFACTURERS_LIST', 'FILENAME_CONFIGURATION', CONCAT('gID=',@gid), 'configuration', 'Y', @gid);

And here is the working example:

DELETE FROM configuration_group WHERE `configuration_group_title` LIKE 'Manufacturers All Config' LIMIT 2;
DELETE FROM configuration WHERE `configuration_description` LIKE 'Manufacturers All Listing:%' LIMIT 7;

INSERT INTO configuration_group VALUES ('', 'Manufacturers All Config', 'Manufacturers All Config', '1', '1');
SELECT @gida := configuration_group_id FROM `configuration_group` where `configuration_group_title` LIKE 'Layout Settings';
SELECT @gid := configuration_group_id FROM `configuration_group` where `configuration_group_title` LIKE 'Manufacturers All Config';
UPDATE configuration_group SET sort_order = @gid WHERE configuration_group_id = @gid;

INSERT INTO configuration VALUES ('', 'Categories Box - Show Manufacturers All Link', 'SHOW_CATEGORIES_BOX_MANUFACTURERS_ALL', '1', 'Manufacturers All Listing: Set this to 1 if you want to show the All Manufacturers link to show in the Categories Box.', @gida, '0', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);
INSERT INTO configuration VALUES ('', 'Display Empty Manufacturers', 'MANUFACTURERS_ALL_EMPTY_SHOW', '0', 'Manufacturers All Listing: Set this to 1 if you want manufacturers with no products to show on the list.', @gid, '7', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);
INSERT INTO configuration VALUES ('', 'Display Manufacturer Image', 'MANUFACTURERS_ALL_IMAGE_SHOW', '1', 'Manufacturers All Listing: Set this to 1 if you want the manufacturers logo to appear with the listing.', @gid, '7', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);
INSERT INTO configuration VALUES ('', 'Display Manufacturer URL', 'MANUFACTURERS_ALL_URL_SHOW', '1', 'Manufacturers All Listing: Set this to 1 if you want the manufacturers URL to appear with the listing.', @gid, '7', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);
INSERT INTO configuration VALUES ('', 'Manufacturers Per Row', 'MANUFACTURERS_ALL_COLUMNS', '4', 'Manufacturers All Listing: Set the number of manufacturers per row to display.<br>(default 4)', @gid, '7', now(), now(), NULL, NULL, NULL);
INSERT INTO configuration VALUES ('', 'Manufacturer Image Width', 'MANUFACTURERS_ALL_WIDTH', '100px', 'Manufacturers All Listing: Set the maximum width of the manufacturers image.<br>(default 100px)', @gid, '7', now(), now(), NULL, NULL, NULL);
INSERT INTO configuration VALUES ('', 'Manufacturer Image Height', 'MANUFACTURERS_ALL_HEIGHT', '100px', 'Manufacturers All Listing: Set the maximum height of the manufacturers image<br>(default 100px)', @gid, '7', now(), now(), NULL, NULL, NULL);


/*
Admin page (Zen-cart 1.5.0)
*/
INSERT INTO `admin_pages` (`page_key` ,`language_key` ,`main_page` ,`page_params` ,`menu_key` ,`display_on_menu` ,`sort_order`)VALUES 
('configManufacturersList', 'BOX_CONFIGURATION_MANUFACTURERS_LIST', 'FILENAME_CONFIGURATION', CONCAT('gID=',@gid), 'configuration', 'Y', @gid);

All the best!

My most recent work: magprom.net

28 Jan 2019, 12:46 PM
#2
lat9 avatar

lat9

Administrator

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

Re: HOW TO INSTALL OLDER VERSION PLUGINS WITH install.sql on the latest zencart version

The root cause of the issue you're having is that that install.sql is using blind inserts, i.e. identifying only the *values *to be placed into the database table without regard to the *names *of the fields that the specific bits of data should be placed. In addition, that install.sql posted presumes to put an empty string ('') into the configuration_id field which is an integer -- that won't fly with more recent and strict versions of mySQL.

For each configuration item, the INSERT statement should be changed from (using the first as an example):

INSERT INTO configuration VALUES ('', 'Categories Box - Show Manufacturers All Link', 'SHOW_CATEGORIES_BOX_MANUFACTURERS_ALL', '1', 'Manufacturers All Listing: Set this to 1 if you want to show the All Manufacturers link to show in the Categories Box.', @gida, '0', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);

to

INSERT INTO configuration 
    [B](configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, set_function, use_function)[/B] 
VALUES 
    ('Categories Box - Show Manufacturers All Link', 'SHOW_CATEGORIES_BOX_MANUFACTURERS_ALL', '1', 'Manufacturers All Listing: Set this to 1 if you want to show the All Manufacturers link to show in the Categories Box.', @gida, '0', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);

... noting the removal of that first '', from each insertion.

28 Jan 2019, 3:15 PM
#3
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: HOW TO INSTALL OLDER VERSION PLUGINS WITH install.sql on the latest zencart version

lat9:

INSERT INTO configuration
[B](configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, set_function, use_function)[/B]
VALUES
('Categories Box - Show Manufacturers All Link', 'SHOW_CATEGORIES_BOX_MANUFACTURERS_ALL', '1', 'Manufacturers All Listing: Set this to 1 if you want to show the All Manufacturers link to show in the Categories Box.', @gida, '0', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),", NULL);


Extra NULL at the end wouldn't you have to add the , val_function to the first statement?  Would cause a count difference in SQL.

Dave
Always forward thinking... Lost my mind!

28 Jan 2019, 3:25 PM
#4
lat9 avatar

lat9

Administrator

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

Re: HOW TO INSTALL OLDER VERSION PLUGINS WITH install.sql on the latest zencart version

davewest:

Extra NULL at the end wouldn't you have to add the , val_function to the first statement? Would cause a count difference in SQL.
Thanks, Dave, the correction (since those pre-zc156 plugins don't include a val_function) should read:

INSERT INTO configuration 
    (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, set_function, use_function) 
VALUES 
    ('Categories Box - Show Manufacturers All Link', 'SHOW_CATEGORIES_BOX_MANUFACTURERS_ALL', '1', 'Manufacturers All Listing: Set this to 1 if you want to show the All Manufacturers link to show in the Categories Box.', @gida, '0', now(), now(), NULL, "zen_cfg_select_option(array('0', '1'),");

... removing that extra ,NULL.