function jigoshop_admin_user_profile(WP_User $user) { $customer = new jigoshop_user($user->ID); wp_enqueue_script('admin', 'jigoshop-select2', JIGOSHOP_URL . '/assets/js/select2.min.js', array('jquery')); wp_enqueue_style('admin', 'jigoshop-select2', JIGOSHOP_URL . '/assets/css/select2.css'); jigoshop_render('admin/user-profile', array('user' => $user, 'customer' => $customer)); }
function jigoshop_cart($atts) { unset(jigoshop_session::instance()->selected_rate_id); // Process Discount Codes if (isset($_POST['apply_coupon']) && $_POST['apply_coupon'] && jigoshop::verify_nonce('cart')) { $coupon_code = sanitize_title($_POST['coupon_code']); jigoshop_cart::add_discount($coupon_code); } elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && jigoshop::verify_nonce('cart')) { // Update Shipping 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(); // chooses the method selected by user. } // Re-Calc prices. This needs to happen every time the cart page is loaded and after checking post results. jigoshop_cart::calculate_totals(); $result = jigoshop_cart::check_cart_item_stock(); if (is_wp_error($result)) { jigoshop::add_error($result->get_error_message()); } jigoshop_render('shortcode/cart', array('cart' => jigoshop_cart::get_cart(), 'coupons' => jigoshop_cart::get_coupons())); }
/** * Helper function to locate proper template and set up environment based on passed array. * Returns value of rendered template as a string. * * @param string $template Template name. * @param array $variables Template variables * @return string */ function jigoshop_render_result($template, array $variables) { ob_start(); jigoshop_render($template, $variables); return ob_get_clean(); }
function jigoshop_view_order() { $options = Jigoshop_Base::get_options(); $order = new jigoshop_order($_GET['order']); jigoshop_render('shortcode/my_account/view_order', array('order' => $order, 'options' => $options)); }
<th scope="row"><?php _e('Postcode', 'jigoshop'); ?> </th> <td><input type="text" name="jigoshop[shipping_postcode]" value="<?php echo $customer->getShippingPostcode(); ?> " class="regular-text" /> </td> </tr> <tr> <th scope="row"><?php _e('Country', 'jigoshop'); ?> </th> <td><?php jigoshop_render('admin/user-profile/country_dropdown', array('country' => $customer->getShippingCountry(), 'state' => $customer->getShippingState(), 'name' => 'shipping_country')); ?> </td> </tr> <tr> <th scope="row"><?php _e('Telefone', 'jigoshop'); ?> </th> <td><input type="text" name="jigoshop[shipping_phone]" value="<?php echo $customer->getShippingPhone(); ?> " class="regular-text" /> </td> </tr> <tr> <th scope="row"><?php