Update stock / prices

From Magmi Wiki
Revision as of 20:59, 7 July 2011 by Dweeves (talk | contribs) (store or not store, that is the question)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Magmi Update mode

Magmi can be update mode is used to update attributes of existing products, and the 2 most commons candidates for updates are : price & stock.

While Magento Dataflow export format is very verbose, magmi can act on only a very small subset of it. In update mode, the subset can be as small as sku + modified attributes columns.

Some common updates columns lists

Columns for Stock update

  • sku
  • qty

Columns for Price update

  • sku
  • price

Columns for Stock & Price Update

  • sku
  • qty
  • price


Of course, any supplementary column may be used if your update is done one more values than price or stock (like special_price or name)

store or no store, that is the question

the store column is not present in the samples i gave.

In fact, some values are store dependent (like price) and some are not (qty)

The rule of thumb is :

  • attributes are store dependent
  • inventory related column are stock dependent

So ,

  • multistore stock update is trivial since all stores share the same stock*

(*) see below for multi stock qty update

  • multistore price update needs explicit store to be set if your prices are not global and may differ from one store to another

Magmi behaviour on store column

No store column defined nor mapped or defaulted through plugins

  • up to 0.7.11 : Warning "no decimal attribute set for sku xxxx"
  • from 0.7.12 : magmi will assume "admin" store (ie: default values)

Some invalid store view codes among the store column value

  • up to 0.7.11 : no warning, values imported only on valid store views.
  • from 0.7.12 : a waning will be issued listing the invalid store view codes, values imported only on valid store views

All store view codes invalid in store column

  • up to 0.7.11 : Warning "no decimal attribute set for sku xxxx"
  • from 0.7.12 : a waning will be issued listing the invalid store view codes,another one for telling line is skipped.

Stock update, the samples

In all following samples we have 3 items (skus 00001,00002,00003)

Fixed stock update

This kind of stock update is the most common and is supported since the beginning of magmi.

The following CSV will do the trick

sku,qty
00001,2
00002,4
00003,5

Relative Stock update (since 0.7.12)

This handy feature enable to set stock relatively for exising items (adding & removing units)

To specify relative stock update, only put a + or - before the qty value, magmi will perform relative stock operation.

The following CSV will increase stock for 00001 & 00003 , decrease for 00002

sku,qty
00001,+1
00002,-3
00003,+4

Multiple stock update

Some extensions can provide multiple stock support , and this support is theoritically available in the magento DB info , however not used yet in magento standard release.

Magmi can handle multiple stock , for this , the stock_id column is necessary

Here , we'll dispatch our items stock among differents stocks (here say stock_id 1 & 2)

Relative syntax is permitted here too , this sample will mix both fixed & relative stock !!!

sku,qty,stock_id
00001,+2,1
00001,-2,2
00002,4,1
00002,5,2
00003,-4,1
00003,2,2

Price update, the samples