Skip to content

Instantly share code, notes, and snippets.

@Javlopez
Last active August 29, 2015 14:27
Show Gist options
  • Save Javlopez/9624de9707f2b8222081 to your computer and use it in GitHub Desktop.
Save Javlopez/9624de9707f2b8222081 to your computer and use it in GitHub Desktop.
  1. Update by csv

    When we upload csv, only update (replace the quantity) catalog_supplier_stock

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
10 10 0 20

csv: GR843EL85HVILAVEN-68580:3

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
10 3 0 13

2 Update by Webservice

curl -X POST -H 'Content-Type:application/json' -d '{"skus":[{"sku":"GR843EL85HVILAVEN-68580","quantity":"1","source":4}],"key":"ebbb2e77befbf548373597477603431db59ba51f"}' https://userauth_basic:[email protected]/stock/webservice/update-stock/ -v

The data is like this '{"sku":"GR843EL85HVILAVEN-68580","quantity":"1","source":2}'

if (source == 2 ) add that quantity to catalog_warehouse_stock Example:

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
10 10 0 20

update {"sku":"GR843EL85HVILAVEN-68580","quantity":"1","source":2}

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
11 10 0 21

if (source == 4 || source==1 ) Extract stock quantity from catalog_supplier_stock and add that quantity to catalog_warehouse_stock Example:

Before webservice

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
10 10 0 20

update {"sku":"GR843EL85HVILAVEN-68580","quantity":"1","source":4}

after webservice

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
11 9 0 20

3 Sync stock by Webservice

curl -X POST -H 'Content-Type:application/json' -d '{"skus":[{"sku":"GR843EL85HVILAVEN-68580","quantity":"1"}],"key":"ebbb2e77befbf548373597477603431db59ba51f"}' https://userauth_basic:[email protected]/stock/webservice/sync-stock/ -v

This webservice only replace the quantity of catalog_warehouse_stock table

Before webservice

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
10 10 0 20

update {"sku":"GR843EL85HVILAVEN-68580","quantity":"8"}

after webservice

catalog_warehouse_stock (own stock) catalog_supplier_stock( supplier stock) reserved available stock
8 10 0 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment