Skip to content

Commit

Permalink
Cleaned up cart UI.
Browse files Browse the repository at this point in the history
Encapsulated payment information in a colorbox. Moved error messages to
language file.
  • Loading branch information
btcgear committed Dec 7, 2012
1 parent 9d50fb1 commit 704971f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 20 deletions.
3 changes: 3 additions & 0 deletions upload/catalog/controller/payment/bitcoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class ControllerPaymentBitcoin extends Controller {
protected function index() {
$this->language->load('payment/'.$this->payment_module_name);
$this->data['button_bitcoin_confirm'] = $this->language->get('button_bitcoin_confirm');
$this->data['button_bitcoin_pay'] = $this->language->get('button_bitcoin_pay');
$this->data['error_msg'] = $this->language->get('error_msg');
$this->data['error_confirm'] = $this->language->get('error_confirm');
$this->data['error_incomplete_pay'] = $this->language->get('error_incomplete_pay');

$this->checkUpdate();

Expand Down
3 changes: 3 additions & 0 deletions upload/catalog/language/english/payment/bitcoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
// Text
$_['text_title'] = 'Bitcoin - bitcoind';
$_['button_bitcoin_confirm'] = 'I sent it!';
$_['button_bitcoin_pay'] = 'Pay with Bitcoin';
$_['error_msg'] = 'Error communicating with payment provider. Please contact the store for assistance.';
$_['error_confirm'] = 'That didn\\\'t quite work. Please try again. If you receive this message multiple times, please contact us so we can help finalize your order.';
$_['error_incomplete_pay'] = 'We have not yet received your full payment. If you already sent it, try again in a few seconds. If you receive this message multiple times, please contact us so we can help finalize your order.';
?>
58 changes: 38 additions & 20 deletions upload/catalog/view/theme/default/template/payment/bitcoin.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,51 @@ DEALINGS IN THE SOFTWARE.
-->

<?php if(!$error) { ?>
<div style="font-size:16px; text-align:center;">Please send <input type="text" style="font-size:18px; text-align: right; width:100px; " readonly="readonly" value="<?php echo $bitcoin_total; ?>"> BTC to <input type="text" style="font-size:18px; width:400px; text-align:center; " readonly="readonly" value="<?php echo $bitcoin_send_address; ?>"> to complete the transaction.</div>
<div class="buttons">
<div class="right"><a id="button-confirm" class="button"><span><?php echo $button_bitcoin_confirm; ?></span></a></div>
</div>
<div class="buttons">
<div class="right"><a id="button-pay" class="button"><span><?php echo $button_bitcoin_pay; ?></span></a></div>
</div>
<?php } else { ?>
<div class="warning">
<?php echo $error_msg; ?>
</div>
<?php } ?>
<script type="text/javascript"><!--
$('#button-confirm').bind('click', function() {
$.ajax({
type: 'GET',
url: 'index.php?route=payment/bitcoin/confirm_sent',
timeout: 5000,
error: function() {
alert('That didn\'t quite work. Please try again. If you receive this message multiple times, please contact us so we can help finalize your order.');
},
success: function(received) {
if(!received) {
alert("We have not yet received your full payment. If you already sent it, try again in a few seconds. If you receive this message multiple times, please contact us so we can help finalize your order.");
}
else {
location.href = 'index.php?route=checkout/success';
}
}
$('#button-pay').on('click', function() {
html = '<div style="font-size:16px; padding:6px; text-align:center;">Please send <span style="font-size:18px; border-style:solid; border-width: 1px; border-radius:3px; padding-top:3px; padding-right:6px; padding-left:6px; padding-bottom:3px;"><?php echo $bitcoin_total; ?></span> BTC to </div><div style="font-size:16px; padding:6px; text-align:center;"><span style="font-size:18px; border-style:solid; border-width: 1px; border-radius:3px; padding-top:3px; padding-right:6px; padding-left:6px; padding-bottom:3px;"><?php echo $bitcoin_send_address; ?></span></div><div style="font-size:16px; padding:6px; text-align:center;"> to complete the transaction.</div>';
html += '<div class="buttons">';
html += ' <div class="right"><a id="button-confirm" class="button"><span><?php echo $button_bitcoin_confirm; ?></span></a></div>';
html += '</div>';
$.colorbox({
overlayClose: true,
opacity: 0.5,
width: '500px',
height: '225px',
href: false,
html: html,
onComplete: function() {
$('#button-confirm').on('click', function() {
$.ajax({
type: 'GET',
url: 'index.php?route=payment/bitcoin/confirm_sent',
timeout: 5000,
error: function() {
alert('<?php echo $error_confirm; ?>');
},
success: function(received) {
if(!received) {
alert('<?php echo $error_incomplete_pay; ?>');
}
else {
location.href = 'index.php?route=checkout/success';
}
}
});
});
}
});
});
//--></script>


0 comments on commit 704971f

Please sign in to comment.