isAvailable()
isAvailable() : \StockManagerInterface
Checks if the StockManager is available
StockManager : implementation of StockManagerInterface
isAvailable() : \StockManagerInterface
Checks if the StockManager is available
addProduct(integer $id_product, integer $id_product_attribute, \Warehouse $warehouse, integer $quantity, $id_stock_mvt_reason, float $price_te, boolean $is_usable = true, integer $id_supply_order = null, $id_employee = null) : boolean
For a given product, adds a given quantity
integer | $id_product | |
integer | $id_product_attribute | |
\Warehouse | $warehouse | |
integer | $quantity | |
$id_stock_mvt_reason | ||
float | $price_te | |
boolean | $is_usable | |
integer | $id_supply_order | optionnal |
$id_employee |
removeProduct(integer $id_product, $id_product_attribute = null, \Warehouse $warehouse, integer $quantity, $id_stock_mvt_reason, boolean $is_usable = true, integer $id_order = null, $ignore_pack, $id_employee = null) : array
For a given product, removes a given quantity
integer | $id_product | |
$id_product_attribute | ||
\Warehouse | $warehouse | |
integer | $quantity | |
$id_stock_mvt_reason | ||
boolean | $is_usable | |
integer | $id_order | Optionnal |
$ignore_pack | ||
$id_employee |
getProductPhysicalQuantities(integer $id_product, integer $id_product_attribute, array|integer $ids_warehouse = null, boolean $usable = false) : integer
For a given product, returns its physical quantity If the given product has combinations and $id_product_attribute is null, returns the sum for all combinations
integer | $id_product | |
integer | $id_product_attribute | |
array|integer | $ids_warehouse | optional |
boolean | $usable | false default - in this case we retrieve all physical quantities, otherwise we retrieve physical quantities flagged as usable |
getProductRealQuantities(integer $id_product, integer $id_product_attribute, array|integer $ids_warehouse = null, boolean $usable = false) : integer
For a given product, returns its real quantity If the given product has combinations and $id_product_attribute is null, returns the sum for all combinations Real quantity : (physical_qty + supply_orders_qty - client_orders_qty) If $usable is defined, real quantity: usable_qty + supply_orders_qty - client_orders_qty
integer | $id_product | |
integer | $id_product_attribute | |
array|integer | $ids_warehouse | optional |
boolean | $usable | false by default |
transferBetweenWarehouses(integer $id_product, integer $id_product_attribute, integer $quantity, $id_warehouse_from, $id_warehouse_to, boolean $usable_from = true, boolean $usable_to = true) : boolean
For a given product, transfers quantities between two warehouses By default, it manages usable quantities It is also possible to transfer a usable quantity from warehouse 1 in an unusable quantity to warehouse 2 It is also possible to transfer a usable quantity from warehouse 1 in an unusable quantity to warehouse 1
integer | $id_product | |
integer | $id_product_attribute | |
integer | $quantity | |
$id_warehouse_from | ||
$id_warehouse_to | ||
boolean | $usable_from | Optional, true by default |
boolean | $usable_to | Optional, true by default |
getProductCoverage(integer $id_product, integer $id_product_attribute, integer $coverage, integer $id_warehouse = null) : integer
For a given product, returns the time left before being out of stock.
By default, for the given product, it will use sum(quantities removed in all warehouses)
integer | $id_product | |
integer | $id_product_attribute | |
integer | $coverage | |
integer | $id_warehouse | Optional |
number of days left (-1 if infinite)
getStockByCarrier(integer $id_product, integer $id_product_attribute, array $delivery_option = null) : integer
For a given product, retrieves the stock in function of the delivery option
integer | $id_product | |
integer | $id_product_attribute | optional |
array | $delivery_option |
quantity
calculateWA(\Stock|\PrestaShopCollection $stock, integer $quantity, float $price_te) : integer
For a given stock, calculates its new WA(Weighted Average) price based on the new quantities and price Formula : (physicalStock * lastCump + quantityToAdd * unitPrice) / (physicalStock + quantityToAdd)
\Stock|\PrestaShopCollection | $stock | |
integer | $quantity | |
float | $price_te |
WA
getStockCollection(integer $id_product, integer $id_product_attribute, integer $id_warehouse = null, integer $price_te = null) : \PrestaShopCollection
For a given product, retrieves the stock collection
integer | $id_product | |
integer | $id_product_attribute | |
integer | $id_warehouse | Optional |
integer | $price_te | Optional |
Collection of Stock