notifications finish
This commit is contained in:
parent
6c7fa26a44
commit
7b179db9fe
|
|
@ -27,7 +27,7 @@ class OrderItemRepository extends WOrderItemRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($orderItem->qty_ordered) {
|
if ($orderItem->qty_ordered) {
|
||||||
// $orderItem->total_weight -= $orderItem->weight * $orderItem->qty_to_cancel;
|
$orderItem->total_weight -= $orderItem->weight * $orderItem->qty_to_cancel;
|
||||||
$prosent_discount = ($orderItem->total* $orderItem->discount_percent)/100;
|
$prosent_discount = ($orderItem->total* $orderItem->discount_percent)/100;
|
||||||
$base_prosent_discount = ($orderItem->base_total* $orderItem->discount_percent)/100;
|
$base_prosent_discount = ($orderItem->base_total* $orderItem->discount_percent)/100;
|
||||||
$prosentsizDiscount = $orderItem->discount_amount - $prosent_discount;
|
$prosentsizDiscount = $orderItem->discount_amount - $prosent_discount;
|
||||||
|
|
@ -43,6 +43,7 @@ class OrderItemRepository extends WOrderItemRepo
|
||||||
$orderItem->save();
|
$orderItem->save();
|
||||||
|
|
||||||
if ($orderItem->parent && $orderItem->parent->qty_ordered) {
|
if ($orderItem->parent && $orderItem->parent->qty_ordered) {
|
||||||
|
$orderItem->parent->total_weight -= $orderItem->parent->weight * $orderItem->parent->qty_to_cancel;
|
||||||
$prosent_discount = ($orderItem->parent->total* $orderItem->parent->discount_percent)/100;
|
$prosent_discount = ($orderItem->parent->total* $orderItem->parent->discount_percent)/100;
|
||||||
$base_prosent_discount = ($orderItem->parent->base_total* $orderItem->parent->discount_percent)/100;
|
$base_prosent_discount = ($orderItem->parent->base_total* $orderItem->parent->discount_percent)/100;
|
||||||
$prosentsizDiscount = $orderItem->parent->discount_amount - $prosent_discount;
|
$prosentsizDiscount = $orderItem->parent->discount_amount - $prosent_discount;
|
||||||
|
|
@ -59,6 +60,7 @@ class OrderItemRepository extends WOrderItemRepo
|
||||||
$orderItem->parent->save();
|
$orderItem->parent->save();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$orderItem->parent->total_weight -= $orderItem->parent->weight * $orderItem->parent->qty_to_cancel;
|
||||||
$prosent_discount = ($orderItem->parent->total* $orderItem->parent->discount_percent)/100;
|
$prosent_discount = ($orderItem->parent->total* $orderItem->parent->discount_percent)/100;
|
||||||
$base_prosent_discount = ($orderItem->parent->base_total* $orderItem->parent->discount_percent)/100;
|
$base_prosent_discount = ($orderItem->parent->base_total* $orderItem->parent->discount_percent)/100;
|
||||||
$prosentsizDiscount = $orderItem->parent->discount_amount - $prosent_discount;
|
$prosentsizDiscount = $orderItem->parent->discount_amount - $prosent_discount;
|
||||||
|
|
|
||||||
|
|
@ -67,14 +67,21 @@ class OrderRepository extends WOrderRepository
|
||||||
$total_weight = $order->items->sum('total_weight');
|
$total_weight = $order->items->sum('total_weight');
|
||||||
// $order_item->total_weight = ($order_item->qty_ordered - $order_item->qty_canceled) * $order_item->weight;
|
// $order_item->total_weight = ($order_item->qty_ordered - $order_item->qty_canceled) * $order_item->weight;
|
||||||
|
|
||||||
$shipping_price = $order->shipping_amount/$total_weight;
|
if(($total_weight - $order_item->total_weight) >0 ){
|
||||||
$base_shipping_price = $order->base_shipping_amount/$total_weight;
|
$shipping_price = $order->shipping_amount/$total_weight;
|
||||||
|
$base_shipping_price = $order->base_shipping_amount/$total_weight;
|
||||||
|
|
||||||
$canceled_amount = $shipping_price * $order_item->qty_to_cancel * $order_item->weight;
|
$canceled_amount = $shipping_price * $order_item->qty_to_cancel * $order_item->weight;
|
||||||
$canceled_base_amount = $base_shipping_price * $order_item->qty_to_cancel * $order_item->weight;
|
$canceled_base_amount = $base_shipping_price * $order_item->qty_to_cancel * $order_item->weight;
|
||||||
|
|
||||||
|
$order->shipping_amount = $order->shipping_amount - $canceled_amount;
|
||||||
|
$order->base_shipping_amount = $order->base_shipping_amount - $canceled_base_amount;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$order->shipping_amount = 0;
|
||||||
|
$order->base_shipping_amount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$order->shipping_amount = $order->shipping_amount - $canceled_amount;
|
|
||||||
$order->base_shipping_amount = $order->base_shipping_amount - $canceled_base_amount;
|
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue