Jump to content

chastainator

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by chastainator

  1. As far as I can find it doesn't store the info in the database, when the value is false, it deletes the record from the db and defaults to what I need. The problem is the db is huge and I can't seem to make heads or tails of the structure. I spent a few days researching and it all came back to scripting php instead of dealing with the db directly.
  2. the print_r gave me an array like this, just bigger and not formatted all pretty.
  3. So I'm trying to write a script that will reset some values in a Magento product database, but I'm having some issues. I need to code to run for all products, in all stores, for all th attributes. I wrote the inital little script, and it works fine: $product_id = 1657; $store_id = 4; $attr = 'name'; $product = Mage::getModel('catalog/product') ->load($product_id) ->setStoreId($store_id) ->setData($attr, false) ->save(); The issue is, I need it to run for all products, all stores, all attributes. My next step was to test it with one attribute, one store, all products, and my code was: $product_ids = Mage::getModel('catalog/product')->getCollection()->getAllIds(); $store_id = 4; $attr = 'name'; foreach ($product_ids as $product_id){ $product = Mage::getModel('catalog/product') ->load($product_id) ->setStoreId($store_id) ->setData($attr, false) ->save(); } That code gets me no results. If I run the foreach loop and print_r the $product_ids the array contains what I think it should. Anyone have any ideas? I haven't even started to touch the multiple attributes in multiple stores since this doesn't work yet.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.