|
A.) to set the attribute, you just put the attribute_set name in a field, not the attribute_set_id
B.) I know, setting the quantity can’t be done yet through the import/export.
C.) it’s much easier to create a tiny little magento script that loads all the libraries properly than to do SQL (trust me)
Here’s a shell
<?php
require_once 'app/Mage.php';
umask(0); $_SERVER['SERVER_PORT']='443'; Mage::app('base');
// do your library calls here
Notice that “Mage::run(’base’)” has been changed to “Mage::app(’base’)”. Mage::app() simply loads all the libraries necessary and doesn’t execute a full request. The server port line is necessary if you are running this from the command line and are trying to do admin type things.
Finally, this is the SQL I used to update the stock and it didn’t blow up for me.
$product = Mage::getModel('catalog/product'); $read = $product->getResource()->getWriteConnection(); $rs = $read->query('select `entity_id` FROM `catalog_product_entity`"' ); while ($row = $rs->fetch() ) { $categoryIds[] = $row['entity_id']; } foreach ($categoryIds as $entity_id) { $read->query( 'INSERT INTO cataloginventory_stock_item (`product_id`,`stock_id`,`qty`,`is_in_stock`) VALUES ( '.$entity_id.', 1, 99999, 1)' ); }
$read should probably be called “$write”. Throw a try catch around the insert and put an update in the catch if you want to do consecutive updates of this. Oh, and paste the top script onto the top of this one, save it in the same dir as index.php
|