Orders panel
This commit is contained in:
parent
fc7b3d2265
commit
c2d3ec4892
|
@ -290,7 +290,7 @@ function woocommerce_order_items_meta_box($post) {
|
|||
</td>
|
||||
<?php do_action('woocommerce_admin_order_item_values', $_product, $item); ?>
|
||||
<td class="quantity"><input type="text" name="item_quantity[]" placeholder="<?php _e('Quantity e.g. 2', 'woothemes'); ?>" value="<?php echo $item['qty']; ?>" /></td>
|
||||
<td class="cost"><input type="text" name="item_cost[]" placeholder="<?php _e('Cost per unit including tax e.g. 2.99', 'woothemes'); ?>" value="<?php echo $item['cost']; ?>" /></td>
|
||||
<td class="cost"><input type="text" name="item_cost[]" placeholder="<?php _e('Cost per unit ex. tax e.g. 2.99', 'woothemes'); ?>" value="<?php echo $item['cost']; ?>" /></td>
|
||||
<td class="tax"><input type="text" name="item_tax_rate[]" placeholder="<?php _e('Tax Rate e.g. 20.0000', 'woothemes'); ?>" value="<?php echo $item['taxrate']; ?>" /></td>
|
||||
<td class="center">
|
||||
<input type="hidden" name="item_id[]" value="<?php echo $item['id']; ?>" />
|
||||
|
@ -303,7 +303,7 @@ function woocommerce_order_items_meta_box($post) {
|
|||
</table>
|
||||
</div>
|
||||
<p class="buttons">
|
||||
<select name="item_id" class="item_id">
|
||||
<select name="add_item_id" class="item_id">
|
||||
<?php
|
||||
echo '<option value="">'.__('Choose an item…', 'woothemes').'</option>';
|
||||
|
||||
|
@ -502,7 +502,7 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
|
|||
if (!isset($item_cost[$i])) continue;
|
||||
if (!isset($item_tax_rate[$i])) continue;
|
||||
|
||||
$ex_tax = woocommerce_clean($item_cost[$i]) / ((woocommerce_clean($item_tax_rate[$i])/100)+1);
|
||||
//$ex_tax = woocommerce_clean($item_cost[$i]) / (($item_tax_rate[$i]/100)+1);
|
||||
|
||||
$order_items[] = apply_filters('update_order_item', array(
|
||||
'id' => htmlspecialchars(stripslashes($item_id[$i])),
|
||||
|
@ -510,7 +510,6 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
|
|||
'name' => htmlspecialchars(stripslashes($item_name[$i])),
|
||||
'qty' => (int) $item_quantity[$i],
|
||||
'cost' => number_format(woocommerce_clean($item_cost[$i]), 2, '.', ''),
|
||||
'cost_ex_tax' => number_format(woocommerce_clean($ex_tax[$i]), 2, '.', ''),
|
||||
'taxrate' => number_format(woocommerce_clean($item_tax_rate[$i]), 4, '.', ''),
|
||||
));
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ jQuery( function($){
|
|||
|
||||
if (itemTax && itemTax>0) {
|
||||
|
||||
taxRate = itemTax/100 + 1;
|
||||
taxRate = itemTax/100;
|
||||
|
||||
itemTaxAmount = ((itemCost - (itemCost / taxRate)) * 100 );
|
||||
itemTaxAmount = ((itemCost * taxRate) * 100 );
|
||||
|
||||
itemTaxAmount = itemTaxAmount.toFixed(2);
|
||||
|
||||
|
@ -76,7 +76,7 @@ jQuery( function($){
|
|||
}
|
||||
}
|
||||
|
||||
subtotal = itemTotal - tax;
|
||||
subtotal = itemTotal;
|
||||
|
||||
total = parseFloat(subtotal) + parseFloat(tax) - parseFloat(discount) + parseFloat(shipping) + parseFloat(shipping_tax);
|
||||
|
||||
|
@ -93,7 +93,7 @@ jQuery( function($){
|
|||
|
||||
jQuery('button.add_shop_order_item').click(function(){
|
||||
|
||||
var item_id = jQuery('select.item_id').val();
|
||||
var item_id = jQuery('select.add_item_id').val();
|
||||
|
||||
if (item_id) {
|
||||
|
||||
|
@ -101,7 +101,7 @@ jQuery( function($){
|
|||
|
||||
var data = {
|
||||
action: 'woocommerce_add_order_item',
|
||||
item_to_add: jQuery('select.item_id').val(),
|
||||
item_to_add: jQuery('select.add_item_id').val(),
|
||||
security: params.add_order_item_nonce
|
||||
};
|
||||
|
||||
|
@ -109,12 +109,12 @@ jQuery( function($){
|
|||
|
||||
jQuery('table.woocommerce_order_items tbody#order_items_list').append( response );
|
||||
jQuery('table.woocommerce_order_items').unblock();
|
||||
jQuery('select.item_id').css('border-color', '').val('');
|
||||
jQuery('select.add_item_id').css('border-color', '').val('');
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
jQuery('select.item_id').css('border-color', 'red');
|
||||
jQuery('select.add_item_id').css('border-color', 'red');
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -544,8 +544,7 @@ class woocommerce_checkout {
|
|||
'variation_id' => $values['variation_id'],
|
||||
'name' => $_product->get_title(),
|
||||
'qty' => (int) $values['quantity'],
|
||||
'cost' => $_product->get_price(),
|
||||
'cost_ex_tax' => $_product->get_price_excluding_tax(),
|
||||
'cost' => $_product->get_price_excluding_tax(),
|
||||
'taxrate' => $rate
|
||||
));
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class woocommerce_order {
|
|||
|
||||
endif;
|
||||
|
||||
$return .= ' - ' . strip_tags(woocommerce_price( $item['cost_ex_tax']*$item['qty'], array('ex_tax_label' => 1 )));
|
||||
$return .= ' - ' . strip_tags(woocommerce_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1 )));
|
||||
|
||||
if (isset($_product->variation_data)) :
|
||||
$return .= PHP_EOL . woocommerce_get_formatted_variation( $_product->variation_data, true );
|
||||
|
|
|
@ -508,7 +508,7 @@ function woocommerce_view_order() {
|
|||
|
||||
echo ' </td>
|
||||
<td>'.$item['qty'].'</td>
|
||||
<td>'.woocommerce_price( $item['cost_ex_tax']*$item['qty'], array('ex_tax_label' => 1) ).'</td>
|
||||
<td>'.woocommerce_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1) ).'</td>
|
||||
</tr>';
|
||||
endforeach;
|
||||
endif;
|
||||
|
|
Loading…
Reference in New Issue