function get_order_email_arguments($order_id) { $options = Jigoshop_Base::get_options(); $order = new jigoshop_order($order_id); $inc_tax = $options->get('jigoshop_calc_taxes') == 'no' || $options->get('jigoshop_prices_include_tax') == 'yes'; $can_show_links = $order->status == 'completed' || $order->status == 'processing'; $statuses = $order->get_order_statuses_and_names(); $variables = array('blog_name' => get_bloginfo('name'), 'order_number' => $order->get_order_number(), 'order_date' => date_i18n(get_option('date_format')), 'order_status' => $statuses[$order->status], 'shop_name' => $options->get('jigoshop_company_name'), 'shop_address_1' => $options->get('jigoshop_address_1'), 'shop_address_2' => $options->get('jigoshop_address_2'), 'shop_tax_number' => $options->get('jigoshop_tax_number'), 'shop_phone' => $options->get('jigoshop_company_phone'), 'shop_email' => $options->get('jigoshop_company_email'), 'customer_note' => $order->customer_note, 'order_items_table' => jigoshop_get_order_items_table($order, $can_show_links, true, $inc_tax), 'order_items' => $order->email_order_items_list($can_show_links, true, $inc_tax), 'order_taxes' => jigoshop_get_order_taxes_list($order), 'subtotal' => $order->get_subtotal_to_display(), 'shipping' => $order->get_shipping_to_display(), 'shipping_cost' => jigoshop_price($order->order_shipping), 'shipping_method' => $order->shipping_service, 'discount' => jigoshop_price($order->order_discount), 'applied_coupons' => jigoshop_get_order_coupon_list($order), 'total_tax' => jigoshop_price($order->get_total_tax()), 'total' => jigoshop_price($order->order_total), 'is_local_pickup' => $order->shipping_method == 'local_pickup' ? true : null, 'checkout_url' => $order->status == 'pending' ? $order->get_checkout_payment_url() : null, 'payment_method' => $order->payment_method_title, 'is_bank_transfer' => $order->payment_method == 'bank_transfer' ? true : null, 'is_cash_on_delivery' => $order->payment_method == 'cod' ? true : null, 'is_cheque' => $order->payment_method == 'cheque' ? true : null, 'bank_info' => str_replace(PHP_EOL, '', jigoshop_bank_transfer::get_bank_details()), 'cheque_info' => str_replace(PHP_EOL, '', $options->get('jigoshop_cheque_description')), 'billing_first_name' => $order->billing_first_name, 'billing_last_name' => $order->billing_last_name, 'billing_company' => $order->billing_company, 'billing_euvatno' => $order->billing_euvatno, 'billing_address_1' => $order->billing_address_1, 'billing_address_2' => $order->billing_address_2, 'billing_postcode' => $order->billing_postcode, 'billing_city' => $order->billing_city, 'billing_country' => jigoshop_countries::get_country($order->billing_country), 'billing_state' => strlen($order->billing_state) == 2 ? jigoshop_countries::get_state($order->billing_country, $order->billing_state) : $order->billing_state, 'billing_country_raw' => $order->billing_country, 'billing state_raw' => $order->billing_state, 'billing_email' => $order->billing_email, 'billing_phone' => $order->billing_phone, 'shipping_first_name' => $order->shipping_first_name, 'shipping_last_name' => $order->shipping_last_name, 'shipping_company' => $order->shipping_company, 'shipping_address_1' => $order->shipping_address_1, 'shipping_address_2' => $order->shipping_address_2, 'shipping_postcode' => $order->shipping_postcode, 'shipping_city' => $order->shipping_city, 'shipping_country' => jigoshop_countries::get_country($order->shipping_country), 'shipping_state' => strlen($order->shipping_state) == 2 ? jigoshop_countries::get_state($order->shipping_country, $order->shipping_state) : $order->shipping_state, 'shipping_country_raw' => $order->shipping_country, 'shipping_state_raw' => $order->shipping_state); if ($options->get('jigoshop_calc_taxes') == 'yes') { $variables['all_tax_classes'] = $variables['order_taxes']; } else { unset($variables['order_taxes']); } return apply_filters('jigoshop_order_email_variables', $variables, $order_id); }
/** * Order data meta box * * Displays the meta box * * @since 1.0 */ function jigoshop_order_data_meta_box($post) { global $post; add_action('admin_footer', 'jigoshop_meta_scripts'); wp_nonce_field('jigoshop_save_data', 'jigoshop_meta_nonce'); $data = (array) maybe_unserialize(get_post_meta($post->ID, 'order_data', true)); $data['customer_user'] = (int) get_post_meta($post->ID, 'customer_user', true); $order_status = get_the_terms($post->ID, 'shop_order_status'); if ($order_status) { $order_status = current($order_status); $data['order_status'] = $order_status->slug; } else { $data['order_status'] = 'new'; } if (!isset($post->post_title) || empty($post->post_title)) { $order_title = 'Order'; } else { $order_title = $post->post_title; } $data = apply_filters('jigoshop_admin_order_data', $data, $post->ID); ?> <style type="text/css"> #titlediv, #major-publishing-actions, #minor-publishing-actions { display:none } </style> <div class="panels jigoshop"> <input name="post_title" type="hidden" value="<?php echo esc_attr($order_title); ?> " /> <input name="post_status" type="hidden" value="publish" /> <ul class="product_data_tabs tabs" style="display:none;"> <li class="active"><a href="#order_data"><?php _e('Order', 'jigoshop'); ?> </a></li> <li><a href="#order_customer_billing_data"><?php _e('Customer Billing Address', 'jigoshop'); ?> </a></li> <li><a href="#order_customer_shipping_data"><?php _e('Customer Shipping Address', 'jigoshop'); ?> </a></li> <?php do_action("jigoshop_order_data_tabs", $post, $data); ?> </ul> <div id="order_data" class="panel jigoshop_options_panel"> <p class="form-field"><label for="order_status"><?php _e('Order status:', 'jigoshop'); ?> </label> <select id="order_status" name="order_status"> <?php $statuses = (array) get_terms('shop_order_status', array('hide_empty' => 0, 'orderby' => 'id')); $names = jigoshop_order::get_order_statuses_and_names(); foreach ($statuses as $status) { echo '<option value="' . esc_attr($status->slug) . '" '; if ($status->slug == $data['order_status']) { echo 'selected="selected"'; } echo '>' . $names[$status->name] . '</option>'; } ?> </select></p> <script type="text/javascript"> /*<![CDATA[*/ jQuery(function() { jQuery("#order_status").select2({ width: '150px' }); }); /*]]>*/ </script> <p class="form-field"><label for="customer_user"><?php _e('Customer:', 'jigoshop'); ?> </label> <select id="customer_user" name="customer_user"> <option value=""><?php _e('Guest', 'jigoshop'); ?> </option> <?php $users_fields = array('ID', 'display_name', 'user_email'); $users = new WP_User_Query(array('orderby' => 'display_name', 'fields' => $users_fields)); $users = $users->get_results(); if ($users) { foreach ($users as $user) { echo '<option value="' . esc_attr($user->ID) . '" '; selected($data['customer_user'], $user->ID); echo '>' . $user->display_name . ' (' . $user->user_email . ')</option>'; } } ?> </select></p> <script type="text/javascript"> /*<![CDATA[*/ jQuery(function() { jQuery("#customer_user").select2({ width: '300px' }); }); /*]]>*/ </script> <p class="form-field"><label for="excerpt"><?php _e('Customer Note:', 'jigoshop'); ?> </label> <textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e('Customer\'s notes about the order', 'jigoshop'); ?> "><?php echo esc_textarea(html_entity_decode($post->post_excerpt, ENT_QUOTES, 'UTF-8')); ?> </textarea></p> </div> <div id="order_customer_billing_data" class="panel jigoshop_options_panel"> <?php $billing_fields = apply_filters('jigoshop_admin_order_billing_fields', array('billing_company' => __('Company', 'jigoshop'), 'billing_euvatno' => __('EU VAT Number', 'jigoshop'), 'billing_first_name' => __('First Name', 'jigoshop'), 'billing_last_name' => __('Last Name', 'jigoshop'), 'billing_address_1' => __('Address 1', 'jigoshop'), 'billing_address_2' => __('Address 2', 'jigoshop'), 'billing_city' => __('City', 'jigoshop'), 'billing_postcode' => __('Postcode', 'jigoshop'), 'billing_country' => __('Country', 'jigoshop'), 'billing_state' => __('State/Province', 'jigoshop'), 'billing_phone' => __('Phone', 'jigoshop'), 'billing_email' => __('Email Address', 'jigoshop')), $data); foreach ($billing_fields as $field_id => $field_desc) { $field_value = ''; if (isset($data[$field_id])) { $field_value = $data[$field_id]; } echo '<p class="form-field"><label for="' . esc_attr($field_id) . '">' . $field_desc . ':</label> <input type="text" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" value="' . esc_attr($field_value) . '" /></p>'; } ?> </div> <div id="order_customer_shipping_data" class="panel jigoshop_options_panel"> <p class="form-field"><button class="button billing-same-as-shipping"><?php _e('Copy billing address to shipping address', 'jigoshop'); ?> </button></p> <?php $shipping_fields = apply_filters('jigoshop_admin_order_shipping_fields', array('shipping_company' => __('Company', 'jigoshop'), 'shipping_first_name' => __('First Name', 'jigoshop'), 'shipping_last_name' => __('Last Name', 'jigoshop'), 'shipping_address_1' => __('Address 1', 'jigoshop'), 'shipping_address_2' => __('Address 2', 'jigoshop'), 'shipping_city' => __('City', 'jigoshop'), 'shipping_postcode' => __('Postcode', 'jigoshop'), 'shipping_country' => __('Country', 'jigoshop'), 'shipping_state' => __('State/Province', 'jigoshop')), $data); foreach ($shipping_fields as $field_id => $field_desc) { $field_value = ''; if (isset($data[$field_id])) { $field_value = $data[$field_id]; } echo '<p class="form-field"><label for="' . esc_attr($field_id) . '">' . $field_desc . ':</label> <input type="text" name="' . esc_attr($field_id) . '" id="' . esc_attr($field_id) . '" value="' . esc_attr($field_value) . '" /></p>'; } ?> </div> <?php do_action("jigoshop_order_data_panels", $post, $data); ?> </div> <?php }