Results 1 to 9 of 9
  1. #1
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default adding attributes to all products with sql query

    I have a large cart that needs the same three attributes added to every product. Some products already have them but many don't. I'm trying to do a sql query to do it all at once and have realized it's dang complicated.

    Esentially it would say if all products don't have these three attributes, add the attributes.

    I don't think any of the mass attribute functions can do this except to copy over category by category. If there's another way, I would love to hear about it. Otherwise...sql query.
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

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

    Default Re: adding attributes to all products with sql query

    Probably can't be done with a typical single SQL query.

    The built-in mass copiers use PHP code to read existing data, determine what changes are needed, and then do the appropriate inserts as required.
    Use the right tool for the job ;)
    .

    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
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: adding attributes to all products with sql query

    So then we need to do the copy to category manually? - and there are a lot of categories...
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  4. #4
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: adding attributes to all products with sql query

    Since some of the product already have one of the attributes and we don't want that changed, we would be doing the Ignore and add only new attributes choice correct?
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

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

    Default Re: adding attributes to all products with sql query

    Is there anything different about the Products with the 1 Attribute already added vs the way you want the Attributes to be for all Products on the site?
    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!]
    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!

  6. #6
    Join Date
    Mar 2014
    Location
    USA
    Posts
    10
    Plugin Contributions
    0

    Default Re: adding attributes to all products with sql query

    Quote Originally Posted by delia View Post
    Since some of the product already have one of the attributes and we don't want that changed, we would be doing the Ignore and add only new attributes choice correct?
    Hi there, I am having the same issue . So far I have not added any attributes to my products. is there a way to insert attributes 'size' and 'color' at once. i am having 200 pruducts and they are too much to go one by one. would appreciate for any help.

    Thank you in advace!!!

  7. #7
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: adding attributes to all products with sql query

    I expect we did do it category by category instead of with a query. It's been too long ago to remember details but that's probably what we had to do.
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  8. #8
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: adding attributes to all products with sql query

    Quote Originally Posted by refinerztouch View Post
    Hi there, I am having the same issue . So far I have not added any attributes to my products. is there a way to insert attributes 'size' and 'color' at once. i am having 200 pruducts and they are too much to go one by one. would appreciate for any help.

    Thank you in advace!!!
    One way, although requires installation of a plugin and some learning would be to use something like easy populate or apsona. If there are changes desired to be made en mass in the future, I would recommend that route. Otherwise, there are several database like modifications that can be made, delia for example suggested grouping all items within one or more categories and then could update the database based on that one or more categories. If it is all products, then things become a little easier as there is no longer a limit applied to what to modify. For some reason I thought that the admin panel had such an "apply attribute to all products" type option. But I could be wrong, I haven't had to use it.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,874
    Plugin Contributions
    96

    Default Re: adding attributes to all products with sql query

    Quote Originally Posted by delia View Post
    I expect we did do it category by category instead of with a query. It's been too long ago to remember details but that's probably what we had to do.
    As delia indicated, you can use the feature built into Catalog->Attributes Controller to copy the currently displayed product's attributes to all products within a category (I don't know when this feature was implemented; it might not be in v1.3.9h).

    Essentially, you display a product that contains the attributes that you want to copy. You'll see at the top of the Attributes Controller display a set of buttons; the one on the far righthand side is "Copy To" with a link to "CATEGORY" below it. Click that button and you can select the category for which all products are to be set to include the attributes for that currently-displayed product! Granted, it's on a category-by-category basis, but the feature is already there.

 

 

Similar Threads

  1. v154 Help with a SQL Query for Query Builder
    By lindasdd in forum Managing Customers and Orders
    Replies: 2
    Last Post: 24 Mar 2016, 01:18 PM
  2. Replies: 4
    Last Post: 23 Feb 2014, 09:39 PM
  3. SQL query to set all products quantity to 1
    By skynetslo in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 3 Dec 2009, 04:21 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. Help please: adding "options" to products (sql query)
    By sjku in forum General Questions
    Replies: 19
    Last Post: 20 Feb 2008, 01:31 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