Created
September 23, 2011 01:43
-
-
Save pmeissner/1236561 to your computer and use it in GitHub Desktop.
Moving from billing to pay in 1 step.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function download_only_on_process_billing_address_place_order_and_pay($controller, $page, $params) | |
{ | |
if (post('ship_to_billing_address')) | |
{ | |
Shop_CheckoutData::copy_billing_to_shipping(); | |
$controller->action(); | |
} | |
Shop_CheckoutData::set_payment_method(Shop_PaymentMethod::find_by_api_code('default')->id); | |
// Call the default action handler | |
$controller->action(); | |
// Pretend that we are on the Review checkout step | |
// to force LemonStand to place the order | |
$_POST['checkout_step'] = 'review'; | |
$controller->action(); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="copyBillingToShipping"> | |
<input type="checkbox" name="ship_to_billing_address" value="1" checked /> | |
<label for="Ship to the billing address">Ship to the billing address</label> | |
</div> | |
<? if (!$shipping_required): ?> | |
<style type="text/css">.copyBillingToShipping { visibility: hidden;}</style> | |
<button class="button" onclick="return $(this).getForm().sendRequest('download_only_on_process_billing_address_place_order_and_pay', {update:{'checkout_page': 'checkout_partial'}})">Next</button> | |
<? else: ?> | |
<button class="button" onclick="return $(this).getForm().sendRequest('on_process_billing_address', {update:{'checkout_page': 'checkout_partial'}})">Next</button> | |
<? endif ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="copyBillingToShipping"> | |
<input type="checkbox" name="ship_to_billing_address" value="1" checked /> | |
<label for="Ship to the billing address">Ship to the billing address</label> | |
</div> | |
<? if (!$shipping_required): ?> | |
<style type="text/css">.copyBillingToShipping { visibility: hidden;}</style> | |
<button class="button" onclick="return $(this).getForm().sendRequest('download_only_on_process_billing_address_place_order_and_pay', {update:{'checkout_page': 'checkout_partial'}})">Next</button> | |
<? else: ?> | |
<button class="button" onclick="return $(this).getForm().sendRequest('on_process_billing_address', {update:{'checkout_page': 'checkout_partial'}})">Next</button> | |
<? endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment