jsqu99 / spree_flexi_variants

Spree extension to create product variants as-needed
BSD 3-Clause "New" or "Revised" License
116 stars 143 forks source link

Order Line Item Adhoc items are mutable #68

Open nostopbutton opened 11 years ago

nostopbutton commented 11 years ago

I've discovered, what I believe to be, a flaw in the logic for how the adhoc option values for Order line items are stored in the data model (AdHocOptionValuesLineItem).

I plan to look at whether I am able to implement a change in this area, but would appreciate the views of anyone who works with this extension regularly.

The current implementation works by creating a reference link between the order line item and the reference table that stores the adhoc option values. My concern is that the Order, once placed should be self-contained and immutable (unless deliberately adjusted). Unfortunately, the effect of referencing the adhoc option values means that if anyone changes those values in future, the old orders will be affected by the changes.

Screenshot_10_3_13_9_18_PM

e.g.

A solution to this should be to copy the adhoc option values into a table (such as AdHocOptionValuesLineItem) to make the value immutable to changes reference data in the AdHocOptionValue table.

jsqu99 commented 10 years ago

@nostopbutton - Very sorry for the long-delayed response. did you ever come up with a solution? happy to integrate it if you have one.