Forum
Need a little help with manual checkout...
So I have a perch shop installation that works great! I and the client love it... we're successfully selling tickets for a regional symphony orchestra... both individual and season ticket packages... Perch Shop is awesome!
We run the purchases through Braintree and that works very well.
Now I need to a checkout process for when the order is has a grand_total
of zero and so I can redirect the user to the manual checkout.
I'm successfully getting the manual checkout and register pages to kick in when needed, but my submit button is not submitting the order to the system...
Here's my code:
checkout-manual.php:
at the top:
if (perch_member_logged_in() && perch_post('payment_method_nonce')) {
// your 'success' return URL
$return_url = '/';
$cancel_url = '/';
perch_shop_checkout('manual', [
'status' => 'manual_order',
'return_url' => $return_url,
'cancel_url' => $cancel_url,
]);
}
then at where the checkout button is:
perch_shop_form('checkout/confirm.html');
where checkout/confirm.html is:
<div class="box shop minor">
<perch:form id="confirm" app="perch_shop" class="order-confirm">
<perch:label for="terms">
<perch:input type="checkbox" value="true" id="terms" cart-property="terms_agreed" required="true" />
I agree to the terms and conditions.
</perch:label>
<div>
<perch:input type="submit" value="Pay now" class="button" />
</div>
</perch:form>
</div>
manual_order
is an active status with an index of 101.
When I click the button, the page just refreshes... Can you see what might be wrong?
and then two side questions....
What is perch_post('payment_method_nonce')
? Do I only need that for Braintree?
Do I need an entry for manual checkout in config/shop.php for manual checkout?
Thank you!
payment_method_nonce
is only set by the Braintree JS, so if you're not using Braintree, don't check for it.Ok, thanks. Do I need an entry for manual checkout in config/shop.php?
No - what problem are you seeing?
so: When I click the button, the page just refreshes... Can you see what might be wrong?
by button I mean the button on the checkout/confirm.html template which is called into my manual checkout page.
I guess I'm confused about when the manual orders get submitted... Does it get submitted when the user presses the button presented by checkout/confirm.html?
Have you removed the nonce check?
If so, turn on debug and see what's happening.
oh. Hold on...
I have this:
If I remove
'status' => 'manual_order'
it works... But I should be able to pass in the status, no?Is that a valid status? Have you checked debug?
it's valid (using key, right?) and enabled and index 101...
Nothing that looks abnormal to me... Don't actually see any reference to status in the debug...
It advances to the success page ('/') but does not add the record to perch if I use
'status' => 'manual_order',
Debug seems to be listed twice?
Is that after calling the checkout function?
So sorry. It was manual_order, not manual-order. Can I buy you a beer? (feel stupid)