PageRenderTime 49ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/wp-e-commerce/themes/default/shopping_cart_page.php

https://gitlab.com/endomorphosis/reservationtelco
PHP | 387 lines | 341 code | 41 blank | 5 comment | 59 complexity | c34416765c8caa44df0a77a6173d0aa4 MD5 | raw file
  1. <?php
  2. global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons;
  3. $wpsc_checkout = new wpsc_checkout();
  4. $wpsc_gateway = new wpsc_gateways();
  5. $wpsc_coupons = new wpsc_coupons($_SESSION['coupon_numbers']);
  6. //echo "<pre>".print_r($wpsc_cart, true)."</pre>";
  7. // //echo "<pre>".print_r($wpsc_checkout, true)."</pre>";
  8. if(wpsc_cart_item_count() > 0) :
  9. ?>
  10. <p><?php echo __('Please review your order', 'wpsc'); ?></p>
  11. <table class="productcart">
  12. <tr class="firstrow">
  13. <td class='firstcol'></td>
  14. <td><?php echo __('Product', 'wpsc'); ?>:</td>
  15. <td><?php echo __('Quantity', 'wpsc'); ?>:</td>
  16. <?php if(wpsc_uses_shipping()): ?>
  17. <td><?php echo __('Shipping', 'wpsc'); ?>:</td>
  18. <?php endif; ?>
  19. <td><?php echo __('Price', 'wpsc'); ?>:</td>
  20. <td></td>
  21. </tr>
  22. <?php while (wpsc_have_cart_items()) : wpsc_the_cart_item(); ?>
  23. <?php //this displays the confirm your order html ?>
  24. <tr class="product_row">
  25. <td class="firstcol"><img src='<?php echo wpsc_cart_item_image(48,48); ?>' alt='<?php echo wpsc_cart_item_name(); ?>' title='<?php echo wpsc_cart_item_name(); ?>' /></td>
  26. <td class="firstcol">
  27. <a href='<?php echo wpsc_cart_item_url();?>'><?php echo wpsc_cart_item_name(); ?></a>
  28. </td>
  29. <td>
  30. <form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
  31. <input type="text" name="quantity" size="2" value="<?php echo wpsc_cart_item_quantity(); ?>" />
  32. <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
  33. <input type="hidden" name="wpsc_update_quantity" value="true" />
  34. <input type="submit" value="<?php echo __('Update', 'wpsc'); ?>" name="submit" />
  35. </form>
  36. </td>
  37. <?php if(wpsc_uses_shipping()): ?>
  38. <td><span class="pricedisplay" id='shipping_<?php echo wpsc_the_cart_item_key(); ?>'><?php echo wpsc_cart_item_shipping(); ?></span></td>
  39. <?php endif; ?>
  40. <td><span class="pricedisplay"><?php echo wpsc_cart_item_price(); ?></span></td>
  41. <td>
  42. <form action="<?php echo get_option('shopping_cart_url'); ?>" method="post" class="adjustform">
  43. <input type="hidden" name="quantity" value="0" />
  44. <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>" />
  45. <input type="hidden" name="wpsc_update_quantity" value="true" />
  46. <button class='remove_button' type="submit"><span><?php echo __('Remove', 'wpsc'); ?></span></button>
  47. </form>
  48. </td>
  49. </tr>
  50. <?php endwhile; ?>
  51. <?php //this HTML displays coupons if there are any active coupons to use ?>
  52. <?php if(wpsc_uses_coupons()): ?>
  53. <?php if(wpsc_coupons_error()): ?>
  54. <tr><td><?php echo __('Coupon is not valid.', 'wpsc'); ?></td></tr>
  55. <?php endif; ?>
  56. <tr>
  57. <td colspan="2"><?php _e('Enter your coupon number'); ?> :</td>
  58. <td colspan="3" align='left'>
  59. <form method='post' action="<?php echo get_option('shopping_cart_url'); ?>">
  60. <input type='text' name='coupon_num' id='coupon_num' value='<?php echo $wpsc_cart->coupons_name; ?>' />
  61. <input type='submit' value='<?php echo __('Update', 'wpsc') ?>' />
  62. </form>
  63. </td>
  64. </tr>
  65. <?php endif; ?>
  66. </table>
  67. <?php //this HTML dispalys the calculate your order HTML ?>
  68. <?php if(isset($_SESSION['nocamsg']) && isset($_GET['noca']) && $_GET['noca'] == 'confirm'): ?>
  69. <p class='validation-error'><?php echo $_SESSION['nocamsg']; ?></p>
  70. <?php endif; ?>
  71. <?php if($_SESSION['categoryAndShippingCountryConflict'] != '') : ?>
  72. <p class='validation-error'><?php echo $_SESSION['categoryAndShippingCountryConflict']; ?></p>
  73. <?php
  74. $_SESSION['categoryAndShippingCountryConflict'] = '';
  75. endif;
  76. if($_SESSION['WpscGatewayErrorMessage'] != '') :
  77. ?>
  78. <p class='validation-error'><?php echo $_SESSION['WpscGatewayErrorMessage']; ?></p>
  79. <?php
  80. endif;
  81. ?>
  82. <?php do_action('wpsc_before_shipping_of_shopping_cart'); ?>
  83. <div id='wpsc_shopping_cart_container'>
  84. <?php if(wpsc_uses_shipping()) : ?>
  85. <h2><?php echo __('Calculate Shipping Price', 'wpsc'); ?></h2>
  86. <table class="productcart">
  87. <tr>
  88. <td colspan='5'>
  89. <?php echo __('Please choose a country below to calculate your shipping costs', 'wpsc'); ?>
  90. </td>
  91. </tr>
  92. <?php if (!wpsc_have_shipping_quote()) : // No valid shipping quotes ?>
  93. <?php if (($_SESSION['wpsc_zipcode'] == '') || ($_SESSION['wpsc_zipcode'] == 'Your Zipcode')) : // No valid shipping quotes ?>
  94. <?php if ($_SESSION['wpsc_update_location'] == true) :?>
  95. <tr>
  96. <td colspan='5' class='shipping_error' >
  97. <?php echo __('Please provide a Zipcode and click Calculate in order to continue.', 'wpsc'); ?>
  98. </td>
  99. </tr>
  100. <?php endif; ?>
  101. <?php else: ?>
  102. <tr>
  103. <td colspan='5' class='shipping_error' >
  104. <?php echo __('Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details.', 'wpsc'); ?>
  105. </td>
  106. </tr>
  107. <?php endif; ?>
  108. <?php endif; ?>
  109. <tr>
  110. <td colspan='5'>
  111. <form name='change_country' id='change_country' action='' method='post'>
  112. <?php echo wpsc_shipping_country_list();?>
  113. <input type='hidden' name='wpsc_update_location' value='true' />
  114. <input type='submit' name='wpsc_submit_zipcode' value='Calculate' />
  115. </form>
  116. </td>
  117. </tr>
  118. <?php if (wpsc_have_morethanone_shipping_quote()) :?>
  119. <?php while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method(); ?>
  120. <?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
  121. <tr><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__('- Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
  122. <?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
  123. <tr>
  124. <td colspan='3'>
  125. <label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_name(); ?></label>
  126. </td>
  127. <td style='text-align:center;'>
  128. <label for='<?php echo wpsc_shipping_quote_html_id(); ?>'><?php echo wpsc_shipping_quote_value(); ?></label>
  129. </td>
  130. <td style='text-align:center;'>
  131. <?php if(wpsc_have_morethanone_shipping_methods_and_quotes()): ?>
  132. <input type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' <?php echo wpsc_shipping_quote_selected_state(); ?> onclick='switchmethod("<?php echo wpsc_shipping_quote_name(); ?>", "<?php echo wpsc_shipping_method_internal_name(); ?>")' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
  133. <?php else: ?>
  134. <input <?php echo wpsc_shipping_quote_selected_state(); ?> disabled='disabled' type='radio' id='<?php echo wpsc_shipping_quote_html_id(); ?>' value='<?php echo wpsc_shipping_quote_value(true); ?>' name='shipping_method' />
  135. <?php wpsc_update_shipping_single_method(); ?>
  136. <?php endif; ?>
  137. </td>
  138. </tr>
  139. <?php endwhile; ?>
  140. <?php endwhile; ?>
  141. <?php endif; ?>
  142. <?php wpsc_update_shipping_multiple_methods(); ?>
  143. <?php if (!wpsc_have_shipping_quote()) : // No valid shipping quotes ?>
  144. </table>
  145. </div>
  146. <?php return; ?>
  147. <?php endif; ?>
  148. </table>
  149. <?php endif; ?>
  150. <table class="productcart">
  151. <?php if(wpsc_cart_tax(false) > 0) : ?>
  152. <tr class="total_price total_tax">
  153. <td colspan="3">
  154. <?php echo wpsc_display_tax_label(true); ?>
  155. </td>
  156. <td colspan="2">
  157. <span id="checkout_tax" class="pricedisplay checkout-tax"><?php echo wpsc_cart_tax(); ?></span>
  158. </td>
  159. </tr>
  160. <?php endif; ?>
  161. <?php if(wpsc_uses_shipping()) : ?>
  162. <tr class="total_price total_shipping">
  163. <td colspan="3">
  164. <?php echo __('Total Shipping', 'wpsc'); ?>
  165. </td>
  166. <td colspan="2">
  167. <span id="checkout_shipping" class="pricedisplay checkout-shipping"><?php echo wpsc_cart_shipping(); ?></span>
  168. </td>
  169. </tr>
  170. <?php endif; ?>
  171. <?php if(wpsc_uses_coupons() && (wpsc_coupon_amount(false) > 0)): ?>
  172. <tr class="total_price">
  173. <td colspan="3">
  174. <?php echo __('Discount', 'wpsc'); ?>
  175. </td>
  176. <td colspan="2">
  177. <span id="coupons_amount" class="pricedisplay"><?php echo wpsc_coupon_amount(); ?></span>
  178. </td>
  179. </tr>
  180. <?php endif ?>
  181. <tr class='total_price'>
  182. <td colspan='3'>
  183. <?php echo __('Total Price', 'wpsc'); ?>
  184. </td>
  185. <td colspan='2'>
  186. <span id='checkout_total' class="pricedisplay checkout-total"><?php echo wpsc_cart_total(); ?></span>
  187. </td>
  188. </tr>
  189. </table>
  190. <?php do_action('wpsc_before_form_of_shopping_cart'); ?>
  191. <form name='wpsc_checkout_forms' class='wpsc_checkout_forms' action='' method='post' enctype="multipart/form-data">
  192. <?php
  193. /**
  194. * Both the registration forms and the checkout details forms must be in the same form element as they are submitted together, you cannot have two form elements submit together without the use of JavaScript.
  195. */
  196. ?>
  197. <?php if(!is_user_logged_in() && get_option('users_can_register') && get_option('require_register')) :
  198. global $current_user;
  199. get_currentuserinfo(); ?>
  200. <h2><?php _e('Not yet a member?');?></h2>
  201. <p><?php _e('In order to buy from us, you\'ll need an account. Joining is free and easy. All you need is a username, password and valid email address.');?></p>
  202. <?php if(count($_SESSION['wpsc_checkout_user_error_messages']) > 0) : ?>
  203. <div class="login_error">
  204. <?php
  205. foreach($_SESSION['wpsc_checkout_user_error_messages'] as $user_error ) {
  206. echo $user_error."<br />\n";
  207. }
  208. $_SESSION['wpsc_checkout_user_error_messages'] = array();
  209. ?>
  210. </div>
  211. <?php endif; ?>
  212. <fieldset class='wpsc_registration_form'>
  213. <label><?php _e('Username'); ?>:</label><input type="text" name="log" id="log" value="" size="20"/>
  214. <label><?php _e('Password'); ?>:</label><input type="password" name="pwd" id="pwd" value="" size="20" />
  215. <label><?php _e('E-mail'); ?>:</label><input type="text" name="user_email" id="user_email" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" />
  216. </fieldset>
  217. <?php endif; ?>
  218. <h2><?php echo __('Please enter your contact details:', 'wpsc'); ?></h2>
  219. <?php/* echo __('Note, Once you press submit, you will need to have your Credit card handy.', 'wpsc'); <br /> */?>
  220. <?php echo __('Fields marked with an asterisk must be filled in.', 'wpsc'); ?>
  221. <?php
  222. if(count($_SESSION['wpsc_checkout_misc_error_messages']) > 0) {
  223. echo "<div class='login_error'>\n\r";
  224. foreach((array)$_SESSION['wpsc_checkout_misc_error_messages'] as $user_error ) {
  225. echo $user_error."<br />\n";
  226. }
  227. echo "</div>\n\r";
  228. }
  229. $_SESSION['wpsc_checkout_misc_error_messages'] =array();
  230. ?>
  231. <table class='wpsc_checkout_table'>
  232. <?php while (wpsc_have_checkout_items()) : wpsc_the_checkout_item(); ?>
  233. <?php if(wpsc_is_shipping_details()) : ?>
  234. <tr>
  235. <td colspan ='2'>
  236. <br />
  237. <input type='checkbox' value='true' name='shippingSameBilling' id='shippingSameBilling' />
  238. <label for='shippingSameBilling'>Shipping Address same as Billing Address?</label>
  239. </td>
  240. </tr>
  241. <?php endif; ?>
  242. <?php if(wpsc_checkout_form_is_header() == true) : ?>
  243. <tr <?php echo wpsc_the_checkout_item_error_class();?>>
  244. <td <?php if(wpsc_is_shipping_details()) echo "class='wpsc_shipping_forms'"; ?> colspan='2'>
  245. <h4>
  246. <?php echo wpsc_checkout_form_name();?>
  247. </h4>
  248. </td>
  249. </tr>
  250. <?php else: ?>
  251. <?php if((!wpsc_uses_shipping()) && $wpsc_checkout->checkout_item->unique_name == 'shippingstate'): ?>
  252. <?php else : ?>
  253. <tr <?php echo wpsc_the_checkout_item_error_class();?>>
  254. <td>
  255. <label for='<?php echo wpsc_checkout_form_element_id(); ?>'>
  256. <?php echo wpsc_checkout_form_name();?>
  257. </label>
  258. </td>
  259. <td>
  260. <?php echo wpsc_checkout_form_field();?>
  261. <?php if(wpsc_the_checkout_item_error() != ''): ?>
  262. <p class='validation-error'><?php echo wpsc_the_checkout_item_error(); ?></p>
  263. <?php endif; ?>
  264. </td>
  265. </tr>
  266. <?php endif; ?>
  267. <?php endif; ?>
  268. <?php endwhile; ?>
  269. <?php if (get_option('display_find_us') == '1') : ?>
  270. <tr>
  271. <td>How did you find us:</td>
  272. <td>
  273. <select name='how_find_us'>
  274. <option value='Word of Mouth'>Word of mouth</option>
  275. <option value='Advertisement'>Advertising</option>
  276. <option value='Internet'>Internet</option>
  277. <option value='Customer'>Existing Customer</option>
  278. </select>
  279. </td>
  280. </tr>
  281. <?php endif; ?>
  282. <tr>
  283. <td colspan='2' class='wpsc_gateway_container'>
  284. <?php //this HTML displays activated payment gateways?>
  285. <?php if(wpsc_gateway_count() > 1): // if we have more than one gateway enabled, offer the user a choice ?>
  286. <h3><?php echo __('Select a payment gateway', 'wpsc');?></h3>
  287. <?php while (wpsc_have_gateways()) : wpsc_the_gateway(); ?>
  288. <div class="custom_gateway">
  289. <?php if(wpsc_gateway_internal_name() == 'noca'){ ?>
  290. <label><input type="radio" id='noca_gateway' value="<?php echo wpsc_gateway_internal_name();?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name();?></label>
  291. <?php }else{ ?>
  292. <label><input type="radio" value="<?php echo wpsc_gateway_internal_name();?>" <?php echo wpsc_gateway_is_checked(); ?> name="custom_gateway" class="custom_gateway"/><?php echo wpsc_gateway_name();?></label>
  293. <?php } ?>
  294. <?php if(wpsc_gateway_form_fields()): ?>
  295. <table class='<?php echo wpsc_gateway_form_field_style();?>'>
  296. <?php echo wpsc_gateway_form_fields();?>
  297. </table>
  298. <?php endif; ?>
  299. </div>
  300. <?php endwhile; ?>
  301. <?php else: // otherwise, there is no choice, stick in a hidden form ?>
  302. <?php while (wpsc_have_gateways()) : wpsc_the_gateway(); ?>
  303. <input name='custom_gateway' value='<?php echo wpsc_gateway_internal_name();?>' type='hidden' />
  304. <?php if(wpsc_gateway_form_fields()): ?>
  305. <table>
  306. <?php echo wpsc_gateway_form_fields();?>
  307. </table>
  308. <?php endif; ?>
  309. <?php endwhile; ?>
  310. <?php endif; ?>
  311. </td>
  312. </tr>
  313. <?php if(get_option('terms_and_conditions') != '') : ?>
  314. <tr>
  315. <td colspan='2'>
  316. <input type='checkbox' value='yes' name='agree' /> <?php echo __('I agree to The ', 'wpsc');?><a class='thickbox' target='_blank' href='<?php
  317. echo get_option('siteurl')."?termsandconds=true&amp;width=360&amp;height=400'"; ?>' class='termsandconds'><?php echo __('Terms and Conditions', 'wpsc');?></a>
  318. </td>
  319. </tr>
  320. <?php endif; ?>
  321. <tr>
  322. <td colspan='2'>
  323. <?php if(get_option('terms_and_conditions') == '') : ?>
  324. <input type='hidden' value='yes' name='agree' />
  325. <?php endif; ?>
  326. <?php //exit('<pre>'.print_r($wpsc_gateway->wpsc_gateways[0]['name'], true).'</pre>');
  327. if(count($wpsc_gateway->wpsc_gateways) == 1 && $wpsc_gateway->wpsc_gateways[0]['name'] == 'Noca'){}else{?>
  328. <input type='hidden' value='submit_checkout' name='wpsc_action' />
  329. <input type='submit' value='<?php echo __('Make Purchase', 'wpsc');?>' name='submit' class='make_purchase' />
  330. <?php }/* else: ?>
  331. <br /><strong><?php echo __('Please login or signup above to make your purchase', 'wpsc');?></strong><br />
  332. <?php echo __('If you have just registered, please check your email and login before you make your purchase', 'wpsc');?>
  333. </td>
  334. <?php endif; */?>
  335. </td>
  336. </tr>
  337. </table>
  338. </form>
  339. </div>
  340. <?php
  341. else:
  342. echo __('Oops, there is nothing in your cart.', 'wpsc') . "<a href=".get_option("product_list_url").">" . __('Please visit our shop', 'wpsc') . "</a>";
  343. endif;
  344. do_action('wpsc_bottom_of_shopping_cart');
  345. ?>