Hey guys,
I’m building a commercial web page simulating the ordering procedure (select a client and then add products )
Order Addition
I want to be able to apply variations & their values in any of the products that I add in every order.
In order to accomplish that I used data store (oderData). Now, because I want to be able to cancel the variations editing, I chose to create a 2nd additional data store (prod_vars) that keeps only the current (the one that I am editing) and after finishing the editing (cancel or save), I update my main data store (by passing the prod_vars data store as a value to the main data store array/field. Then I clear this 2nd additional data store and be ready for any other variation’s update.
Here is the click event of the Product Variations Modal’s SAVE ALL button:
dmx-on:click="orderData.update({$id: curPrdIndx.value.toNumber()},{prod_vars: prod_vars.data, prod_id: orderData.data[curPrdIndx.value.toNumber()-1].prod_id, prod_name: orderData.data[curPrdIndx.value.toNumber()-1].prod_name, prod_qnt: orderData.data[curPrdIndx.value.toNumber()-1].prod_qnt, prod_unt: orderData.data[curPrdIndx.value.toNumber()-1].prod_unt, prod_prc: orderData.data[curPrdIndx.value.toNumber()-1].prod_prc, prod_dsc: orderData.data[curPrdIndx.value.toNumber()-1].prod_dsc, prod_deldate: orderData.data[curPrdIndx.value.toNumber()-1].prod_deldate, prod_dest_id: orderData.data[curPrdIndx.value.toNumber()-1].prod_dest_id});modal_UpsertVarOptions.hide();prod_vars.clear()"
I have managed to create for the first time (insert) the variations but when I want to update them I cannot because the data are in my main data store oderData.
So, I need a way to pass/copy the variations from the main oderData back to the additional prod_vars data store.
I hope you understand…
Any help / idea would be much appreciated!
Thanks in advance,
Tasos