Changed discount to row_discount
This commit is contained in:
parent
d954419417
commit
b681ec5788
|
@ -169,7 +169,7 @@ function woocommerce_order_items_meta_box($post) {
|
|||
<?php do_action('woocommerce_admin_order_item_headers'); ?>
|
||||
<th class="quantity"><?php _e('Quantity', 'woothemes'); ?></th>
|
||||
<th class="cost"><?php _e('Cost', 'woothemes'); ?> <?php echo $woocommerce->countries->ex_tax_or_vat(); ?></th>
|
||||
<th class="cost"><?php _e('Discount', 'woothemes'); ?></th>
|
||||
<th class="cost"><?php _e('Row Discount', 'woothemes'); ?></th>
|
||||
<th class="tax"><?php _e('Tax Rate', 'woothemes'); ?></th>
|
||||
<th class="center" width="1%"><?php _e('Remove', 'woothemes'); ?></th>
|
||||
</tr>
|
||||
|
@ -242,7 +242,7 @@ function woocommerce_order_items_meta_box($post) {
|
|||
</td>
|
||||
|
||||
<td class="discount">
|
||||
<input type="text" name="item_discount[<?php echo $loop; ?>]" placeholder="<?php _e('0.00', 'woothemes'); ?>" value="<?php if (isset($item['discount'])) echo esc_attr( $item['discount'] ); ?>" />
|
||||
<input type="text" name="item_discount[<?php echo $loop; ?>]" placeholder="<?php _e('0.00', 'woothemes'); ?>" value="<?php if (isset($item['row_discount'])) echo esc_attr( $item['row_discount'] ); ?>" />
|
||||
</td>
|
||||
|
||||
<td class="tax">
|
||||
|
@ -503,7 +503,7 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
|
|||
'name' => htmlspecialchars(stripslashes($item_name[$i])),
|
||||
'qty' => (int) $item_quantity[$i],
|
||||
'cost' => woocommerce_clean($item_cost[$i]),
|
||||
'discount' => number_format(woocommerce_clean($item_discount[$i]), 4, '.', ''),
|
||||
'row_discount' => number_format(woocommerce_clean($item_discount[$i]), 4, '.', ''),
|
||||
'taxrate' => number_format(woocommerce_clean($item_tax_rate[$i]), 4, '.', ''),
|
||||
'item_meta' => $item_meta->meta
|
||||
));
|
||||
|
|
|
@ -80,7 +80,7 @@ jQuery( function($){
|
|||
totalItemTax = 0;
|
||||
|
||||
// Calculate tax and discounts
|
||||
cart_discount = cart_discount + (itemDiscount * itemQty);
|
||||
cart_discount = cart_discount + itemDiscount;
|
||||
|
||||
if (itemTax && itemTax>0) {
|
||||
|
||||
|
@ -89,39 +89,37 @@ jQuery( function($){
|
|||
taxRate = ( itemTax/100 ) + 1;
|
||||
|
||||
// Discount worked out from tax inc. price then tax worked out backwards
|
||||
price_in_tax = itemCost * taxRate;
|
||||
price_in_tax = ( itemCost * taxRate ) * itemQty;
|
||||
|
||||
discounted_price = price_in_tax - itemDiscount;
|
||||
|
||||
totalItemTax = ( (discounted_price*itemQty) - ( (discounted_price*itemQty) / taxRate ) ) * 100;
|
||||
totalItemTax = ( discounted_price - ( discounted_price / taxRate ) ) * 100;
|
||||
|
||||
totalItemTax = totalItemTax.toFixed(2);
|
||||
|
||||
totalItemTax = Math.round( totalItemTax ) / 100;
|
||||
|
||||
discounted_price = (discounted_price*itemQty) - totalItemTax;
|
||||
discounted_price = discounted_price - totalItemTax;
|
||||
|
||||
} else {
|
||||
|
||||
taxRate = ( itemTax/100 );
|
||||
|
||||
// Discount worked out from ex. price and tax worked out forwards
|
||||
discounted_price = itemCost - itemDiscount;
|
||||
discounted_price = ( itemCost * taxRate ) - itemDiscount;
|
||||
|
||||
totalItemTax = ( (discounted_price*itemQty) * taxRate ) * 100;
|
||||
totalItemTax = ( discounted_price * taxRate ) * 100;
|
||||
|
||||
totalItemTax = totalItemTax.toFixed(2);
|
||||
|
||||
totalItemTax = Math.round( totalItemTax ) / 100;
|
||||
|
||||
discounted_price = (discounted_price*itemQty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
discounted_price = (itemCost - itemDiscount) *itemQty;
|
||||
discounted_price = (itemCost * itemQty ) - itemDiscount;
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -683,9 +683,9 @@ class woocommerce_checkout {
|
|||
'name' => $_product->get_title(),
|
||||
'qty' => (int) $values['quantity'],
|
||||
'cost' => $_product->get_price_excluding_tax( false ),
|
||||
'discount' => number_format(
|
||||
( $_product->get_price()-$woocommerce->cart->get_discounted_price( $values, $_product->get_price() ) )
|
||||
, 4, '.', '' ),
|
||||
'row_discount' => number_format(
|
||||
( ( $_product->get_price()-$woocommerce->cart->get_discounted_price( $values, $_product->get_price() ) ) * $values['quantity'] )
|
||||
, 2, '.', '' ),
|
||||
'taxrate' => $rate,
|
||||
'item_meta' => $item_meta->meta
|
||||
), $values);
|
||||
|
|
Loading…
Reference in New Issue