Results 1 to 4 of 4
  1. #1

    Default Adding an attribute to all products using SQL command?

    Hi, I would like to add a "Please select ..." as an attribute. I can do this for one product easily but i have hundreds of products that i would like to add this to. So I was wondering if there was a quick way of doing this? Perhaps an SQL command?

    The sort of procedure that I want to do is:
    - if the product has an attribute for size
    - then add the "please select" option
    - set Used for Display Purposes Only = YES
    - set Default Attribute to be Marked Selected = YES

    any suggestions would be much appreciated.. thanks

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Adding an attribute to all products using SQL command?

    Backup your database ...

    Did you back it up?

    If you did not back it up ... you will be doomed ...

    Now that you have backed up your database ... go to the Catalog ... Option Values Manager ...

    Down at the bottom of the screen, just above the last grey box you will see the instructions:
    Copy Option Name/Value to Products with existing Option Name ...
    Select an Option Name and Value that currently exists on a product or products to add to all products or to only the products in the selected category that have the selected Option Name.
    Example: Add Option Name: Color Option Value: Red to all Products with Option Name: Size
    Example: Add Option Name: Color Option Value: Green with default values from Products ID: 34 to all Products with Option Name: Size
    Example: Add Option Name: Color Option Value: Green with default values from Products ID: 34 to all Products with Option Name: Size for Categories ID: 65
    Let's say I have an Option Name: Size and I want to add the Option Value Please Select to all Option Name Size ...

    Pick from the first dropdown set:
    Option Name to add: Size
    Option Value to add: Please Select

    Option Name to add to: Size

    Leave set to the Radio Button: Ignore existing attributes and add only new attributes

    And then, as you have backed up your database first, hit Insert ...

    This will add that new Option Value for Size to all Products that have at least 1 Attribute for Option Name: Size ...

    Nifty eh?

    Now, to set the settings for that to be Default and Display Only, you need to get the options_id and options_values_id from the products_attributes table ... and you can learn the rest of the story ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3

    Default Re: Adding an attribute to all products using SQL command?

    Thank you so much for the advice!! It all worked perfectly, which has saved me a lot of time!

    In case anyone would like to know, the SQL query I used was:

    UPDATE products_attributes SET attributes_display_only = 1 WHERE options_values_id = 56; (Where the 56 is the ID for the "Please select" option)


    Thanks Linda, much appreciated!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Adding an attribute to all products using SQL command?

    Some bunny is reading between the lines ...

    Thanks for the update and posting ... the rest of the story ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

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. Changing shipping settings of all products using SQL
    By bigstore in forum Customization from the Admin
    Replies: 2
    Last Post: 6 Feb 2012, 05:53 PM
  3. Replies: 13
    Last Post: 8 Dec 2009, 03:30 AM
  4. SQl Command to update all prices in bulk
    By ksmglobal in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 3 Apr 2008, 03:34 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR