/** * Order totals meta box * * Displays the order totals meta box * * @since 1.0 */ function jigoshop_order_totals_meta_box($post) { $_order = new jigoshop_order($post->ID); $coupons = array(); $order_discount_coupons = (array) $_order->_fetch('order_discount_coupons'); if (!empty($order_discount_coupons)) { foreach ($order_discount_coupons as $coupon) { $coupons[] = isset($coupon['code']) ? $coupon['code'] : ''; } } ?> <ul class="totals"> <li class="left"> <label><?php _e('Subtotal:', 'jigoshop'); ?> </label> <input type="text" id="order_subtotal" name="order_subtotal" placeholder="0.00 <?php _e('(ex. tax)', 'jigoshop'); ?> " value="<?php echo esc_attr($_order->_fetch('order_subtotal')); ?> " class="first" /> </li> <li class="right"> <label><?php _e('Discount: ', 'jigoshop'); ?> <span class="applied-coupons-values"><?php echo implode(',', $coupons); ?> </span></label> <input type="text" id="order_discount" name="order_discount" placeholder="0.00" value="<?php echo esc_attr($_order->_fetch('order_discount')); ?> " /> </li> <?php $shipping_methods = jigoshop_shipping::get_all_methods(); $shipping_select = "<select id='shipping_method' name='shipping_method' class='last' data-placeholder=" . __('Choose', 'jigoshop') . ">"; $shipping_select .= "<option></option>"; if (!empty($shipping_methods)) { foreach ($shipping_methods as $index => $method) { $mark = ''; if ($_order->_fetch('shipping_method') == $method->id) { $mark = 'selected="selected"'; } $shipping_select .= "<option value='{$method->id}' {$mark}>{$method->title}</option>"; } } $shipping_select .= "</select>"; ?> <li> <label><?php _e('Shipping:', 'jigoshop'); ?> </label> <input type="text" id="order_shipping" name="order_shipping" placeholder="0.00 <?php _e('(ex. tax)', 'jigoshop'); ?> " value="<?php echo esc_attr($_order->_fetch('order_shipping')); ?> " class="first" /> <?php echo $shipping_select; ?> <script type="text/javascript"> /*<![CDATA[*/ jQuery(function() { jQuery("#shipping_method").select2({ width: '120px' }); }); /*]]>*/ </script> </li> <li class="left"> <label><?php _e('Total Tax:', 'jigoshop'); ?> </label> <input type="text" id="order_tax" name="order_tax_total" placeholder="0.00" value="<?php echo esc_attr($_order->get_total_tax()); ?> " class="first" /> </li> <li class="right"> <label><?php _e('Shipping Tax:', 'jigoshop'); ?> </label> <input type="text" id="order_shipping_tax" name="order_shipping_tax" placeholder="0.00" value="<?php echo esc_attr($_order->_fetch('order_shipping_tax')); ?> " class="first" /> </li> <?php $payment_methods = jigoshop_payment_gateways::get_available_payment_gateways(); $payment_select = "<select id='payment_method' name='payment_method' class='last' data-placeholder=" . __('Choose', 'jigoshop') . ">"; $payment_select .= "<option></option>"; if (!empty($payment_methods)) { foreach ($payment_methods as $index => $method) { $mark = ''; if ($_order->_fetch('payment_method') == $method->id) { $mark = 'selected="selected"'; } $payment_select .= "<option value='{$method->id}' {$mark}>{$method->title}</option>"; } } $payment_select .= "</select>"; ?> <?php do_action('jigoshop_admin_order_totals_after_shipping', $post->ID); ?> <li> <label><?php _e('Total:', 'jigoshop'); ?> </label> <input type="text" id="order_total" name="order_total" placeholder="0.00" value="<?php echo esc_attr($_order->_fetch('order_total')); ?> " class="first" /> <?php echo $payment_select; ?> <script type="text/javascript"> /*<![CDATA[*/ jQuery(function() { jQuery("#payment_method").select2({ width: '120px' }); }); /*]]>*/ </script> </li> </ul> <div class="clear"></div> <?php }