function jigoshop_order_tracking( $atts ) { extract(shortcode_atts(array( ), $atts)); global $post; if ($_POST) : $order = &new jigoshop_order(); if (isset($_POST['orderid']) && $_POST['orderid'] > 0) $order->id = (int) $_POST['orderid']; else $order->id = 0; if (isset($_POST['order_email']) && $_POST['order_email']) $order_email = trim($_POST['order_email']); else $order_email = ''; if ( !jigoshop::verify_nonce('order_tracking') ): echo '<p>'.__('You have taken too long. Please refresh the page and retry.', 'jigoshop').'</p>'; elseif ($order->id && $order_email && $order->get_order( $order->id )) : if ($order->billing_email == $order_email) : echo '<p>'.sprintf( __('Order #%s which was made %s has the status “%s”', 'jigoshop'), $order->id, human_time_diff(strtotime($order->order_date), current_time('timestamp')).__(' ago', 'jigoshop'), $order->status ); if ($order->status == 'completed') echo __(' and was completed ', 'jigoshop').human_time_diff(strtotime($order->completed_date), current_time('timestamp')).__(' ago', 'jigoshop'); echo '.</p>'; ?> <h2><?php _e('Order Details', 'jigoshop'); ?></h2> <table class="shop_table"> <thead> <tr> <th><?php _e('Title', 'jigoshop'); ?></th> <th><?php _e('SKU', 'jigoshop'); ?></th> <th><?php _e('Price', 'jigoshop'); ?></th> <th><?php _e('Quantity', 'jigoshop'); ?></th> </tr> </thead> <tfoot> <tr> <td colspan="3"><?php _e('Subtotal', 'jigoshop'); ?></td> <td><?php echo $order->get_subtotal_to_display(); ?></td> </tr> <?php if ($order->order_shipping>0) : ?><tr> <td colspan="3"><?php _e('Shipping', 'jigoshop'); ?></td> <td><?php echo $order->get_shipping_to_display(); ?></small></td> </tr><?php endif; ?> <?php if ($order->get_total_tax()>0) : ?><tr> <td colspan="3"><?php _e('Tax', 'jigoshop'); ?></td> <td><?php echo jigoshop_price($order->get_total_tax()); ?></td> </tr><?php endif; ?> <?php if ($order->order_discount>0) : ?><tr class="discount"> <td colspan="3"><?php _e('Discount', 'jigoshop'); ?></td> <td>-<?php echo jigoshop_price($order->order_discount); ?></td> </tr><?php endif; ?> <tr> <td colspan="3"><strong><?php _e('Grand Total', 'jigoshop'); ?></strong></td> <td><strong><?php echo jigoshop_price($order->order_total); ?></strong></td> </tr> </tfoot> <tbody> <?php foreach($order->items as $order_item) : $_product = &new jigoshop_product( $order_item['id'] ); echo '<tr>'; echo '<td>'.$_product->get_title().'</td>'; echo '<td>'.$_product->sku.'</td>'; echo '<td>'.jigoshop_price($_product->get_price()).'</td>'; echo '<td>'.$order_item['qty'].'</td>'; echo '</tr>'; endforeach; ?> </tbody> </table> <div style="width: 49%; float:left;"> <h2><?php _e('Billing Address', 'jigoshop'); ?></h2> <p><?php $address = $order->billing_first_name.' '.$order->billing_last_name.'<br/>'; if ($order->billing_company) $address .= $order->billing_company.'<br/>'; $address .= $order->formatted_billing_address; echo $address; ?></p> </div> <div style="width: 49%; float:right;"> <h2><?php _e('Shipping Address', 'jigoshop'); ?></h2> <p><?php $address = $order->shipping_first_name.' '.$order->shipping_last_name.'<br/>'; if ($order->shipping_company) $address .= $order->shipping_company.'<br/>'; $address .= $order->formatted_shipping_address; echo $address; ?></p> </div> <div class="clear"></div> <?php else : echo '<p>'.__('Sorry, we could not find that order id in our database. <a href="'.get_permalink($post->ID).'">Want to retry?</a>', 'jigoshop').'</p>'; endif; else : echo '<p>'.__('Sorry, we could not find that order id in our database. <a href="'.get_permalink($post->ID).'">Want to retry?</a>', 'jigoshop').'</p>'; endif; else : ?> <form action="<?php echo get_permalink($post->ID); ?>" method="post" class="track_order"> <p><?php _e('To track your order please enter your Order ID in the box below and press return. This was given to you on your receipt and in the confirmation email you should have received.', 'jigoshop'); ?></p> <p class="form-row form-row-first"><label for="orderid"><?php _e('Order ID', 'jigoshop'); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" placeholder="<?php _e('Found in your order confirmation email.', 'jigoshop'); ?>" /></p> <p class="form-row form-row-last"><label for="order_email"><?php _e('Billing Email', 'jigoshop'); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" placeholder="<?php _e('Email you used during checkout.', 'jigoshop'); ?>" /></p> <div class="clear"></div> <p class="form-row"><input type="submit" class="button" name="track" value="<?php _e('Track"', 'jigoshop'); ?>" /></p> <?php jigoshop::nonce_field('order_tracking') ?> </form> <?php endif; }
if ( !jigoshop_customer::get_country() ) : echo '<p>'.__('Please fill in your details above to see available payment methods.', 'jigoshop').'</p>'; else : echo '<p>'.__('Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'</p>'; endif; endif; ?> </ul> <?php endif; ?> <div class="form-row"> <noscript><?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'jigoshop'); ?><br/><input type="submit" class="button-alt" name="update_totals" value="<?php _e('Update totals', 'jigoshop'); ?>" /></noscript> <?php jigoshop::nonce_field('process_checkout')?> <input type="submit" class="button-alt" name="place_order" id="place_order" value="<?php _e('Place order', 'jigoshop'); ?>" /> <?php do_action( 'jigoshop_review_order_before_submit' ); ?> <?php if (get_option('jigoshop_terms_page_id')>0) : ?> <p class="form-row terms"> <label for="terms" class="checkbox"><?php _e('I accept the', 'jigoshop'); ?> <a href="<?php echo get_permalink(get_option('jigoshop_terms_page_id')); ?>" target="_blank"><?php _e('terms & conditions', 'jigoshop'); ?></a></label> <input type="checkbox" class="input-checkbox" name="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> id="terms" /> </p> <?php endif; ?> <?php do_action( 'jigoshop_review_order_after_submit' ); ?> </div>
function jigoshop_login_form() { if (is_user_logged_in()) { return; } ?> <form method="post" class="login"> <p class="form-row form-row-first"> <label for="username"><?php _e('Username', 'jigoshop'); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="username" id="username" /> </p> <p class="form-row form-row-last"> <label for="password"><?php _e('Password', 'jigoshop'); ?> <span class="required">*</span></label> <input class="input-text" type="password" name="password" id="password" /> </p> <div class="clear"></div> <p class="form-row"> <?php jigoshop::nonce_field('login', 'login'); ?> <input type="submit" class="button" name="login" value="<?php _e('Login', 'jigoshop'); ?> " /> <a class="lost_password" href="<?php echo home_url('wp-login.php?action=lostpassword'); ?> "><?php _e('Lost Password?', 'jigoshop'); ?> </a> </p> </form> <?php }
<li> <input type="radio" id="payment_method_<?php echo $gateway->id; ?>" class="input-radio" name="payment_method" value="<?php echo $gateway->id; ?>" <?php if ($gateway->chosen) echo 'checked="checked"'; ?> /> <label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->title; ?> <?php echo $gateway->icon(); ?></label> <?php if ($gateway->has_fields || $gateway->description) : echo '<div class="payment_box payment_method_'.$gateway->id.'" style="display:none;">'; $gateway->payment_fields(); echo '</div>'; endif; ?> </li> <?php endforeach; else : echo '<p>'.__('Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'</p>'; endif; ?> </ul> <?php endif; ?> <div class="form-row"> <?php jigoshop::nonce_field('pay')?> <input type="submit" class="button-alt" name="pay" id="place_order" value="<?php _e('Pay for order', 'jigoshop'); ?>" /> </div> </div> </form>
echo '<div class="payment_box payment_method_' . esc_attr($gateway->id) . '" style="display:none;">'; $gateway->payment_fields(); echo '</div>'; } ?> </li> <?php } } else { echo '<p>' . __('Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop') . '</p>'; } ?> </ul> <?php } ?> <div class="form-row"> <?php jigoshop::nonce_field('pay'); ?> <input type="submit" class="button-alt" name="pay" id="place_order" value="<?php _e('Pay for order', 'jigoshop'); ?> " /> </div> </div> </form>
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . '<span class="required">*</span>' . '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" aria-required="true" /></p>', ), 'label_submit' => __('Submit Review', 'jigoshop'), 'logged_in_as' => '', 'comment_field' => ' <p class="comment-form-rating"><label for="rating">' . __('Rating', 'jigoshop') .'</label><select name="rating" id="rating"> <option value="">'.__('Rate...','jigoshop').'</option> <option value="5">'.__('Perfect','jigoshop').'</option> <option value="4">'.__('Good','jigoshop').'</option> <option value="3">'.__('Average','jigoshop').'</option> <option value="2">'.__('Not that bad','jigoshop').'</option> <option value="1">'.__('Very Poor','jigoshop').'</option> </select></p> <p class="comment-form-comment"><label for="comment">' . _x( 'Your Review', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>' . jigoshop::nonce_field('comment_rating', true, false) )); echo '</div></div>'; ?><div class="clear"></div></div> <script type="text/javascript"> /* <![CDATA[ */ jQuery(function(){ jQuery('#review_form_wrapper').hide(); jQuery('a.show_review_form').fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : true
?> <form action="<?php echo esc_url(apply_filters('jigoshop_get_change_password_page_id', get_permalink(jigoshop_get_page_id('change_password')))); ?> " method="post"> <p class="form-row form-row-first"> <label for="password-1"><?php _e('New password', 'jigoshop'); ?> <span class="required">*</span></label> <input type="password" class="input-text" name="password-1" id="password-1" /> </p> <p class="form-row form-row-last"> <label for="password-2"><?php _e('Re-enter new password', 'jigoshop'); ?> <span class="required">*</span></label> <input type="password" class="input-text" name="password-2" id="password-2" /> </p> <div class="clear"></div> <?php jigoshop::nonce_field('change_password'); ?> <p><input type="submit" class="button" name="save_password" value="<?php _e('Save', 'jigoshop'); ?> " /></p> </form>
</div> <div class="nav-next"><?php next_comments_link(__('Next <span class="meta-nav">→</span>', 'jigoshop')); ?> </div> </div> <?php } echo '<p class="add_review"><a href="#review_form" class="inline show_review_form button">' . __('Add Review', 'jigoshop') . '</a></p>'; $title_reply = __('Add a review', 'jigoshop'); } else { $title_reply = __('Be the first to review ', 'jigoshop') . '“' . $post->post_title . '”'; echo '<p>' . __('There are no reviews yet, would you like to <a href="#review_form" class="inline show_review_form">submit yours</a>?', 'jigoshop') . '</p>'; } $commenter = wp_get_current_commenter(); echo '</div><div id="review_form_wrapper"><div id="review_form">'; comment_form(array('title_reply' => $title_reply, 'comment_notes_before' => '', 'comment_notes_after' => '', 'fields' => array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name') . '</label> ' . '<span class="required">*</span>' . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" aria-required="true" /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email') . '</label> ' . '<span class="required">*</span>' . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" aria-required="true" /></p>'), 'label_submit' => __('Submit Review', 'jigoshop'), 'logged_in_as' => '', 'comment_field' => ' <p class="comment-form-rating"><label for="rating">' . __('Rating', 'jigoshop') . '</label><select name="rating" id="rating"> <option value="">' . __('Rate...', 'jigoshop') . '</option> <option value="5">' . __('Perfect', 'jigoshop') . '</option> <option value="4">' . __('Good', 'jigoshop') . '</option> <option value="3">' . __('Average', 'jigoshop') . '</option> <option value="2">' . __('Not that bad', 'jigoshop') . '</option> <option value="1">' . __('Very Poor', 'jigoshop') . '</option> </select></p> <p class="comment-form-comment"><label for="comment">' . _x('Your Review', 'noun', 'jigoshop') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>' . jigoshop::nonce_field('comment_rating', true, false))); echo '</div></div>'; ?> <div class="clear"></div></div> <?php }
_e('Shipping Address', 'jigoshop'); ?> <?php } ?> </h3> <?php foreach ($address as $field) { ?> <?php jigoshop_customer::address_form_field($field); ?> <?php } ?> <?php jigoshop::nonce_field('edit_address'); ?> <input type="submit" class="button" name="save_address" value="<?php _e('Save Address', 'jigoshop'); ?> " /> <a class="button-alt" href="<?php echo $account_url; ?> "><?php _e('Go back to My Account', 'jigoshop'); ?> </a> </form>
function jigoshop_change_password() { $user_id = get_current_user_id(); if (is_user_logged_in()) : if ($_POST) : if ($user_id>0 && jigoshop::verify_nonce('change_password')) : if ( $_POST['password-1'] && $_POST['password-2'] ) : if ( $_POST['password-1']==$_POST['password-2'] ) : wp_update_user( array ('ID' => $user_id, 'user_pass' => $_POST['password-1']) ) ; wp_safe_redirect( get_permalink(get_option('jigoshop_myaccount_page_id')) ); exit; else : jigoshop::add_error( __('Passwords do not match.','jigoshop') ); endif; else : jigoshop::add_error( __('Please enter your password.','jigoshop') ); endif; endif; endif; jigoshop::show_messages(); ?> <form action="<?php echo get_permalink(get_option('jigoshop_change_password_page_id')); ?>" method="post"> <p class="form-row form-row-first"> <label for="password-1"><?php _e('New password', 'jigoshop'); ?> <span class="required">*</span></label> <input type="password" class="input-text" name="password-1" id="password-1" /> </p> <p class="form-row form-row-last"> <label for="password-2"><?php _e('Re-enter new password', 'jigoshop'); ?> <span class="required">*</span></label> <input type="password" class="input-text" name="password-2" id="password-2" /> </p> <div class="clear"></div> <?php jigoshop::nonce_field('change_password')?> <p><input type="submit" class="button" name="save_password" value="<?php _e('Save', 'jigoshop'); ?>" /></p> </form> <?php else : wp_safe_redirect( get_permalink(get_option('jigoshop_myaccount_page_id')) ); exit; endif; }
function jigoshop_cart( $atts ) { $errors = array(); // Process Discount Codes if (isset($_POST['apply_coupon']) && $_POST['apply_coupon'] && jigoshop::verify_nonce('cart')) : $coupon_code = stripslashes(trim($_POST['coupon_code'])); jigoshop_cart::add_discount($coupon_code); // Remove from cart elseif ( isset($_GET['remove_item']) && $_GET['remove_item'] > 0 && jigoshop::verify_nonce('cart', '_GET')) : jigoshop_cart::set_quantity( $_GET['remove_item'], 0 ); jigoshop::add_message( __('Cart updated.', 'jigoshop') ); // Update Cart elseif (isset($_POST['update_cart']) && $_POST['update_cart'] && jigoshop::verify_nonce('cart')) : $cart_totals = $_POST['cart']; if (sizeof(jigoshop_cart::$cart_contents)>0) : foreach (jigoshop_cart::$cart_contents as $item_id => $values) : if (isset($cart_totals[$item_id]['qty'])) jigoshop_cart::set_quantity( $item_id, $cart_totals[$item_id]['qty'] ); endforeach; endif; jigoshop::add_message( __('Cart updated.', 'jigoshop') ); // Update Shipping elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && jigoshop::verify_nonce('cart')) : unset($_SESSION['_chosen_method_id']); $country = $_POST['calc_shipping_country']; $state = $_POST['calc_shipping_state']; $postcode = $_POST['calc_shipping_postcode']; if ($postcode && !jigoshop_validation::is_postcode( $postcode, $country )) : jigoshop::add_error( __('Please enter a valid postcode/ZIP.','jigoshop') ); $postcode = ''; elseif ($postcode) : $postcode = jigoshop_validation::format_postcode( $postcode, $country ); endif; if ($country) : // Update customer location jigoshop_customer::set_location( $country, $state, $postcode ); jigoshop_customer::set_shipping_location( $country, $state, $postcode ); // Re-calc price jigoshop_cart::calculate_totals(); jigoshop::add_message( __('Shipping costs updated.', 'jigoshop') ); else : jigoshop_customer::set_shipping_location( '', '', '' ); jigoshop::add_message( __('Shipping costs updated.', 'jigoshop') ); endif; endif; $result = jigoshop_cart::check_cart_item_stock(); if (is_wp_error($result)) : jigoshop::add_error( $result->get_error_message() ); endif; jigoshop::show_messages(); if (sizeof(jigoshop_cart::$cart_contents)==0) : echo '<p>'.__('Your cart is empty.', 'jigoshop').'</p>'; return; endif; ?> <form action="<?php echo jigoshop_cart::get_cart_url(); ?>" method="post"> <table class="shop_table cart" cellspacing="0"> <thead> <tr> <th class="product-remove"></th> <th class="product-thumbnail"></th> <th class="product-name"><span class="nobr"><?php _e('Product Name', 'jigoshop'); ?></span></th> <th class="product-price"><span class="nobr"><?php _e('Unit Price', 'jigoshop'); ?></span></th> <th class="product-quantity"><?php _e('Quantity', 'jigoshop'); ?></th> <th class="product-subtotal"><?php _e('Price', 'jigoshop'); ?></th> </tr> </thead> <tbody> <?php if (sizeof(jigoshop_cart::$cart_contents)>0) : foreach (jigoshop_cart::$cart_contents as $item_id => $values) : $_product = $values['data']; if ($_product->exists() && $values['quantity']>0) : echo ' <tr> <td class="product-remove"><a href="'.jigoshop_cart::get_remove_url($item_id).'" class="remove" title="Remove this item">×</a></td> <td class="product-thumbnail"><a href="'.get_permalink($item_id).'">'; if (has_post_thumbnail($item_id)) echo get_the_post_thumbnail($item_id, 'shop_tiny'); else echo '<img src="'.jigoshop::plugin_url(). '/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'" height="'.jigoshop::get_var('shop_tiny_h').'" />'; echo ' </a></td> <td class="product-name"><a href="'.get_permalink($item_id).'">' . apply_filters('jigoshop_cart_product_title', $_product->get_title(), $_product) . '</a></td> <td class="product-price">'.jigoshop_price($_product->get_price()).'</td> <td class="product-quantity"><div class="quantity"><input name="cart['.$item_id.'][qty]" value="'.$values['quantity'].'" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div></td> <td class="product-subtotal">'.jigoshop_price($_product->get_price()*$values['quantity']).'</td> </tr>'; endif; endforeach; endif; do_action( 'jigoshop_shop_table_cart' ); ?> <tr> <td colspan="6" class="actions"> <div class="coupon"> <label for="coupon_code"><?php _e('Coupon', 'jigoshop'); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'jigoshop'); ?>" /> </div> <?php jigoshop::nonce_field('cart') ?> <input type="submit" class="button" name="update_cart" value="<?php _e('Update Shopping Cart', 'jigoshop'); ?>" /> <a href="<?php echo jigoshop_cart::get_checkout_url(); ?>" class="checkout-button button-alt"><?php _e('Proceed to Checkout →', 'jigoshop'); ?></a> </td> </tr> </tbody> </table> </form> <div class="cart-collaterals"> <?php do_action('cart-collaterals'); ?> <div class="cart_totals"> <?php // Hide totals if customer has set location and there are no methods going there $available_methods = jigoshop_shipping::get_available_shipping_methods(); if ($available_methods || !jigoshop_customer::get_shipping_country() || !jigoshop_shipping::$enabled ) : ?> <h2><?php _e('Cart Totals', 'jigoshop'); ?></h2> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <th><?php _e('Subtotal', 'jigoshop'); ?></th> <td><?php echo jigoshop_cart::get_cart_subtotal(); ?></td> </tr> <?php if (jigoshop_cart::get_cart_shipping_total()) : ?><tr> <th><?php _e('Shipping', 'jigoshop'); ?> <small><?php echo jigoshop_countries::shipping_to_prefix().' '.jigoshop_countries::$countries[ jigoshop_customer::get_shipping_country() ]; ?></small></th> <td><?php echo jigoshop_cart::get_cart_shipping_total(); ?> <small><?php echo jigoshop_cart::get_cart_shipping_title(); ?></small></td> </tr><?php endif; ?> <?php if (jigoshop_cart::get_cart_tax()) : ?><tr> <th><?php _e('Tax', 'jigoshop'); ?> <?php if (jigoshop_customer::is_customer_outside_base()) : ?><small><?php echo sprintf(__('estimated for %s', 'jigoshop'), jigoshop_countries::estimated_for_prefix() . jigoshop_countries::$countries[ jigoshop_countries::get_base_country() ] ); ?></small><?php endif; ?></th> <td><?php echo jigoshop_cart::get_cart_tax(); ?></td> </tr><?php endif; ?> <?php if (jigoshop_cart::get_total_discount()) : ?><tr class="discount"> <th><?php _e('Discount', 'jigoshop'); ?></th> <td>-<?php echo jigoshop_cart::get_total_discount(); ?></td> </tr><?php endif; ?> <tr> <th><strong><?php _e('Total', 'jigoshop'); ?></strong></th> <td><strong><?php echo jigoshop_cart::get_total(); ?></strong></td> </tr> </tbody> </table> <?php else : echo '<p>'.__('Sorry, it seems that there are no available shipping methods to your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'</p>'; endif; ?> </div> <?php jigoshop_shipping_calculator(); ?> </div> <?php }
function my_cart($atts) { $errors = array(); unset(jigoshop_session::instance()->selected_rate_id); // Process Discount Codes if (isset($_POST['apply_coupon']) && $_POST['apply_coupon'] && jigoshop::verify_nonce('cart')) { $coupon_code = stripslashes(trim($_POST['coupon_code'])); jigoshop_cart::add_discount($coupon_code); // Update Shipping } elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && jigoshop::verify_nonce('cart')) { unset(jigoshop_session::instance()->chosen_shipping_method_id); $country = $_POST['calc_shipping_country']; $state = $_POST['calc_shipping_state']; $postcode = $_POST['calc_shipping_postcode']; if ($postcode && !jigoshop_validation::is_postcode($postcode, $country)) { jigoshop::add_error(__('Please enter a valid postcode/ZIP.', 'jigoshop')); $postcode = ''; } elseif ($postcode) { $postcode = jigoshop_validation::format_postcode($postcode, $country); } if ($country) { // Update customer location jigoshop_customer::set_location($country, $state, $postcode); jigoshop_customer::set_shipping_location($country, $state, $postcode); jigoshop::add_message(__('Shipping costs updated.', 'jigoshop')); } else { jigoshop_customer::set_shipping_location('', '', ''); jigoshop::add_message(__('Shipping costs updated.', 'jigoshop')); } } elseif (isset($_POST['shipping_rates'])) { $rates_params = explode(":", $_POST['shipping_rates']); $available_methods = jigoshop_shipping::get_available_shipping_methods(); $shipping_method = $available_methods[$rates_params[0]]; if ($rates_params[1] != NULL) { jigoshop_session::instance()->selected_rate_id = $rates_params[1]; } $shipping_method->choose(); // choses the method selected by user. } // Re-Calc prices. This needs to happen every time the cart page is loaded and after checking post results. It will happen twice for coupon. jigoshop_cart::calculate_totals(); $result = jigoshop_cart::check_cart_item_stock(); if (is_wp_error($result)) { jigoshop::add_error($result->get_error_message()); } jigoshop::show_messages(); if (sizeof(jigoshop_cart::$cart_contents) == 0) { echo '<p>' . __('Your cart is empty.', 'jigoshop') . '</p>'; ?> <p><a href="<?php echo esc_url(jigoshop_cart::get_shop_url()); ?> " class="button"><?php _e('← Return to Shop', 'jigoshop'); ?> </a></p><?php return; } ?> <form action="<?php echo esc_url(jigoshop_cart::get_cart_url()); ?> " method="post"> <table class="shop_table cart" cellspacing="0" id="shop-cart"> <thead> <tr> <th class="product-remove">Remove</th> <th class="product-thumbnail"></th> <th class="product-name"><span class="nobr"><?php _e('Product Name', 'jigoshop'); ?> </span></th> <th class="product-price"><span class="nobr"><?php _e('Unit Price', 'jigoshop'); ?> </span></th> <th class="product-quantity"><?php _e('Quantity', 'jigoshop'); ?> </th> <th class="product-subtotal"><?php _e('Price', 'jigoshop'); ?> </th> </tr> <?php do_action('jigoshop_shop_table_cart_head'); ?> </thead> <tbody> <?php if (sizeof(jigoshop_cart::$cart_contents) > 0) { foreach (jigoshop_cart::$cart_contents as $cart_item_key => $values) { $_product = $values['data']; if ($_product->exists() && $values['quantity'] > 0) { $additional_description = jigoshop_cart::get_item_data($values); ?> <tr> <td class="product-remove"><a href="<?php echo esc_url(jigoshop_cart::get_remove_url($cart_item_key)); ?> " class="remove" title="<?php echo esc_attr(__('Remove this item.', 'jigoshop')); ?> ">×</a></td> <td class="product-thumbnail"><a href="<?php echo esc_url(apply_filters('jigoshop_product_url_display_in_cart', get_permalink($values['product_id']), $cart_item_key)); ?> "> <?php if ($values['variation_id'] && has_post_thumbnail($values['variation_id'])) { echo get_the_post_thumbnail($values['variation_id'], 'shop_tiny'); } else { if (has_post_thumbnail($values['product_id'])) { echo get_the_post_thumbnail($values['product_id'], 'shop_tiny'); } else { echo '<img src="' . jigoshop::assets_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . jigoshop::get_var('shop_tiny_w') . '" height="' . jigoshop::get_var('shop_tiny_h') . '" />'; } } ?> </a> </td> <td class="product-name"> <a href="<?php echo esc_url(apply_filters('jigoshop_product_url_display_in_cart', get_permalink($values['product_id']), $cart_item_key)); ?> "><?php echo apply_filters('jigoshop_cart_product_title', $_product->get_title(), $_product); ?> </a> <?php echo $additional_description; ?> <?php if (!empty($values['variation_id'])) { $product_id = $values['variation_id']; } else { $product_id = $values['product_id']; } $custom_products = (array) jigoshop_session::instance()->customized_products; $custom = isset($custom_products[$product_id]) ? $custom_products[$product_id] : ''; if (!empty($custom_products[$product_id])) { ?> <dl class="customization"> <dt class="customized_product_label"><?php echo apply_filters('jigoshop_customized_product_label', __('Personal: ', 'jigoshop')); ?> </dt> <dd class="customized_product"><?php echo esc_textarea($custom); ?> </dd> </dl> <?php } ?> </td> <td class="product-price"><span class="m-label">Unit price:</span><?php echo jigoshop_price($_product->get_price()); ?> </td> <td class="product-quantity"> <span class="m-label">Quantity:</span> <div class="quantity"><input name="cart[<?php echo $cart_item_key; ?> ][qty]" value="<?php echo esc_attr($values['quantity']); ?> " size="4" title="Qty" class="input-text qty text" maxlength="12" /></div> </td> <td class="product-subtotal"><span class="m-label">Price:</span><?php echo jigoshop_price($_product->get_price() * $values['quantity']); ?> </td> </tr> <?php } } } do_action('jigoshop_shop_table_cart_body'); ?> </tbody> <tfoot> <tr> <td colspan="6" class="actions"> <?php $coupons = JS_Coupons::get_coupons(); if (!empty($coupons)) { ?> <div class="coupon"> <label for="coupon_code"><?php _e('Coupon', 'jigoshop'); ?> :</label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'jigoshop'); ?> " /> </div> <?php } ?> <?php jigoshop::nonce_field('cart'); ?> <input type="submit" class="button" name="update_cart" value="<?php _e('Update Shopping Cart', 'jigoshop'); ?> " /> <a href="<?php echo esc_url(jigoshop_cart::get_checkout_url()); ?> " class="checkout-button button-alt"><?php _e('Proceed to Checkout →', 'jigoshop'); ?> </a> </td> </tr> <?php if (count(jigoshop_cart::$applied_coupons)) { ?> <tr> <td colspan="6" class="applied-coupons"> <div> <span class="applied-coupons-label"><?php _e('Applied Coupons: ', 'jigoshop'); ?> </span> <?php foreach (jigoshop_cart::$applied_coupons as $code) { ?> <a href="?unset_coupon=<?php echo $code; ?> " id="<?php echo $code; ?> " class="applied-coupons-values"><?php echo $code; ?> <span class="close">×</span> </a> <?php } ?> </div> </td> </tr> <?php } do_action('jigoshop_shop_table_cart_foot'); ?> </tfoot> <?php do_action('jigoshop_shop_table_cart'); ?> </table> </form> <div class="cart-collaterals"> <?php do_action('cart-collaterals'); ?> <div class="cart_totals"> <?php // Hide totals if customer has set location and there are no methods going there $available_methods = jigoshop_shipping::get_available_shipping_methods(); $jigoshop_options = Jigoshop_Base::get_options(); if ($available_methods || !jigoshop_customer::get_shipping_country() || !jigoshop_shipping::is_enabled()) { ?> <h2><?php _e('Cart Totals', 'jigoshop'); ?> </h2> <div class="cart_totals_table"> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <?php $price_label = jigoshop_cart::show_retail_price() ? __('Retail Price', 'jigoshop') : __('Subtotal', 'jigoshop'); ?> <th class="cart-row-subtotal-title"><?php echo $price_label; ?> </th> <td class="cart-row-subtotal"><?php echo jigoshop_cart::get_cart_subtotal(); ?> </td> </tr> <?php if (jigoshop_cart::get_cart_shipping_total()) { ?> <tr> <th class="cart-row-shipping-title"><?php _e('Shipping', 'jigoshop'); ?> <small><?php echo jigoshop_countries::shipping_to_prefix() . ' ' . __(jigoshop_countries::$countries[jigoshop_customer::get_shipping_country()], 'jigoshop'); ?> </small></th> <td class="cart-row-shipping"><?php echo jigoshop_cart::get_cart_shipping_total(); ?> <small><?php echo jigoshop_cart::get_cart_shipping_title(); ?> </small></td> </tr> <?php } ?> <?php if (jigoshop_cart::show_retail_price()) { ?> <tr> <th class="cart-row-subtotal-title"><?php _e('Subtotal', 'jigoshop'); ?> </th> <td class="cart-row-subtotal"><?php echo jigoshop_cart::get_cart_subtotal(true, true); ?> </td> </tr> <?php } ?> <?php if (jigoshop_cart::tax_after_coupon()) { ?> <tr class="discount"> <th class="cart-row-discount-title"><?php _e('Discount', 'jigoshop'); ?> </th> <td class="cart-row-discount">-<?php echo jigoshop_cart::get_total_discount(); ?> </td> </tr> <?php } ?> <?php if (Jigoshop_Base::get_options()->get_option('jigoshop_calc_taxes') == 'yes') { foreach (jigoshop_cart::get_applied_tax_classes() as $tax_class) { if (jigoshop_cart::get_tax_for_display($tax_class)) { ?> <tr> <th class="cart-row-tax-title"><?php echo jigoshop_cart::get_tax_for_display($tax_class); ?> </th> <td class="cart-row-tax"><?php echo jigoshop_cart::get_tax_amount($tax_class); ?> </td> </tr> <?php } } } ?> <?php if (!jigoshop_cart::tax_after_coupon() && jigoshop_cart::get_total_discount()) { ?> <tr class="discount"> <th class="cart-row-discount-title"><?php _e('Discount', 'jigoshop'); ?> </th> <td class="cart-row-discount">-<?php echo jigoshop_cart::get_total_discount(); ?> </td> </tr> <?php } ?> <tr> <th class="cart-row-total-title"><strong><?php _e('Total', 'jigoshop'); ?> </strong></th> <td class="cart-row-total"><strong><?php echo jigoshop_cart::get_total(); ?> </strong></td> </tr> </tbody> </table> </div> <?php } else { echo '<p>' . __(jigoshop_shipping::get_shipping_error_message(), 'jigoshop') . '</p>'; } ?> </div> <?php jigoshop_shipping_calculator(); ?> </div> <?php }
function jigoshop_order_tracking($atts) { extract(shortcode_atts(array(), $atts)); global $post; $jigoshop_options = Jigoshop_Base::get_options(); if ($_POST) { $order = new jigoshop_order(); $order->id = !empty($_POST['orderid']) ? $_POST['orderid'] : 0; if (isset($_POST['order_email']) && $_POST['order_email']) { $order_email = trim($_POST['order_email']); } else { $order_email = ''; } if (!jigoshop::verify_nonce('order_tracking')) { echo '<p>' . __('You have taken too long. Please refresh the page and retry.', 'jigoshop') . '</p>'; } elseif ($order->id && $order_email && $order->get_order(apply_filters('jigoshop_shortcode_order_tracking_order_id', $order->id))) { if ($order->billing_email == $order_email) { echo '<p>' . sprintf(__('Order %s which was made %s ago and has the status "%s"', 'jigoshop'), $order->get_order_number(), human_time_diff(strtotime($order->order_date), current_time('timestamp')), __($order->status, 'jigoshop')); if ($order->status == 'completed') { $completed = (array) get_post_meta($order->id, '_js_completed_date', true); if (!empty($completed)) { $completed = $completed[0]; } else { $completed = ''; } // shouldn't happen, reset to be sure echo sprintf(__(' was completed %s ago', 'jigoshop'), human_time_diff(strtotime($completed), current_time('timestamp'))); } echo '.</p>'; do_action('jigoshop_tracking_details_info', $order); ?> <?php do_action('jigoshop_before_track_order_details', $order->id); ?> <h2><?php _e('Order Details', 'jigoshop'); ?> </h2> <table class="shop_table"> <thead> <tr> <th><?php _e('ID/SKU', 'jigoshop'); ?> </th> <th><?php _e('Title', 'jigoshop'); ?> </th> <th><?php _e('Price', 'jigoshop'); ?> </th> <th><?php _e('Quantity', 'jigoshop'); ?> </th> </tr> </thead> <tfoot> <tr> <?php if ($jigoshop_options->get('jigoshop_calc_taxes') == 'yes' && $order->has_compound_tax() || $jigoshop_options->get('jigoshop_tax_after_coupon') == 'yes' && $order->order_discount > 0) { ?> <td colspan="3"><?php _e('Retail Price', 'jigoshop'); ?> </td> <?php } else { ?> <td colspan="3"><?php _e('Subtotal', 'jigoshop'); ?> </td> <?php } ?> <td><?php echo $order->get_subtotal_to_display(); ?> </td> </tr> <?php if ($order->order_shipping > 0) { ?> <tr> <td colspan="3"><?php _e('Shipping', 'jigoshop'); ?> </td> <td><?php echo $order->get_shipping_to_display(); ?> </td> </tr> <?php } do_action('jigoshop_processing_fee_after_shipping'); if ($jigoshop_options->get('jigoshop_tax_after_coupon') == 'yes' && $order->order_discount > 0) { ?> <tr class="discount"> <td colspan="3"><?php _e('Discount', 'jigoshop'); ?> </td> <td>-<?php echo jigoshop_price($order->order_discount); ?> </td> </tr> <?php } if ($jigoshop_options->get('jigoshop_calc_taxes') == 'yes' && $order->has_compound_tax() || $jigoshop_options->get('jigoshop_tax_after_coupon') == 'yes' && $order->order_discount > 0) { ?> <tr> <td colspan="3"><?php _e('Subtotal', 'jigoshop'); ?> </td> <td><?php echo jigoshop_price($order->order_discount_subtotal); ?> </td> </tr> <?php } if ($jigoshop_options->get('jigoshop_calc_taxes') == 'yes') { foreach ($order->get_tax_classes() as $tax_class) { if ($order->show_tax_entry($tax_class)) { ?> <tr> <td colspan="3"><?php echo $order->get_tax_class_for_display($tax_class) . ' (' . (double) $order->get_tax_rate($tax_class) . '%):'; ?> </td> <td><?php echo $order->get_tax_amount($tax_class); ?> </td> </tr> <?php } } } ?> <?php if ($jigoshop_options->get('jigoshop_tax_after_coupon') == 'no' && $order->order_discount > 0) { ?> <tr class="discount"> <td colspan="3"><?php _e('Discount', 'jigoshop'); ?> </td> <td>-<?php echo jigoshop_price($order->order_discount); ?> </td> </tr><?php } ?> <tr> <td colspan="3"><strong><?php _e('Grand Total', 'jigoshop'); ?> </strong></td> <td><strong><?php echo jigoshop_price($order->order_total); ?> </strong></td> </tr> </tfoot> <tbody> <?php foreach ($order->items as $order_item) { if (isset($order_item['variation_id']) && $order_item['variation_id'] > 0) { $_product = new jigoshop_product_variation($order_item['variation_id']); } else { $_product = new jigoshop_product($order_item['id']); } echo '<tr>'; echo '<td>' . $_product->sku . '</td>'; echo '<td class="product-name">' . $_product->get_title(); if ($_product instanceof jigoshop_product_variation) { echo jigoshop_get_formatted_variation($_product, $order_item['variation']); } do_action('jigoshop_display_item_meta_data', $order_item); echo '</td>'; echo '<td>' . jigoshop_price($order_item['cost']) . '</td>'; echo '<td>' . $order_item['qty'] . '</td>'; echo '</tr>'; } ?> </tbody> </table> <?php do_action('jigoshop_after_track_order_details', $order->id); ?> <div style="width: 49%; float:left;"> <h2><?php _e('Billing Address', 'jigoshop'); ?> </h2> <p><?php $address = $order->billing_first_name . ' ' . $order->billing_last_name . '<br/>'; if ($order->billing_company) { $address .= $order->billing_company . '<br/>'; } $address .= $order->formatted_billing_address; echo $address; ?> </p> </div> <div style="width: 49%; float:right;"> <h2><?php _e('Shipping Address', 'jigoshop'); ?> </h2> <p><?php $address = $order->shipping_first_name . ' ' . $order->shipping_last_name . '<br/>'; if ($order->shipping_company) { $address .= $order->shipping_company . '<br/>'; } $address .= $order->formatted_shipping_address; echo $address; ?> </p> </div> <div class="clear"></div> <?php } else { echo '<p>' . __('Sorry, we could not find that order id in our database. <a href="' . get_permalink($post->ID) . '">Want to retry?</a>', 'jigoshop') . '</p>'; } } else { echo '<p>' . sprintf(__('Sorry, we could not find that order id in our database. <a href="%s">Want to retry?</a></p>', 'jigoshop'), get_permalink($post->ID)); } } else { ?> <form action="<?php echo esc_url(get_permalink($post->ID)); ?> " method="post" class="track_order"> <p><?php _e('To track your order please enter your Order ID and email address in the boxes below and press return. This was given to you on your receipt and in the confirmation email you should have received.', 'jigoshop'); ?> </p> <p class="form-row form-row-first"><label for="orderid"><?php _e('Order ID', 'jigoshop'); ?> </label> <input class="input-text" type="text" name="orderid" id="orderid" placeholder="<?php _e('Found in your order confirmation email.', 'jigoshop'); ?> " /></p> <p class="form-row form-row-last"><label for="order_email"><?php _e('Billing Email', 'jigoshop'); ?> </label> <input class="input-text" type="text" name="order_email" id="order_email" placeholder="<?php _e('Email you used during checkout.', 'jigoshop'); ?> " /></p> <div class="clear"></div> <p class="form-row"><input type="submit" class="button" name="track" value="<?php _e('Track"', 'jigoshop'); ?> " /></p> <?php jigoshop::nonce_field('order_tracking'); ?> </form> <?php } }
<div class="coupon"> <label for="coupon_code"><?php _e('Coupon', 'jigoshop'); ?> :</label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'jigoshop'); ?> " /> </div> <?php } ?> <?php jigoshop::nonce_field('cart'); ?> <?php if ($options->get('jigoshop_cart_shows_shop_button') == 'no') { ?> <noscript> <input type="submit" class="button" name="update_cart" value="<?php _e('Update Shopping Cart', 'jigoshop'); ?> " /> </noscript> <a href="<?php echo esc_url(jigoshop_cart::get_checkout_url()); ?> " class="checkout-button button-alt"><?php