PageRenderTime 28ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/catalog/view/theme/agss/template/checkout/cart.tpl

https://gitlab.com/leijianbin/agss
Smarty Template | 249 lines | 223 code | 26 blank | 0 comment | 31 complexity | b71501959c65ea5131fbacbf969f04d9 MD5 | raw file
  1. <?php echo $header; ?>
  2. <div id="widecontent"><div class="shop wrapper" style="margin-top:10px;">
  3. <?php if ($attention) { ?>
  4. <div class="attention"><?php echo $attention; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
  5. <?php } ?>
  6. <?php if ($success) { ?>
  7. <div class="success"><?php echo $success; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
  8. <?php } ?>
  9. <?php if ($error_warning) { ?>
  10. <div class="warning"><?php echo $error_warning; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
  11. <?php } ?>
  12. <?php echo $column_left; ?><?php echo $column_right; ?>
  13. <?php echo $content_top; ?>
  14. <div class="content wrapper">
  15. <div class="breadcrumb">
  16. <?php foreach ($breadcrumbs as $breadcrumb) { ?>
  17. <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
  18. <?php } ?>
  19. </div>
  20. <h1><?php echo $heading_title; ?>
  21. </h1>
  22. <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
  23. <div class="cart-info">
  24. <table>
  25. <thead>
  26. <tr>
  27. <td class="image"><?php echo $column_image; ?></td>
  28. <td class="name"><?php echo $column_name; ?></td>
  29. <td class="model"><?php echo $column_model; ?></td>
  30. <td class="quantity"><?php echo $column_quantity; ?></td>
  31. <td class="price"><?php echo $column_price; ?></td>
  32. <td class="total"><?php echo $column_total; ?></td>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <?php foreach ($products as $product) { ?>
  37. <tr>
  38. <td class="image"><?php if ($product['thumb']) { ?>
  39. <a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" /></a>
  40. <?php } ?></td>
  41. <td class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
  42. <?php if (!$product['stock']) { ?>
  43. <span class="stock">***</span>
  44. <?php } ?>
  45. <div>
  46. <?php foreach ($product['option'] as $option) { ?>
  47. - <small><?php echo $option['name']; ?>: <?php echo $option['value']; ?></small><br />
  48. <?php } ?>
  49. </div>
  50. <?php if ($product['reward']) { ?>
  51. <small><?php echo $product['reward']; ?></small>
  52. <?php } ?></td>
  53. <td class="model"><?php echo $product['model']; ?></td>
  54. <td class="quantity"><input type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1" />
  55. &nbsp;
  56. <input type="image" src="catalog/view/theme/default/image/update.png" alt="<?php echo $button_update; ?>" title="<?php echo $button_update; ?>" />
  57. &nbsp;<a href="<?php echo $product['remove']; ?>"><img src="catalog/view/theme/default/image/remove.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" /></a></td>
  58. <td class="price"><?php echo $product['price']; ?></td>
  59. <td class="total"><?php echo $product['total']; ?></td>
  60. </tr>
  61. <?php } ?>
  62. <?php foreach ($vouchers as $vouchers) { ?>
  63. <tr>
  64. <td class="image"></td>
  65. <td class="name"><?php echo $vouchers['description']; ?></td>
  66. <td class="model"></td>
  67. <td class="quantity"><input type="text" name="" value="1" size="1" disabled="disabled" />
  68. &nbsp;<a href="<?php echo $vouchers['remove']; ?>"><img src="catalog/view/theme/default/image/remove.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" /></a></td>
  69. <td class="price"><?php echo $vouchers['amount']; ?></td>
  70. <td class="total"><?php echo $vouchers['amount']; ?></td>
  71. </tr>
  72. <?php } ?>
  73. </tbody>
  74. </table>
  75. </div>
  76. </form>
  77. <div class="cart-total">
  78. <table id="total">
  79. <?php foreach ($totals as $total) { ?>
  80. <tr>
  81. <td class="right"><b><?php echo $total['title']; ?>:</b></td>
  82. <td class="right"><?php echo $total['text']; ?></td>
  83. </tr>
  84. <?php } ?>
  85. </table>
  86. </div>
  87. <div class="buttons">
  88. <div class="right"><a href="<?php echo $checkout; ?>" class="button"><?php echo $button_checkout; ?></a></div>
  89. <div class="center"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_shopping; ?></a></div>
  90. </div>
  91. <?php echo $content_bottom; ?></div>
  92. <script type="text/javascript"><!--
  93. $('input[name=\'next\']').bind('change', function() {
  94. $('.cart-module > div').hide();
  95. $('#' + this.value).show();
  96. });
  97. //--></script>
  98. <?php if ($shipping_status) { ?>
  99. <script type="text/javascript"><!--
  100. $('#button-quote').live('click', function() {
  101. $.ajax({
  102. url: 'index.php?route=checkout/cart/quote',
  103. type: 'post',
  104. data: 'country_id=' + $('select[name=\'country_id\']').val() + '&zone_id=' + $('select[name=\'zone_id\']').val() + '&postcode=' + encodeURIComponent($('input[name=\'postcode\']').val()),
  105. dataType: 'json',
  106. beforeSend: function() {
  107. $('#button-quote').attr('disabled', true);
  108. $('#button-quote').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
  109. },
  110. complete: function() {
  111. $('#button-quote').attr('disabled', false);
  112. $('.wait').remove();
  113. },
  114. success: function(json) {
  115. $('.success, .warning, .attention, .error').remove();
  116. if (json['error']) {
  117. if (json['error']['warning']) {
  118. $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
  119. $('.warning').fadeIn('slow');
  120. $('html, body').animate({ scrollTop: 0 }, 'slow');
  121. }
  122. if (json['error']['country']) {
  123. $('select[name=\'country_id\']').after('<span class="error">' + json['error']['country'] + '</span>');
  124. }
  125. if (json['error']['zone']) {
  126. $('select[name=\'zone_id\']').after('<span class="error">' + json['error']['zone'] + '</span>');
  127. }
  128. if (json['error']['postcode']) {
  129. $('input[name=\'postcode\']').after('<span class="error">' + json['error']['postcode'] + '</span>');
  130. }
  131. }
  132. if (json['shipping_method']) {
  133. html = '<h2><?php echo $text_shipping_method; ?></h2>';
  134. html += '<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">';
  135. html += ' <table class="radio">';
  136. for (i in json['shipping_method']) {
  137. html += '<tr>';
  138. html += ' <td colspan="3"><b>' + json['shipping_method'][i]['title'] + '</b></td>';
  139. html += '</tr>';
  140. if (!json['shipping_method'][i]['error']) {
  141. for (j in json['shipping_method'][i]['quote']) {
  142. html += '<tr class="highlight">';
  143. if (json['shipping_method'][i]['quote'][j]['code'] == '<?php echo $shipping_method; ?>') {
  144. 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>';
  145. } else {
  146. 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>';
  147. }
  148. html += ' <td><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['title'] + '</label></td>';
  149. html += ' <td style="text-align: right;"><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['text'] + '</label></td>';
  150. html += '</tr>';
  151. }
  152. } else {
  153. html += '<tr>';
  154. html += ' <td colspan="3"><div class="error">' + json['shipping_method'][i]['error'] + '</div></td>';
  155. html += '</tr>';
  156. }
  157. }
  158. html += ' </table>';
  159. html += ' <br />';
  160. html += ' <input type="hidden" name="next" value="shipping" />';
  161. <?php if ($shipping_method) { ?>
  162. html += ' <input type="submit" value="<?php echo $button_shipping; ?>" id="button-shipping" class="button" />';
  163. <?php } else { ?>
  164. html += ' <input type="submit" value="<?php echo $button_shipping; ?>" id="button-shipping" class="button" disabled="disabled" />';
  165. <?php } ?>
  166. html += '</form>';
  167. $.colorbox({
  168. overlayClose: true,
  169. opacity: 0.5,
  170. width: '600px',
  171. height: '400px',
  172. href: false,
  173. html: html
  174. });
  175. $('input[name=\'shipping_method\']').bind('change', function() {
  176. $('#button-shipping').attr('disabled', false);
  177. });
  178. }
  179. }
  180. });
  181. });
  182. //--></script>
  183. <script type="text/javascript"><!--
  184. $('select[name=\'country_id\']').bind('change', function() {
  185. $.ajax({
  186. url: 'index.php?route=checkout/cart/country&country_id=' + this.value,
  187. dataType: 'json',
  188. beforeSend: function() {
  189. $('select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
  190. },
  191. complete: function() {
  192. $('.wait').remove();
  193. },
  194. success: function(json) {
  195. if (json['postcode_required'] == '1') {
  196. $('#postcode-required').show();
  197. } else {
  198. $('#postcode-required').hide();
  199. }
  200. html = '<option value=""><?php echo $text_select; ?></option>';
  201. if (json['zone'] != '') {
  202. for (i = 0; i < json['zone'].length; i++) {
  203. html += '<option value="' + json['zone'][i]['zone_id'] + '"';
  204. if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
  205. html += ' selected="selected"';
  206. }
  207. html += '>' + json['zone'][i]['name'] + '</option>';
  208. }
  209. } else {
  210. html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
  211. }
  212. $('select[name=\'zone_id\']').html(html);
  213. },
  214. error: function(xhr, ajaxOptions, thrownError) {
  215. alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
  216. }
  217. });
  218. });
  219. $('select[name=\'country_id\']').trigger('change');
  220. //--></script>
  221. <?php } ?>
  222. </div></div>
  223. <?php echo $footer; ?>