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 6866449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:11:06+00:00 2026-05-27T03:11:06+00:00

I added a custom eav attribute to my Magento application product entity using an

  • 0

I added a custom eav attribute to my Magento application product entity using an installer script (Basically, following the procedure described here: Installing Custom Attributes with Your Module). Now, I want to use an update script to change (populate) the values of this attribute for each product according to some criteria (based on the product category). The script I attempted to use was essentially like this:

$attributeValues = array(...) // Map from $productId to the desired  $value
$product = Mage::getModel('catalog/product');
foreach($attributeValues as $productId=>$value){
    $product->load($productId)->setMyAttribute($value);
    $product->save();
}

My questions would then be: Is it ok to use this level of abstraction (Mage::getModel(‘catalog/product’) and its methods) in update scripts? If it isn’t, how would you recommend to change these attribute values using update scripts (without requiring sql)?

The script I used (until now) has not worked and failed with the error:

Call to a member function getStoreIds() on a non-object

in a magento core file.

I don’t know if this error is a Magento bug or is a problem with how I’m using the update scripts.

I’m using Magento 1.4.0.1

  • 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-27T03:11:07+00:00Added an answer on May 27, 2026 at 3:11 am

    Try adding Mage::app()->setUpdateMode(false) in your sql upgrade script. e.g.

    $installer = new Mage_Eav_Model_Entity_Setup('core_setup');;
    $installer->startSetup();
    Mage::app()->setUpdateMode(false);
    Mage::app()->setCurrentStore('your_store_code_here');
    

    If you look in Mage::app()->getStore() you will see the following snippet that returns an incorrect store which is required for saving a product.

    if (!Mage::isInstalled() || $this->getUpdateMode()) {
            return $this->_getDefaultStore();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've added custom attribute to orders using mysql4-install-1.0.0.php in my module: $installer = $this;
I added a custom menu to the menu button using the following code: @Override
I've added a custom attribute (custom_contacttype) to the Contact entity. This attribute is of
I added a custom install action to my installer to add one of my
I am using jquery validation plugin for form validation. I have added a custom
Yesterday I added a custom MembershipProvider to an ASP.NET web application, but when I
I have added custom attribute with the code my_price with Catalog Input Type for
I added a custom property to a generated class from the database using a
Is there a way to add a custom EAV attribute that automatically gets set
I've added a custom order attribute and updated the onepage checkout page. Now I'm

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.