Hi, I have a project coming in where I need to hook in a stock ordering system to a MODx website. The stock ordering system will sit behind a pass-worded area and present the user with a long list of products they an order on a per week basis, indicating how many of each item they need for each day of that week. The products available to order will be CMS controlled - so fed probably by a getResources call to display each of the products included in some folders in the site tree. I guess I will use getResource tpl to include a <form> bit of code for that product and use formit to collect all the data from the stock ordering form. So after the user has indicated they want bananas, 3 of on Tuesday, 5 of on Sunday and Coffee, 1 of on MOnday, 3 on Wednesday and 2 on Saturday - The user will then click on the ORDER THESE button, then I want to hide all the un-ordered products where they can make any final amendments to the volume of products ordered, click to add more products - jumping them back to the first stock ordering view, or click on the CONFIRM button which will then post the details of the order form via email to a designated email address. I would also like the order stored in MODx in someway if possible???
Does this all sound feasible within MODx? It's kind of like an ecommerce solution without the payment bit - as the order just gets sent to the HQ for them to order on behalf of the ordering team.
Any tips / thoughts on how to achieve this?
The main bit I am not sure of a solution on, is the review your order view - which hides all products which have not been selected to order - any tips on how to hide these products?
Cheers,
dubbs.
-
☆ A M B ☆
- 24,524 Posts
I would just adapt one of the existing ecommerce extras, like SimpleCart or MiniShop2.
The results should be in the $_POST array, so it shouldn't be too difficult to display them. The trick will be handling the case where the user wants to change the order after reviewing it.
I would think that if the original form is clear enough, you wouldn't need the review. As a compromise, you could use JS to show a confirmation dialog when Submit is clicked and just abort the submission if the user doesn't confirm it.
-
☆ A M B ☆
- 24,524 Posts
If you use FormIt, you can tell FormIt to store the field values for use in a second page, like a thank-you or acknowledgement page. The second page uses the FormitRetriever snippt.
https://rtfm.modx.com/extras/revo/formit/formit.formitretriever
JS doesn't have access to the to the $_POST variables (though it can read $_GET variables in the URL), but it doesn't matter because the form hasn't actually been submitted at that point.
What I was describing goes like this:
1. User fills or edits the form
2. User clicks on the Submit button
3. The onSubmit for the button pops up an "are you sure" dialog in a location that doesn't block the form (or the dialog can be dragged).
If the user clicks yes, the form is submitted -- email sent, whatever.
If the user clicks no, the dialog disappears and the use is still looking at the form, which takes them back to step 1.
Just a thought -- the OnSubmit JS could get the results from the DOM and show the summary in the confirmation dialog.
-
☆ A M B ☆
- 24,524 Posts
It also might be interesting to get the form field values and store them in the browser disk storage, then you can get them out again whenever you want them.
https://plugins.jquery.com/tag/localstorage/