user2206490
user2206490

Reputation: 1

Magmi stock status issue

Each product in magento has indiviual minimum qty for to be in stock

I use magmi to update the stock from an external csv file.

Issue is that on successful updation of csv , magmi does not refer to minimum qty value to set the product "in stock" or "out of stock"

So all my products endup being "in Stock" and only when I edit and save the product in admin it sets it right.


above scenario explained again:

if Current qty= 1 & mim_qty = 05 and in csv qty= 100

after magmi run (re-indexing done)

 new qty= 100 and i can see at front end at list.phtml

next

 Current qty= 100 & mim_qty = 05 and in csv qty= 3

after magmi run (re-indexing done)

 new qty= 3 and **i can see at front end at list.phtml**

following setting is common in bot case

Manage stock             = 1;
use_config_manage_stock  = 1;
min_qty                  = 05; 

Upvotes: 0

Views: 3432

Answers (2)

user2206490
user2206490

Reputation: 1

In class Magmi_ProductImportEngine under function updateStock()

Instead of:

$mqty=(isset($item["min_qty"])?$item["min_qty"]:0); 

I have added:

$gsql = "SELECT min_qty FROM cataloginventory_stock_item WHERE product_id=?";
$grvalue = $this->selectAll($gsql, array($pid));

foreach($grvalue as $gcalminqty) {

    $gfinalminqty = $gcalminqty['min_qty'];

}

$gfinalminqty = (isset($gfinalminqty) ? $gfinalminqty : 0);

$mqty = (isset($item["min_qty"]) ? $item["min_qty"] : $gfinalminqty);

This looks for min_qty in CSV, if not read from Magento, otherwhise use default.

Upvotes: 0

dweeves
dweeves

Reputation: 5605

If you want min_qty to be parsed by magmi, then you need to provide it as input to magmi beside qty value.

Magmi relies 95% on input data , not current existing DB data (except not to replicate select/multiselect options,or checking if a product exists, getting attributes metadata)

So , min_qty is not checked against existing value but input value. if no min_qty is set on input, then magmi does not update is_in_stock based on existing value of min_qty.

That's a behaviour i could enhance in next release.

Upvotes: 1

Related Questions