I am trying to implement the one page checkout for a Simple Cart site by following the tutorial here:
https://tutorials.modxsimplecart.com/one-page-checkout
Although I have done this I get an (SimpeCart generated) error when I try to check out. The normal, 2 page check out works fine.
Would anyone know what I can do to fix this? My code (on the One Page Checkout template) is:
[[!scGetCart]]
[[!FormItRetriever? &redirectToOnNotFound=`[[*parent]]`]]
[[!FormIt?
&store=`1`
&hooks=`spam,scCreateOrder,redirect`
&submitVar=`checkout`
&redirectTo=`[[*id:scFirstChild]]`
&validate=`nospam:blank,
deliveryMethod:required,
paymentMethod:required,
firstname:required,
lastname:required,
street:required,
number:required,
zip:required,
city:required,
country:required,
email:email:required`
&orderAddress=`address1:street,address2:number`
]]
<form action="[[~[[*id]]]]" method="post" id="simplecartCheckout">
<input type="hidden" name="nospam" value="">
<div>
<label for="checkout_firstname">[[%simplecart.orderdetails.address.firstname? &namespace=`simplecart`]]: <span>*</span></label>
<input type="text" name="firstname" id="checkout_firstname" value="[[+fi.firstname]]" />
<label class="error">[[+fi.error.firstname]]</label>
</div>
<!--OTHER FORM FIELDS HERE-->
<div>
<label for="checkout_email">[[%simplecart.orderdetails.address.email]]: <span>*</span></label>
<input type="email" name="email" id="checkout_email" value="[[+fi.email]]" />
<label class="error">[[+fi.error.email]]</label>
</div>
[[!scDeliveryMethods]]
[[!scPaymentMethods? &delivery=`[[+fi.deliveryMethod]]`]]
<div class="submit">
<input type="submit" name="checkout" value="[[%simplecart.cart.checkout? &namespace=`simplecart` &topic=`cart`]]" />
</div>
</form>
I dont know what I have done wrong or how to fix this. Can anyone point me in the right direction?
I found this was because I was missing the delivery method value in the check out form:
<input type="hidden" name="deliveryMethod" value="[[+fi.deliveryMethod]]" />