I'm using Store, Matrix, and Playa addons for an ecommerce site. I now need to add a Gift List section to the site. This is not the typical scenario as an admin user will create the list in the control panel (CP)—no front-end sign-up and users can't add products themselves.
I'm already using Store on other ecommerce parts of the site as a regular shop setup so I need all orders to still feed into the Store Orders section and the Store template variables available on the front-end as currently.
All SKU's must match a printed catalogue and they must all be unique within the system.
Each gift needs a Quantity Requested and Quantity Received value associated to it. At first thought you think you can use the Limit Stock option in the Store Product Details field but this would tie those values to each and every gift meaning that if it was requested at a later date by someone else with different quantities then it wouldn't be possible to enter it as the SKU would be a duplicate. The SKUs have to match those of a printed catalogue and in the system obviously they have to be unique.
So I need to disassociate Quantity Requested and Quantity Received from the product itself. If I were to create these as separate columns in a Matrix field I need a way to keep a running counter of products purchased, match them to the list, and increment the Quantity Received column in the Matrix field. The checkout is running on Store so I have to use Store's template variables and hooks to retrieve the details upon order completion and then somehow post them back to update the Quantity Received field in the EE CP.
The Setup (not in full or including non-important fields for brevity):
Fields: Store Product Details
Channel: Gift Lists
Within a matrix row I have a column for Gift (Playa field) to pull in a requested gift. Then a column for Quantity Requested and another for Quantity Received. Both of these fields are Number fields containing a simple integer. Looking like this.
Is that setup the best way to handle things? If so, what is the best way to grab the values from a completed order run through Store and then update the appropriate entry in the Gift Lists channel? Would I be able to use Safecracker to post back and update values? Or is there a better way to do it in PHP? Recommendations?