Closed (fixed)
Project:
Commerce Stock Reserve
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Apr 2014 at 19:03 UTC
Updated:
24 Apr 2014 at 16:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pjcdawkins commentedYes, good point. Actually it is designed to work with Simple Stock and Simple Stock Rules, although it could work without them. I should make some kind of flow diagram. Have a good look at the commerce_stock_reserve() function for a start.
The main tricky bit is working out whether (and when) the product's stock itself should be altered. By default the product's stock is changed directly when stock is reserved or released, so that anything reacting on the stock level (like commerce_ssr's validation rules) works as normal.
The latest -dev is going to be the best version to work with right now.
Comment #2
pjcdawkins commentedThis module actually (mildly) tampers with commerce_ssr's validation rules to make them account for reserved stock - see commerce_stock_reserve.rules_defaults.inc
Comment #3
pjcdawkins commentedThis is intended to clarify the sort of times when stock should be reserved or released. It's not really a "technical overview" yet.
Comment #4
guy_schneerson commentedHi @pjcdawkins - great diagram, it clears up the approach and the integration with simple stock looks spot on.
I don't know if we need more Technical overview than what you provided (its more then what most project got)
when I get more time will install and take the module for a proper spin.
Comment #5
pjcdawkins commentedThanks. I've added this image to the project page.
And here's what happens in detail when stock is reserved or released.
Reserve stock for a line item
commerce_stock_reserve($line_item)commerce_stock_reserve_set_product_stock(){commerce_stock_reserve}the line item ID, product ID, the amount reserved (== line item quantity), and time reservedRelease stock for a line item
commerce_stock_reserve($line_item, TRUE){commerce_stock_reserve}commerce_stock_reserve_set_product_stock()Comment #6
guy_schneerson commentedHi @pjcdawkins
Thanks for the explanation, I did at the time have a quick look at the code but only after looking at the diagram it started falling into place.
Hope to find more time soon to look at it more closely and actually installing and using your module, looks like its a great addition. .