0

I'm building a course booking system. Users will be able to book one or more 'places' on a course. When they make their booking, they need to provide their details (name, address, age, etc).

Say a user is booking 5 places on a given course. They need to be able to provide different details for each of those places.

It's similar to what you might have seen when booking plane tickets. You specify how many people are flying, then you get a form with a set of fields for each passenger where you enter their name, passport number, etc.

I thought I might be able to use the product form tag and add custom modifiers, but it doesn't seem to be possible to add different modifiers for each 'instance' of the product.

Has anyone done something similar? Am I barking up the wrong tree with modifiers? Is there a better solution?

Thanks for your help Pete

0

I've come up with a solution. It's a bit more javascript-heavy than I would like, but hey ho.

The user selects the number of places they'd like to book on the course, then clicks 'continue', at which point I use javascript to generate that number of instances of a {exp:store:product} tag pair. Inside the tag pair are the custom modifier fields as well as a hidden field to set a quantity of 1.

The user completes the form(s) then clicks 'add to cart'. The 'add to cart' button triggers some javascript, which loops over each of the forms, submitting each one via AJAX. It then reloads the page.

The end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.