Zen Cart Logo
Forums / General Questions / Need help undoing this SQL change

Need help undoing this SQL change

Views: 1,383

Results 1 to 11 of 11
14 Dec 2014, 7:04 PM
#1
storeowner avatar

storeowner

New Zenner

Join Date:
Jun 2014
Location:
United States
Posts:
60
Plugin Contributions:
0

Need help undoing this SQL change

How would i Undo this

# Add the following to your database via Zen Cart Admin.

# NOTE...IF YOU USE A DATABASE PREFIX YOU MUST ADD IT INTO THESE TABLE UPDATES - FOR EXAMPLE:

# If your db prefix is zen_, then change 
# CREATE TABLE `free_gifts` ( 
# to 
# CREATE TABLE `zen_free_gifts` (




CREATE TABLE `free_gifts` (
  `gift_id` tinyint(4) NOT NULL auto_increment,
  `threshold` mediumint(9) NOT NULL default '0',
  `products_id` mediumint(9) NOT NULL default '0',
  PRIMARY KEY  (`gift_id`)
) TYPE=MyISAM;

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values (1200, 'Gifts Image Width', 'GIFTS_IMAGE_WIDTH', '90', 'The pixel width of heading images', '4', '25', now(), now(), NULL, NULL);
insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values (1201, 'Gifts Image Height', 'GIFTS_IMAGE_HEIGHT', '100', 'The pixel height of heading images', '4', '26', now(), now(), NULL, NULL);
ALTER TABLE `products` ADD `products_carrot` tinyint(1) default '0' AFTER `products_status` ;
14 Dec 2014, 7:10 PM
#2
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Need help undoing this SQL change

It should be the line below:

DROP TABLE `free_gifts`;
DELETE FROM configuration WHERE configuration_key= GIFTS_IMAGE_WIDTH;
DELETE FROM configuration WHERE configuration_key= GIFTS_IMAGE_HEIGHT;
ALTER TABLE products DROP products_carrot;
14 Dec 2014, 7:24 PM
#3
storeowner avatar

storeowner

New Zenner

Join Date:
Jun 2014
Location:
United States
Posts:
60
Plugin Contributions:
0

Re: Need help undoing this SQL change

it's saying no SQL database found, maybe it didn't install yet but I'm still getting an error for some reason
this is what i tried to install: http://www.zen-cart.com/downloads.php?do=file&id=802

I tried running the SQL thing then it showed up an error so i decided to upload the files.

after i uploaded the files I tried it again and now it's saying WARNING: An Error occurred, please refresh the page and try again.

And the admin page wouldnt even load.

I deleted the new files from carrot and put my old ones back on and now my admin page don't work but why not my store page? WARNING: An Error occurred, please refresh the page and try again.

14 Dec 2014, 7:32 PM
#4
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Need help undoing this SQL change

