Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    7
    Plugin Contributions
    0

    Default SQL query to set all products quantity to 1

    I've just entered hundreds of items withouth setting their stock. Sincer I want them to allways be in stock I need to set the quantity for each product to 1. Since it's much easier then doing it 1 by 1, how can I do this with sql command?

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: SQL query to set all products quantity to 1

    Quote Originally Posted by skynetslo View Post
    I've just entered hundreds of items withouth setting their stock. Sincer I want them to allways be in stock I need to set the quantity for each product to 1. Since it's much easier then doing it 1 by 1, how can I do this with sql command?
    update `zen_products` set `products_quantity` = 1 WHERE 1 ;

    You may need to change " zen_products" if your database uses a different prefix.

    If SOME of your products already have quantities, a better command would be

    update `zen_products` set `products_quantity` = 1 WHERE products_quantity = 0 ;

    Cheers
    Rod

  3. #3
    Join Date
    Nov 2009
    Posts
    7
    Plugin Contributions
    0

    Default Re: SQL query to set all products quantity to 1

    Thank you very much RodG!

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,511
    Plugin Contributions
    126

    Default Re: SQL query to set all products quantity to 1

    But be sure to turn off Admin->Configuration->Stock->Subtract stock to false.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v139h adding attributes to all products with sql query
    By delia in forum General Questions
    Replies: 8
    Last Post: 22 Apr 2014, 07:40 PM
  2. Replies: 4
    Last Post: 23 Feb 2014, 09:39 PM
  3. Replies: 7
    Last Post: 29 Jul 2011, 08:37 PM
  4. SQL Query to Delete All Products Only
    By toussi in forum General Questions
    Replies: 0
    Last Post: 26 Nov 2008, 06:57 PM
  5. Replies: 3
    Last Post: 11 Sep 2007, 05:36 AM

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