We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40122
    • 330 Posts
    Hi all,

    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>



    Any help is much appreciated!

    This question has been answered by fourroses666. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I did exactly that once a few months ago, and it worked as expected. What, exactly is the error?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 40122
        • 330 Posts
        Quote from: sottwell at Jul 20, 2015, 02:06 AM
        I did exactly that once a few months ago, and it worked as expected. What, exactly is the error?

        No proper error - its simple triggers the failure message on the Thank You page from
        !scFinishOrder


        https://rtfm.modxsimplecart.com/frontend/checkout/thank-you-page

        Did you use any custom templates for getCart?
          • 436 ☆ A M B ☆
          • 265 Posts
          This looks like the same bug I have recently been experiencing; did you find any more clues as to what's causing this?
            MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
            • 40122
            • 330 Posts
            Quote from: AdamWintle at Jul 21, 2015, 05:29 AM
            This looks like the same bug I have recently been experiencing; did you find any more clues as to what's causing this?

            Not as yet but I have alerted Mark at Mod More about it. Will post response here
            • discuss.answer
              • 9995
              • 1,613 Posts
              When I do a fast check the only thing that is added is delivery?
              When I place the above code I also get the error message on the thank you page.

              Maybe its missing the submitVar?
              <input type="hidden" name="checkout" value="true" />
              and / or;
              <input type="hidden" name="deliveryMethod" value="[[+fi.deliveryMethod]]" />

              Does this below work for you?

              [[!scGetCart]]
              [[!FormItRetriever? &redirectToOnNotFound=`[[*parent]]`]]
              [[!FormIt?
                  &store=`1`
                  &storeTime=`1200`
                  &hooks=`spam,scCreateOrder,redirect`
                  &submitVar=`doOrder`
                  &redirectTo=`[[*id:scFirstChild]]`
                  &validate=`nospam:blank,
                      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="" />
                  <input type="hidden" name="doOrder" value="true" />
                  <input type="hidden" name="deliveryMethod" value="[[+fi.deliveryMethod]]" />
              
                  <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>
              
                  <div>
                      <label for="checkout_lastname">[[%simplecart.orderdetails.address.lastname]]: <span>*</span></label>
                      <input type="text" name="lastname" id="checkout_lastname" value="[[+fi.lastname]]" />
                      <label class="error">[[+fi.error.lastname]]</label>
                  </div>
              
                  <div>
                      <label for="checkout_street">[[%simplecart.orderdetails.address.street]]: <span>*</span></label>
                      <input type="text" name="street" id="checkout_street" value="[[+fi.street]]" />
                      <label class="error">[[+fi.error.street]]</label>
                  </div>
              
                  <div>
                      <label for="checkout_number">[[%simplecart.orderdetails.address.number]]: <span>*</span></label>
                      <input type="number" name="number" id="checkout_number" value="[[+fi.number]]" />
                      <label class="error">[[+fi.error.number]]</label>
                  </div>
              
                  <div>
                      <label for="checkout_zip">[[%simplecart.orderdetails.address.zip]]: <span>*</span></label>
                      <input type="text" name="zip" id="checkout_zip" value="[[+fi.zip]]" />
                      <label class="error">[[+fi.error.zip]]</label>
                  </div>
              
                  <div>
                      <label for="checkout_city">[[%simplecart.orderdetails.address.city]]: <span>*</span></label>
                      <input type="text" name="city" id="checkout_city" value="[[+fi.city]]" />
                      <label class="error">[[+fi.error.city]]</label>
                  </div>
              
                  <div>
                      <label for="checkout_country">[[%simplecart.orderdetails.address.country]]: <span>*</span></label>
                      <input type="text" name="country" id="checkout_country" value="[[+fi.country]]" />
                      <label class="error">[[+fi.error.country]]</label>
                  </div>
              
                  <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]]
                   <hr />
                  [[!scPaymentMethods? &delivery=`[[+fi.deliveryMethod]]`]]
              
                  <div class="submit">
                      <input type="submit" value="[[%simplecart.cart.checkout? &namespace=`simplecart` &topic=`cart`]]" />
                  </div>
              
              </form>
                Evolution user, I like the back-end speed and simplicity smiley
                • 40122
                • 330 Posts
                Quote from: fourroses666 at Jul 22, 2015, 10:13 AM
                When I do a fast check the only thing that is added is delivery?
                When I place the above code I also get the error message on the thank you page.

                Maybe its missing the submitVar?
                <input type="hidden" name="checkout" value="true">
                and / or;
                <input type="hidden" name="deliveryMethod" value="[[+fi.deliveryMethod]]">

                Thanks! That worked! I will try to figure out why