Magento Forum

Page 2 of 2
qty column only using the first row of data for all SKU’s
 
Luciano Fuza
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-07-13
Itajaí
 

Sorry, this code work fine:

if ($helper->isQty($this->_newSku[$rowData[self::COL_SKU]]['type_id'])) {
   
if ($stockItem->verifyNotification()) {
      $stockItem
->setLowStockDate(Mage::app()->getLocale()
         ->
date(nullnullnullfalse)
         ->
toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
      );
   
}
   $stockItem
->setStockStatusChangedAutomatically((int) !$stockItem->verifyStock());
   
$stockItem->setQty($row['qty']);
else {
   $stockItem
->setQty(0);
   
Mage::getSingleton('cataloginventory/stock_status')->saveProductStatus($row['product_id']1011);
}

// Insert rows
if ($stockData{
   $this
->_connection->insertOnDuplicate($entityTable$stockData);

   
//Mage::getModel('catalog/product_website')->addProducts($websiteIds, $productIds);
   
Mage::getModel('catalog/product_website')->addProducts(array(1), $productIds);
}

where saveProductStatus parameters must be of your store::

saveProductStatus($productId$status$qty$stockId$websiteId)

and, where addProducts parameters must be of your store::

Mage::getModel('catalog/product_website')->addProducts($websiteIds$productIds);
tip: $websiteIds must be an array!

after execute the Reindex of Rewrite URL and enjoy!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TOx1c
Jr. Member
 
Total Posts:  9
Joined:  2013-02-27
 

See http://www.logicspot.com/magento/product-import-problem-stock-update-issue/

Basically, there is a substantial bug in the importexport module: in app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php, function _saveStockItem(), the $row array variable is not instantiated. So along the rows, the variable keeps the first quantity value!

Simply add the line

$row = array();
after line 1607 in Product.php, and the product quantity import will work as it should.

Thanks Simon.

EDIT: This bug was actually assigned http://www.magentocommerce.com/bug-tracking/issue?issue=13539 for 1.7.0.0 one year ago. No action!!
Assigned again http://www.magentocommerce.com/bug-tracking/issue?issue=13923 for 1.7.0.2 eight months ago. Come on, this is a highly critical bug, anybody there to fix it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
russellmania
Jr. Member
 
Total Posts:  1
Joined:  2013-04-03
 

This boggled me for a while too, but you just have to make sure to change the encoding on the csv to UTF-8 and upload via Dataflow - Profile. That should do the trick.

Step 1: Go to your Excel Document
Step 2: Click on File (or the Colorful circle icon, depending on the version of Excel you have)
Step 3: Choose ‘Save As’ and choose the format of the Excel file you’d like to use
Step 4: Name your file, and update your file path as needed
Step 5: Click on Tools, then choose ‘Web options’
Step 6: Go to the ‘Encoding‘ tab
Step 7: In the dropdown for ‘Save this document as:’ choose ‘Unicode (UTF-8)’
Step 8: Click Ok

To import products, qtys, etc.... goto Magento Admin> System> Import/Export> Dataflow - Profiles> and then click on which ever profile you’re trying to import… qty’s, customers, products, etc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
guiltyvictim
Member
 
Total Posts:  71
Joined:  2010-06-03
 
TOx1c - 19 March 2013 05:49 AM

See http://www.logicspot.com/magento/product-import-problem-stock-update-issue/

Basically, there is a substantial bug in the importexport module: in app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php, function _saveStockItem(), the $row array variable is not instantiated. So along the rows, the variable keeps the first quantity value!

Simply add the line

$row = array();
after line 1607 in Product.php, and the product quantity import will work as it should.

Thanks Simon.


EDIT: This bug was actually assigned http://www.magentocommerce.com/bug-tracking/issue?issue=13539 for 1.7.0.0 one year ago. No action!!
Assigned again http://www.magentocommerce.com/bug-tracking/issue?issue=13923 for 1.7.0.2 eight months ago. Come on, this is a highly critical bug, anybody there to fix it?

It’s a shame you can’t upvote here, but this is the proper solution. The suggestion in #8 doesn’t work if you’re not importing qty, as the script will overwrite all qty with the first product on your list’s quantity from magento.

Instantiating the $row array is definitely the proper solution, and happens to be the simplest smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
mousepad
Sr. Member
 
Total Posts:  83
Joined:  2011-05-06
 
TOx1c - 19 March 2013 05:49 AM

See http://www.logicspot.com/magento/product-import-problem-stock-update-issue/

Simply add the line

$row = array();
after line 1607 in Product.php, and the product quantity import will work as it should.

This fix doesn’t make any difference for me. Still imports same quantity for each row. Any other ideas ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bartom34
Jr. Member
 
Total Posts:  18
Joined:  2011-10-25
 

The bearslovehoney solution work well !

You just have to add “$row = array();” in the Product.php file.

Thanks you so much.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2