to instal you will need to changehtml TYPE=MyISAM to ```html
ENGINE=MyISAM

"Type=" is deprecated, will give an error
14 Dec 2014, 8:37 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Need help undoing this SQL change

StoreOwner:

this is what i tried to install: http://www.zen-cart.com/downloads.php?do=file&id=802
Careful reminder: That plugin is designed for a much older version of Zen Cart. It will require many alterations to be used on v1.5.x
Installing it as-is will corrupt many core files, and also dump obsolete code into your site.

15 Dec 2014, 1:08 AM
#6
storeowner avatar

storeowner

New Zenner

Join Date:
Jun 2014
Location:
United States
Posts:
60
Plugin Contributions:
0

Re: Need help undoing this SQL change

Thanks for the replies, Design75 your help with the mysql install fixed my issue now I ran into one other and i think it will work after this.

when i overwrite admin\includes\functions\general.php it doesn't let me load the admin page

also would like to say:
Thanks for the information DrByte and for making zen cart possible.

15 Dec 2014, 7:39 AM
#7
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Need help undoing this SQL change

StoreOwner:

Thanks for the replies, Design75 your help with the mysql install fixed my issue now I ran into one other and i think it will work after this.

when i overwrite admin\includes\functions\general.php it doesn't let me load the admin page

also would like to say:
Thanks for the information DrByte and for making zen cart possible.
I am no familiar with the mod you are trying to install , but drByte already said it is ancient. So I expect it lies in the fact it needs to be updated to work with new Zen cart versions.
Did you just overwrite the file, or merge it to add the stuff for the new mod? Otherwise you might have ended up with the wrong version of general.php, which would explain why you can not load your admin.

15 Dec 2014, 8:28 AM
#8
storeowner avatar

storeowner

New Zenner

Join Date:
Jun 2014
Location:
United States
Posts:
60
Plugin Contributions:
0

Re: Need help undoing this SQL change

Design75:

I am no familiar with the mod you are trying to install , but drByte already said it is ancient. So I expect it lies in the fact it needs to be updated to work with new Zen cart versions.
Did you just overwrite the file, or merge it to add the stuff for the new mod? Otherwise you might have ended up with the wrong version of general.php, which would explain why you can not load your admin.

renamed the old with _old.php

15 Dec 2014, 10:11 AM
#9
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help undoing this SQL change

StoreOwner:

renamed the old with _old.php

First off, renaming files in ZC should never still end with .php.
Second, for the purpose of the site loading the code, this type of renaming is the same as replacing the file. The code content of the changes made to this version of the file applicable to make this plugin function need to be carried over to the version for your store or incorporated otherwise. It's been a while since I've looked for a possible new compare utility, but winmerge and beyond compare are two applications that come to mind to help with this type of merge which should be verified with any installation.

27 Dec 2014, 4:39 AM
#10
storeowner avatar

storeowner

New Zenner

Join Date:
Jun 2014
Location:
United States
Posts:
60
Plugin Contributions:
0

Re: Need help undoing this SQL change

im having an issue now, i installed it like you said but now when users go to 2nd checkout page and try to confirm it, it brings them back to the first 1...

i tried:
DROP TABLE free_gifts;
DELETE FROM configuration WHERE configuration_key= GIFTS_IMAGE_WIDTH;
DELETE FROM configuration WHERE configuration_key= GIFTS_IMAGE_HEIGHT;
ALTER TABLE products DROP products_carrot;

"Uknown Table"

27 Dec 2014, 3:22 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Need help undoing this SQL change

StoreOwner:

im having an issue now, i installed it like you said but now when users go to 2nd checkout page and try to confirm it, it brings them back to the first 1...

i tried:
DROP TABLE free_gifts;
DELETE FROM configuration WHERE configuration_key= GIFTS_IMAGE_WIDTH;
DELETE FROM configuration WHERE configuration_key= GIFTS_IMAGE_HEIGHT;
ALTER TABLE products DROP products_carrot;

"Uknown Table"

Ummm... The above addresses data in the database, but not the files that were probably also installed. So not sure that attempting to perform the above sql will fix the problem described of moving to and from the pages.

With regards to the "Unknown Table" message, the first thing to ask is where was this sql run? Was it inside phpmyadmin or was it from the zen cart install sql patches option off of the admin panel's tools dropdown?

I'm thinking that it is in phpmyadmin. As the install sql suggests from the first post, if there is a database prefix, then it must be prepended to the table names within the sql statements. (Applicable to running the sql in phpmyadmin). If inside phpmyadmin, then the database prefix is rather readily identifiable by being the one "string" or statement that is consistent before all of the table names. For example is there a table configuration or perhaps zen_configuration? the first example has no prefix, the second has a prefix of zen_.

The prefix can be found also inside of includes/configure.php, as DB_PREFIX.

The prefix, if any, would be needed to properly enter the sql to delete the free_gifts table assuming it wasn't deleted before, that it exists in the database to begin with, and the method/location where this was run accounts for the table prefix if there is one.I'v

I've probably gone and confused matters now, though I know what I would be looking for and what it would take to accomplish.