Results 1 to 10 of 15

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Change Product Model Numbers en masse?

    What is the best way to mass replace existing products_models without changing products_ids; for a given manufctuer?

    By mistake products_models are entered as numeric. Leaving out the manufacturers abbreviation, in-front of the model number.

    Need to change from 123456 to GHD-123456.

    What is the best way to do this, other than one by one through PHPMyAdmin?
    Using Zen Cart 1.5.1

  2. #2
    Join Date
    May 2013
    Posts
    38
    Plugin Contributions
    0

    Default Re: Change Product Model Numbers en masse?

    Back up your database first because bad things happen accidentally.

    Code:
    UPDATE products SET products_model = CONCAT("GHD-",products_model);
    This will update every product to have its model number prepended with "GHD-".

  3. #3
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Change Product Model Numbers en masse?

    Thank you for the reply.

    How would you limit this concatenation to a specific manufacturers_id from zen_manufacturers table?
    Using Zen Cart 1.5.1

  4. #4
    Join Date
    May 2013
    Posts
    38
    Plugin Contributions
    0

    Default Re: Change Product Model Numbers en masse?

    Let's say the manufacturer_id you wanted to work with was 1. Here's what the query would look like:

    Code:
    UPDATE products SET products_model = CONCAT("GHD-",products_model) WHERE manufacturers_id = 1;
    If you wanted to do this by name, you could, but it would require some joins.

  5. #5
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    629
    Plugin Contributions
    0

    Default Re: Change Product Model Numbers en masse?

    Quote Originally Posted by allthingsidLeroy View Post
    Let's say the manufacturer_id you wanted to work with was 1. Here's what the query would look like:

    Code:
    UPDATE products SET products_model = CONCAT("GHD-",products_model) WHERE manufacturers_id = 1;
    If you wanted to do this by name, you could, but it would require some joins.
    If this is for a small number of manufacturers I would use the above as its simple and clean. However, if you are not familiar with SQL statements for modifying the database...be very careful...in fact..if that is the case, post what you want to change and let one of the experts give you the SQL statement to run as a mistake could be costly...BACKUP....BACKUP....BACKUP lol.

  6. #6
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Change Product Model Numbers en masse?

    Quote Originally Posted by g2ktcf View Post
    If this is for a small number of manufacturers I would use the above as its simple and clean. However, if you are not familiar with SQL statements for modifying the database...be very careful...in fact..if that is the case, post what you want to change and let one of the experts give you the SQL statement to run as a mistake could be costly...BACKUP....BACKUP....BACKUP lol.
    Thank you for the advice. Don't know much about SQL statements.

    My case is exactly as I stated.

    I need to change / revise existing products_models without changing products_ids; for a defined manufacturer in the cart.

    ie. Need to change products_models from 123456 to GHD-123456, for XYZ manufacturer (XYZ manufacturers_id is 5)

    What is the SQL statement for the above?
    Is it not the following:
    Code:
    UPDATE products SET products_model = CONCAT("GHD-",products_model) WHERE manufacturers_id = 5;
    Using Zen Cart 1.5.1

 

 

Similar Threads

  1. Auto Increment Product Model Numbers?
    By jaqdaw in forum General Questions
    Replies: 0
    Last Post: 8 Feb 2011, 06:06 PM
  2. Trying to change/add model numbers with EZPopulate
    By fredsjo in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 25 Jul 2010, 09:36 AM
  3. Model Numbers With Product Options
    By DiZZ in forum General Questions
    Replies: 8
    Last Post: 17 Nov 2006, 04:16 PM
  4. Attribute product model numbers
    By Muddler in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 17 Oct 2006, 11:10 PM

Posting Permissions

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