Can anyone tell me how to add a checkout link next to the "Add to Cart" button on product.tpl?
Thanks!

Code: Select all
<a id="button-cart"
Code: Select all
<a id="button-checkout" class="button"><span><?php echo $button_checkout; ?></span></a>
Code: Select all
<script type="text/javascript"><!--
$('#button-cart').bind('click', function() {
Code: Select all
<script type="text/javascript"><!--
$('#button-checkout').bind('click', function() {
$.ajax({
url: 'index.php?route=checkout/cart/update',
type: 'post',
data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
dataType: 'json',
success: function(json) {
$('.success, .warning, .attention, information, .error').remove();
if (json['error']) {
if (json['error']['warning']) {
$('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
$('.warning').fadeIn('slow');
}
for (i in json['error']) {
$('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>');
}
}
if (json['success']) {
location = 'index.php?route=checkout/checkout';
}
}
});
});
//--></script>
Code: Select all
$this->data['button_cart'] = $this->language->get('button_cart');
Code: Select all
$this->data['button_checkout'] = $this->language->get('button_checkout');
Code: Select all
$_['button_checkout'] = 'Checkout';
Code: Select all
<?php echo $button_checkout; ?>
Code: Select all
Checkout
Code: Select all
location = index.php?route=checkout/checkout;
Code: Select all
<a id="go-checkout" class="button" onclick="window.location='http://localhost/index.php?route=checkout/checkout';"><span><?php echo 'Checkout'; ?></span></a>
Hi Simon,uksitebuilder wrote: edit: catalog/language/yourlanguage/product/product.php
add a new defineCode: Select all
$_['button_checkout'] = 'Checkout';
Code: Select all
$_['button_checkout'] = 'Checkout';
@UKSB: This is really fantastic script and very very useful too, I request you to please make a "CHECKOUT BUTTON" vqmod ext of this same script(add the product and then go to checkout page directly), please consider my request UKSB, you have given us such good mods, incl one more in your range.uksitebuilder wrote:My code will add a checkout button that when clicked will add the product to the cart and then go straight to checkout with that product.
Regards,
Sun Systems
Industrial Electronics and Instrumentation
Users browsing this forum: No registered users and 10 guests