I need to update the value of an attribute in all of my products, so I am trying to script it using the XML-RPC API. Here's the gist of what I'm doing (using a Python API wrapper):

    1234,                         # product id
    {"weight": 3.14}              # "weight" is just an example attribute code

I have two different Magento servers for two different stores, both running On the one server, this code works perfectly; the attribute value is updated successfully in the product. On the other server, the update does not take effect. In both cases the method call returns True and does not throw any exceptions. The API users and roles I'm using for both servers are also identical (including the resource access permissions).

Things I have tried:

  • updating the attribute value directly from the admin panel -- this works as expected, but is not feasible to do this for ~9000 SKUs
  • deleting and recreating the API user and role, just to be sure
  • setting the store view using catalog_product.currentStore before calling update (per this answer)
  • including the store view ID in the update call as a third paramter
  • checking the system and error logs -- saw nothing out of the ordinary
  • using a different API client -- I've tried a Ruby wrapper and a NodeJS wrapper to no avail

Any ideas what could be causing this strange behavior? Am I missing something? Like a magic switch somewhere that governs write access for the XML-RPC API? I know for a fact this was working a couple of months ago before we updated to 1.9.

Edit: As @GregC suggested, here are some additional details on my Magento instances:

  • The instances are not copies of each other and there are different product attributes defined in each.
  • The instance that I am having difficulty with has one website/store with two store views. The other instance has one website/store with one store view. I realize that there is a difference here. However, as I said, this was working before I upgraded the problematic instance to 1.9 via the clean install method. The other instance was created recently with 1.9 installed from the beginning.
  • I have tried updating both standard built-in attributes as well as custom attributes. None of them seem to update properly.
  • I have tried updating both textual (such as SKU, description) and numerical fields (such as weight, price) without success.
  • The problematic instance is hosted on SimpleHelix, who also performed the clean install of 1.9. I will try contacting them to see if other customers have had similar issues. The other instance is hosted in the Rackspace Cloud and was installed by myself.

At this point I am leaning toward a problem with one of the following:

  1. A Magento core file that someone edited when installing a module or trying to workaround a problem
  2. A remnant of v1.7 that is lurking around and causing issues, either in the database or on the filesystem
  3. A module that is installed on the problematic instance but not on the other instance. Unfortunately, there are several such modules and I can't just go around uninstalling them to see if it fixes the issue.

I realize that it would be nearly impossible to give me a straight solution to this problem, but any tips for how to track it down would be appreciated. Are there any good ways to debug this type of issue?

  • You can rule out 1 and 3 by using n98-magerun (list all rewrites). Or just grep for the <rewrite> tag and take a look in the config xmls – Toon Van Dooren Dec 8 '14 at 14:55

Disclaimer: This is not a solution to the XML-RPC issue, but a workaround you could attempt

This solution will use direct SQL which is safe in this instance as there are not any default triggers which would be thrown on updating of the weight attribute.

Find out your weight attribute id & type. You can do this by navigating through CatalogAttributesManage Attributes. Filter by the weight attribute and edit it.

In the URL you will find the attribute_id, like this:


Once you have the attribute code, you just need to know whether the value is in int, decimal or text format, which will be stored in the _int, _decimal, _varchar EAV tables.

Magento by default creates the weight attribtue in the varchar table.

Your solution script would be:

$connection_write = Mage::getSingleton('core/resource')->getConnection('core_write');
$attribute_id = 65; //your weight attribute id
$products = array(1,2,3,4); //your product id array
foreach ($products as $product_id){
    $sql = 'UPDATE `catalog_product_entity_varchar` SET `value` = ? WHERE `entity_id` = ? AND `attribute_id` = ?';
    //this is assuming it is stored within the varchar table (other options are _int or _decimal)
    $connection_write->query($sql, array("3.14", $product_id, $attribute_id);
    //should this be in the _int or _decimal table, you'd omit the quotation marks around the value
echo "Complete";

Once you run your script, your products will update extremely quickly, likely in a matter of seconds.

Heads up:

  1. To be safe, backup your website & database prior to running the script
  2. Run a full cache & reindex thereafter

Let me know if you have any troubles.

  • Thanks for the answer @moose. Unfortunately I have to go through the XML-RPC API because I am using a third-party connector for OpenERP. I also would not feel safe running direct SQL commands on a live website with thousands of customers per day, even with backups in place. – Jake Stoeffler Dec 2 '14 at 18:51

Magento is so customizable that without additional information it's going to be hard to help. We need a little more information on your Magento instances.

  • Assumption - the two stores are not copies of each other and you have different product attributes defined in each.
  • Are the sites set up as single stores or do they have multiple website/stores/views
  • Are you updating custom attributes or the magento standard ones (weight, price, etc)?
  • Are the attributes you are updating text (text field, text area, price, date), lists (multiselect, dropdown, yes/no) or images?

Here's my suggestion for now -

Try to use the REST API to update a simple (text), built in attribute like cost or weight for one product. Make sure it works on both sites. Then try again with a simple custom attribute and let us know how that goes.

I suspect you will find that there is something about the attribute you are trying to update that is causing an issue that makes Magento silently fail.

  • Thanks for your input, @GregC. I've updated my question with more details. – Jake Stoeffler Dec 5 '14 at 17:10
  • Jake - Sounds like you've done a lot of work to figrue this one out. Is there any chance you can get a copy of the site running in a local environment (using WAMP/MAMP or a Virtal Box) on your development server? You could then try turning off the extra modules without effecting the live site. If the modules are tightly tied into the template, you might have to switch back to the default Magento template to get this to work. Another plus for this method is that you could use XDEBUG to walk though the API code to see where it is failing. – GregC Dec 8 '14 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.