Jump to content

hughconway

New Members
  • Posts

    1
  • Joined

  • Last visited

hughconway's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there, I'm trying to add a "Checkout with PayPal" (PayPal Express) button into my cart script. I have two carts. A main cart page and a mini-cart which is accessed via a drop-down from the top of any page (site: http://www.sconchtextiles.co.uk) The code for the mini-cart is: <div id="cart"> <div class="heading"> <!--<h5><?php echo $heading_title; ?></h5>--> <a><span id="cart-total"><?php echo $text_items; ?></span></a></div> <div class="content"> <?php if ($products || $vouchers) { ?> <div class="mini-cart-info"> <table> <?php foreach ($products as $product) { ?> <tr> <td class="image"><?php if ($product['thumb']) { ?> <a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" /></a> <?php } ?></td> <td class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a> <div> <?php foreach ($product['option'] as $option) { ?> - <small><?php echo $option['name']; ?> <?php echo $option['value']; ?></small><br /> <?php } ?> </div></td> <td class="quantity">x <?php echo $product['quantity']; ?></td> <td class="total"><?php echo $product['total']; ?></td> <td class="remove"><img src="catalog/view/theme/sellya/image/remove-small.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart > *');" /></td> </tr> <?php } ?> <?php foreach ($vouchers as $voucher) { ?> <tr> <td class="image"></td> <td class="name"><?php echo $voucher['description']; ?></td> <td class="quantity">x 1</td> <td class="total"><?php echo $voucher['amount']; ?></td> <td class="remove"><img src="catalog/view/theme/sellya/image/remove-small.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $voucher['key']; ?>' : $('#cart').load('index.php?route=module/cart&remove=<?php echo $voucher['key']; ?>' + ' #cart > *');" /></td> </tr> <?php } ?> </table> </div> <div class="mini-cart-total"> <table> <?php foreach ($totals as $total) { ?> <tr> <td align="right"><b><?php echo $total['title']; ?>:</b></td> <td align="right"><?php echo $total['text']; ?></td> </tr> <?php } ?> </table> </div> <div class="checkout"><a href="<?php echo $cart; ?>" class="button"><?php echo $text_cart; ?></a> <a href="<?php echo $checkout; ?>" class="button"><?php echo $text_checkout; ?></a></div> <?php } else { ?> <div class="empty"><?php echo $text_empty; ?></div> <?php } ?> </div> </div> How do I insert the code for the PayPal Express button into this? I have tried a couple of times and it ends in a weird place on the page. The code for the PayPal Express button is: <a href="index.php?route=payment/pp_express/set_payment"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="padding-right: 7px; vertical-align: baseline;"/></a>-OR- The main checkout page code is: <?php echo $header; ?> <?php if ($attention) { ?> <div class="attention" style="margin-left:20px;"><?php echo $attention; ?><img src="catalog/view/theme/sellya/image/close.png" alt="" class="close" /></div> <?php } ?> <?php if ($success) { ?> <div class="success" style="margin-left:20px;"><?php echo $success; ?><img src="catalog/view/theme/sellya/image/close.png" alt="" class="close" /></div> <?php } ?> <?php if ($error_warning) { ?> <div class="warning" style="margin-left:20px;"><?php echo $error_warning; ?><img src="catalog/view/theme/sellya/image/close.png" alt="" class="close" /></div> <?php } ?> <?php echo $column_left; ?><?php echo $column_right; ?> <div id="content" class="span12"><div class="row-fluid"><?php echo $content_top; ?> <div class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a> <?php } ?> </div> <h1><?php echo $heading_title; ?> <?php if ($weight) { ?> (<?php echo $weight; ?>) <?php } ?> </h1> <div class="clearfix"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"> <div class="cart-info"> <table> <thead> <tr> <td class="image"><?php echo $column_image; ?></td> <td class="name"><?php echo $column_name; ?></td> <td class="model"><?php echo $column_model; ?></td> <td class="quantity"><?php echo $column_quantity; ?></td> <td class="price"><?php echo $column_price; ?></td> <td class="total"><?php echo $column_total; ?></td> </tr> </thead> <tbody> <?php foreach ($products as $product) { ?> <tr> <td class="image"><?php if ($product['thumb']) { ?> <a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" /></a> <?php } ?></td> <td class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a> <?php if (!$product['stock']) { ?> <span class="stock">***</span> <?php } ?> <div> <?php foreach ($product['option'] as $option) { ?> - <small><?php echo $option['name']; ?>: <?php echo $option['value']; ?></small><br /> <?php } ?> </div> <?php if ($product['reward']) { ?> <small><?php echo $product['reward']; ?></small> <?php } ?></td> <td class="model"><?php echo $product['model']; ?></td> <td class="quantity"><input style="width:30px;" type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1" /> <input type="image" src="catalog/view/theme/sellya/image/update.png" alt="<?php echo $button_update; ?>" title="<?php echo $button_update; ?>" /> <a href="<?php echo $product['remove']; ?>"><img src="catalog/view/theme/sellya/image/remove.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" /></a></td> <td class="price"><?php echo $product['price']; ?></td> <td class="total"><?php echo $product['total']; ?></td> </tr> <?php } ?> <?php foreach ($vouchers as $vouchers) { ?> <tr> <td class="image"></td> <td class="name"><?php echo $vouchers['description']; ?></td> <td class="model"></td> <td class="quantity"><input type="text" name="" value="1" size="1" disabled="disabled" /> <a href="<?php echo $vouchers['remove']; ?>"><img src="catalog/view/theme/sellya/image/remove.png" alt="<?php echo $text_remove; ?>" title="<?php echo $button_remove; ?>" /></a></td> <td class="price"><?php echo $vouchers['amount']; ?></td> <td class="total"><?php echo $vouchers['amount']; ?></td> </tr> <?php } ?> </tbody> </table> </div> </form> </div> <?php if ($coupon_status || $voucher_status || $reward_status || $shipping_status) { ?> <h2><?php echo $text_next; ?></h2> <div class="content"> <p><?php echo $text_next_choice; ?></p> <table class="radio"> <?php if ($coupon_status) { ?> <tr class="highlight"> <td><?php if ($next == 'coupon') { ?> <input type="radio" name="next" value="coupon" id="use_coupon" checked="checked" /> <?php } else { ?> <input type="radio" name="next" value="coupon" id="use_coupon" /> <?php } ?></td> <td><label for="use_coupon"><?php echo $text_use_coupon; ?></label></td> </tr> <?php } ?> <?php if ($voucher_status) { ?> <tr class="highlight"> <td><?php if ($next == 'voucher') { ?> <input type="radio" name="next" value="voucher" id="use_voucher" checked="checked" /> <?php } else { ?> <input type="radio" name="next" value="voucher" id="use_voucher" /> <?php } ?></td> <td><label for="use_voucher"><?php echo $text_use_voucher; ?></label></td> </tr> <?php } ?> <?php if ($reward_status) { ?> <tr class="highlight"> <td><?php if ($next == 'reward') { ?> <input type="radio" name="next" value="reward" id="use_reward" checked="checked" /> <?php } else { ?> <input type="radio" name="next" value="reward" id="use_reward" /> <?php } ?></td> <td><label for="use_reward"><?php echo $text_use_reward; ?></label></td> </tr> <?php } ?> <?php if ($shipping_status) { ?> <tr class="highlight"> <td><?php if ($next == 'shipping') { ?> <input type="radio" name="next" value="shipping" id="shipping_estimate" checked="checked" /> <?php } else { ?> <input type="radio" name="next" value="shipping" id="shipping_estimate" /> <?php } ?></td> <td><label for="shipping_estimate"><?php echo $text_shipping_estimate; ?></label></td> </tr> <?php } ?> </table> </div> <div class="cart-module"> <div id="coupon" class="content" style="display: <?php echo ($next == 'coupon' ? 'block' : 'none'); ?>;"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"> <?php echo $entry_coupon; ?> <input type="text" name="coupon" value="<?php echo $coupon; ?>" /> <input type="hidden" name="next" value="coupon" /> <input type="submit" value="<?php echo $button_coupon; ?>" class="button" /> </form> </div> <div id="voucher" class="content" style="display: <?php echo ($next == 'voucher' ? 'block' : 'none'); ?>;"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"> <?php echo $entry_voucher; ?> <input type="text" name="voucher" value="<?php echo $voucher; ?>" /> <input type="hidden" name="next" value="voucher" /> <input type="submit" value="<?php echo $button_voucher; ?>" class="button" /> </form> </div> <div id="reward" class="content" style="display: <?php echo ($next == 'reward' ? 'block' : 'none'); ?>;"> <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"> <?php echo $entry_reward; ?> <input type="text" name="reward" value="<?php echo $reward; ?>" /> <input type="hidden" name="next" value="reward" /> <input type="submit" value="<?php echo $button_reward; ?>" class="button" /> </form> </div> <div id="shipping" class="content" style="display: <?php echo ($next == 'shipping' ? 'block' : 'none'); ?>;"> <p><?php echo $text_shipping_detail; ?></p> <table> <tr> <td><span class="required">*</span> <?php echo $entry_country; ?></td> <td><select name="country_id"> <option value=""><?php echo $text_select; ?></option> <?php foreach ($countries as $country) { ?> <?php if ($country['country_id'] == $country_id) { ?> <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option> <?php } else { ?> <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option> <?php } ?> <?php } ?> </select></td> </tr> <tr> <td><span class="required">*</span> <?php echo $entry_zone; ?></td> <td><select name="zone_id"> </select></td> </tr> <tr> <td><span id="postcode-required" class="required">*</span> <?php echo $entry_postcode; ?></td> <td><input type="text" name="postcode" value="<?php echo $postcode; ?>" /></td> </tr> </table> <input type="button" value="<?php echo $button_quote; ?>" id="button-quote" class="button" /> </div> </div> <?php } ?> <div class="cart-total"> <table id="total"> <?php foreach ($totals as $total) { ?> <tr> <td colspan="5" class="right"><b><?php echo $total['title']; ?>:</b></td> <td class="right"><?php echo $total['text']; ?></td> </tr> <?php } ?> </table> </div> <div class="buttons"> <div class="right"><a href="<?php echo $checkout; ?>" class="button-exclusive"><?php echo $button_checkout; ?></a></div> <div class="left"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_shopping; ?></a></div> </div> <?php echo $content_bottom; ?></div></div> <script type="text/javascript"><!-- $('input[name=\'next\']').bind('change', function() { $('.cart-module > div').hide(); $('#' + this.value).show(); }); //--></script> <?php if ($shipping_status) { ?> <script type="text/javascript"><!-- $('#button-quote').live('click', function() { $.ajax({ url: 'index.php?route=checkout/cart/quote', type: 'post', data: 'country_id=' + $('select[name=\'country_id\']').val() + '&zone_id=' + $('select[name=\'zone_id\']').val() + '&postcode=' + encodeURIComponent($('input[name=\'postcode\']').val()), dataType: 'json', beforeSend: function() { $('#button-quote').attr('disabled', true); $('#button-quote').after('<span class="wait"> <img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>'); }, complete: function() { $('#button-quote').attr('disabled', false); $('.wait').remove(); }, success: function(json) { $('.success, .warning, .attention, .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'); $('html, body').animate({ scrollTop: 0 }, 'slow'); } if (json['error']['country']) { $('select[name=\'country_id\']').after('<span class="error">' + json['error']['country'] + '</span>'); } if (json['error']['zone']) { $('select[name=\'zone_id\']').after('<span class="error">' + json['error']['zone'] + '</span>'); } if (json['error']['postcode']) { $('input[name=\'postcode\']').after('<span class="error">' + json['error']['postcode'] + '</span>'); } } if (json['shipping_method']) { html = '<h2><?php echo $text_shipping_method; ?></h2>'; html += '<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">'; html += ' <table class="radio">'; for (i in json['shipping_method']) { html += '<tr>'; html += ' <td colspan="3"><b>' + json['shipping_method'][i]['title'] + '</b></td>'; html += '</tr>'; if (!json['shipping_method'][i]['error']) { for (j in json['shipping_method'][i]['quote']) { html += '<tr class="highlight">'; if (json['shipping_method'][i]['quote'][j]['code'] == '<?php echo $shipping_method; ?>') { html += '<td><input type="radio" name="shipping_method" value="' + json['shipping_method'][i]['quote'][j]['code'] + '" id="' + json['shipping_method'][i]['quote'][j]['code'] + '" checked="checked" /></td>'; } else { html += '<td><input type="radio" name="shipping_method" value="' + json['shipping_method'][i]['quote'][j]['code'] + '" id="' + json['shipping_method'][i]['quote'][j]['code'] + '" /></td>'; } html += ' <td><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['title'] + '</label></td>'; html += ' <td style="text-align: right;"><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['text'] + '</label></td>'; html += '</tr>'; } } else { html += '<tr>'; html += ' <td colspan="3"><div class="error">' + json['shipping_method'][i]['error'] + '</div></td>'; html += '</tr>'; } } html += ' </table>'; html += ' <br />'; html += ' <input type="hidden" name="next" value="shipping" />'; <?php if ($shipping_method) { ?> html += ' <input type="submit" value="<?php echo $button_shipping; ?>" id="button-shipping" class="button" />'; <?php } else { ?> html += ' <input type="submit" value="<?php echo $button_shipping; ?>" id="button-shipping" class="button" disabled="disabled" />'; <?php } ?> html += '</form>'; $.colorbox({ overlayClose: true, opacity: 0.5, width: '600px', height: '400px', href: false, html: html }); $('input[name=\'shipping_method\']').bind('change', function() { $('#button-shipping').attr('disabled', false); }); } } }); }); //--></script> <script type="text/javascript"><!-- $('select[name=\'country_id\']').bind('change', function() { $.ajax({ url: 'index.php?route=checkout/cart/country&country_id=' + this.value, dataType: 'json', beforeSend: function() { $('select[name=\'country_id\']').after('<span class="wait"> <img src="catalog/view/theme/sellya/image/loading.gif" alt="" /></span>'); }, complete: function() { $('.wait').remove(); }, success: function(json) { if (json['postcode_required'] == '1') { $('#postcode-required').show(); } else { $('#postcode-required').hide(); } html = '<option value=""><?php echo $text_select; ?></option>'; if (json['zone'] != '') { for (i = 0; i < json['zone'].length; i++) { html += '<option value="' + json['zone'][i]['zone_id'] + '"'; if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') { html += ' selected="selected"'; } html += '>' + json['zone'][i]['name'] + '</option>'; } } else { html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>'; } $('select[name=\'zone_id\']').html(html); }, error: function(xhr, ajaxOptions, thrownError) { alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); }); $('select[name=\'country_id\']').trigger('change'); //--></script> <?php } ?> <?php echo $footer; ?> The whole site is responsive using Bootstrap and am feeling a little out of my depth! Please help...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.