Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7859375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:53:40+00:00 2026-06-02T21:53:40+00:00

I am missing the SQL out of this to Bulk update attributes by SKU/UPC.

  • 0

I am missing the SQL out of this to Bulk update attributes by SKU/UPC.

Running EE1.10 FYI

I have all the rest of the code working but I"m not sure the who/what/why of
actually updating our attributes, and haven’t been able to find them, my logic
is

  1. Open a CSV and grab all skus and associated attrib into a 2d array
  2. Parse the SKU into an entity_id
  3. Take the entity_id and the attribute and run updates until finished
  4. Take the rest of the day of since its Friday

Here’s my (almost finished) code, I would GREATLY appreciate some help.

    /**
     * FUNCTION: updateAttrib
     * 
     * REQS: $db_magento
     * Session resource
     * 
     * REQS: entity_id
     * Product entity value
     * 
     * REQS: $attrib
     * Attribute to alter
     * 
     */

See my response for working production code. Hope this helps someone in the Magento community.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:53:47+00:00Added an answer on June 2, 2026 at 9:53 pm

    While this may technically work, the code you have written is just about the last way you should do this.

    In Magento, you really should be using the models provided by the code and not write database queries on your own.

    In your case, if you need to update attributes for 1 or many products, there is a way for you to do that very quickly (and pretty safely).

    If you look in: /app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php you will find that this controller is dedicated to updating multiple products quickly.

    If you look in the saveAction() function you will find the following line of code:

    Mage::getSingleton('catalog/product_action')
        ->updateAttributes($this->_getHelper()->getProductIds(), $attributesData, $storeId);
    

    This code is responsible for updating all the product IDs you want, only the changed attributes for any single store at a time.

    The first parameter is basically an array of Product IDs. If you only want to update a single product, just put it in an array.

    The second parameter is an array that contains the attributes you want to update for the given products. For example if you wanted to update price to $10 and weight to 5, you would pass the following array:

    array('price' => 10.00, 'weight' => 5)
    

    Then finally, the third and final attribute is the store ID you want these updates to happen to. Most likely this number will either be 1 or 0.

    I would play around with this function call and use this instead of writing and maintaining your own database queries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to figure out why this PL/SQL purge script runs slowly
I have a SQL Record that has number that are all out of order
I know SQL well but I must be missing something really dumb here. This
I am missing this DLL reference in c:\program files\SQL Server\90\Tools\Binn. I'm assuming that this
All, I have an application that needs to attach and detach multiple SQL databases
When getting values out of xml attributes, using the xquery value operator, missing attributes
I've been struggling to work this out all afternoon - it seems pretty simple
I have a data model like this in SQL Server: table Note - varchar
I entered the following SQL commands in Oracle but it complained ORA-00922: missing or
Probably missing something completely obvious here, but here goes. I'm starting out with Spring

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.