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

  • Home
  • SEARCH
  • 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 6233039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:13:38+00:00 2026-05-24T10:13:38+00:00

In Magento I write a number of small command line scripts to do things

  • 0

In Magento I write a number of small command line scripts to do things like set a new attribute on a number of products. I am finding that the time it takes to update 900 products takes about 6 hours to complete.

The time it takes to load the individual products goes as fast as I would except, but the act of saving once I have made the change takes a very long time.

I am attaching how I am loading the products in case there is something I can do to better optimize the process. Any help here would be greatly appreciated.

$product = Mage::getModel('catalog/product')->load($magento_id);
$product->setMadeInUsa(1);
try {
    $product->save();
} catch(Exception $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}

The code runs without error, but it takes forever.

  • 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-05-24T10:13:40+00:00Added an answer on May 24, 2026 at 10:13 am
    Mage::getSingleton('catalog/product_action')
                ->updateAttributes(array($product->getId()), $attributesData, $storeId);
    

    This code only updates the attributes you want to change. The first paramater is an array of product IDs, the second is an array of attribute names and values, and then the third is the store ID you wish to update.

    This is MUCH faster than saving the entire model.

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

Sidebar

Related Questions

In a Magento forum someone wrote that removing this line from the WSDL file
I have to create a number of new stores inside my Magento installation. One
My understanding of Magento is that you can only have 2 themes loaded at
I've noticed that Magento keeps the URL to the logo it uses for each
I'm trying to build a simple Magento Module that needs to connect to the
HI Magento introduced a new concept of widget in magento 1.4 , my question
I'm trying to write a custom payment gateway for Magento. The module is recognised
I am working on a new payment module for Magento and have come across
I am trying to add a new payment module into Magento. However, even after
I'm trying to write a Magento (CE 1.4) extension to export order data once

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.