ModX SimpleCart One Page checkout按照教程逐字逐句后无法正常工作

时间:2015-07-20 05:11:39

标签: modx modx-revolution formit

我正在尝试按照以下教程实现Simple Cart网站的单页结帐:

https://tutorials.modxsimplecart.com/one-page-checkout

虽然我已经这样做了但是当我尝试检出时,我得到了一个(生成SimpeCart)错误。正常的2页结账工作正常。

有谁知道我能做些什么来解决这个问题?我的代码(在One Page Checkout模板上)是:

[[!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>

我不知道我做错了什么或如何解决这个问题。有人能指出我正确的方向吗?

1 个答案:

答案 0 :(得分:0)

我发现这是因为我在结帐表单中缺少交付方式值:

<input type="hidden" name="deliveryMethod" value="[[+fi.deliveryMethod]]" />