Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    Default SQL to replace product id how to?

    Hi all,

    My shop have some products that like that

    for example the product id:
    This is the target product that starting from 00 or 000
    001234
    000348

    And some other products that have the chart. have the 0 or 00 etc, such as E00112-B, AWD-001 that we don't want to touch them or change, since they are not our change target.

    Then now, my thinking is, make change of the 001234 to EK001234, 000348 to EK000348 etc. all add the EK on it id before.

    I have the permission can access the MySQL server database and table by using phpmyadmin, anyone can tell me how to make above change to all the 00XXXX and 000XXX products quickly and safe by SQL?

    Thank you very much of your time and kindly help.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,442
    Plugin Contributions
    279

    Default Re: SQL to replace product id how to?

    product ID must ONLY be numeric.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    Default Re: SQL to replace product id how to?

    Hi All,

    The Product id is same mean of Model No. Sorry to make the mistake there.

    My mean is how to Model: 00XXX change to Model: EK00XXX by SQL

    Thx
    Last edited by explorer1979; 16 May 2011 at 03:57 AM.

  4. #4
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,196
    Plugin Contributions
    0

    Default Re: SQL to replace product id how to?

    Back up your database first..... Very Important...


    UPDATE products
    SET products_model = 'EK00XXX'
    WHERE products_model = '00XXX'

  5. #5
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    Default Re: SQL to replace product id how to?

    Hi herado,

    Thank you very much...

    but one more question....
    the XXX is a different value there just for example....

    For example 001234, 005489, 004566, 000234 etc... so I just said it as 00XXX is for easy understand ...


    For the MySQL's SQL... How to make it know I just change all value start from 00, and 000 to EK00, EK000?

    Your value in the SQL example of 00XXX to EK00XXX is a absolute value, how do it know need to change all value starting from 00?

    Thank you very much again of your kindly help and time.

  6. #6
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    Default Re: SQL to replace product id how to?

    Hi all,

    Final find this way work for me.

    UPDATE products
    SET products_model = CONCAT('EK',products_model)
    WHERE manufacturers_id = 11
    AND products_model NOT LIKE 'EK%'

  7. #7
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,196
    Plugin Contributions
    0

    Default Re: SQL to replace product id how to?

    Ty for posting the solution ....

 

 

Similar Threads

  1. v139h SQL find and replace
    By gloerick in forum General Questions
    Replies: 4
    Last Post: 12 Dec 2022, 09:16 PM
  2. Replies: 3
    Last Post: 11 May 2012, 12:35 PM
  3. Replies: 13
    Last Post: 8 Dec 2009, 03:30 AM
  4. how to replace the description of product in bulk?
    By handbag86 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 6 Jul 2009, 05:41 PM
  5. How to replace category/product name with image?
    By Rotkale in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 19 Dec 2006, 03:59 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