Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2005
    Location
    Portland, OR
    Posts
    178
    Plugin Contributions
    0

    Default SQL query for site-wide word replacement?

    I've managed to improperly capitalize a word on my site on multiple products and descriptions, as well.

    Is there an easy via SQL to search for the word "Foo" and make it "foo", site-wide?

  2. #2
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,067
    Plugin Contributions
    0

    Default Re: SQL query for site-wide word replacement?

    Sure there is ...
    Just make sure you back up your data base first incase you mess up ..


    Mark
    Hare Do - Does the rabbit beat Zen "never".
    Zen Cart 1.5.1 Update Release Need help Purchase the Book

  3. #3
    Join Date
    Jun 2005
    Location
    Portland, OR
    Posts
    178
    Plugin Contributions
    0

    Default Re: SQL query for site-wide word replacement?

    thanksl, although my word is also in the title of the product, will this replace that as well? If so, i'm assuming this is adequate?
    Code:
    UPDATE products_description SET products_description = REPLACE(products_description, "Foo'", "foo");

  4. #4
    Join Date
    Jun 2005
    Location
    Portland, OR
    Posts
    178
    Plugin Contributions
    0

    Default Re: SQL query for site-wide word replacement?

    Quote Originally Posted by bi11i View Post
    thanksl, although my word is also in the title of the product, will this replace that as well? If so, i'm assuming this is adequate?
    Code:
    UPDATE products_description SET products_description = REPLACE(products_description, "Foo'", "foo");
    this actually did not work, although stated one statement was processed. what am i missing?

  5. #5
    Join Date
    Jun 2005
    Location
    Portland, OR
    Posts
    178
    Plugin Contributions
    0

    Default Re: SQL query for site-wide word replacement?

    I see the mistake that I made here, got a little confused about the extra apostrophe in the example "2x3'". That worked great, except for product names - is there any easy to fix this, as well?

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    20,958
    Plugin Contributions
    25

    Default Re: SQL query for site-wide word replacement?

    You should be able to do essentially the same thing using the product name field. You will have to look up the correct table and field name(s). Note that there might be multiple tables to alter... not certain whether the product name is repeated, or purely linked by reference to the product id.

    Look carefully at all "products_" tables and their fields.

  7. #7
    Join Date
    Jun 2005
    Location
    Portland, OR
    Posts
    178
    Plugin Contributions
    0

    Default Re: SQL query for site-wide word replacement?

    Quote Originally Posted by gjh42 View Post
    You should be able to do essentially the same thing using the product name field. You will have to look up the correct table and field name(s). Note that there might be multiple tables to alter... not certain whether the product name is repeated, or purely linked by reference to the product id.

    Look carefully at all "products_" tables and their fields.
    afraid i'm not knowledgeable enough to be doing this kind of thing. I may resort to manually making the edits but the description suggestion was quite helpful and will save me some time.

    thanks so much!

  8. #8
    Join Date
    Nov 2009
    Location
    UK
    Posts
    1,122
    Plugin Contributions
    0

    Default Re: SQL query for site-wide word replacement?

    If you really don't like playing around with phpmyadmin or sql commands, you could simply download your complete database as a file, put it into notepad, and simply do a word replace as you would with any text document, save the file and then re-upload your database.

    Make a back up first though.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 11 May 2012, 12:35 PM
  2. SQL script to change site wide table widths
    By bigstore in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 Feb 2012, 02:12 AM
  3. Sql query file for product listing
    By bobmatt4u in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 24 Jun 2009, 05:33 AM
  4. SQL Patch command / query for changing description.
    By signprint in forum General Questions
    Replies: 3
    Last Post: 15 Mar 2009, 12:34 PM
  5. SQL Query for who purchased an item?
    By Jeff_Mash in forum General Questions
    Replies: 6
    Last Post: 16 Oct 2006, 07:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •