mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 01:11:46 +08:00 
			
		
		
		
	update discount
This commit is contained in:
		| @@ -129,7 +129,8 @@ class OrderController extends Controller | |||||||
|         } else { |         } else { | ||||||
|             $order->type = 1; |             $order->type = 1; | ||||||
|         } |         } | ||||||
|         // coupon process |         // discount start | ||||||
|  |         // coupon | ||||||
|         if (isset($coupon)) { |         if (isset($coupon)) { | ||||||
|             switch ($coupon->type) { |             switch ($coupon->type) { | ||||||
|                 case 1: |                 case 1: | ||||||
| @@ -139,7 +140,6 @@ class OrderController extends Controller | |||||||
|                     $order->discount_amount = $order->total_amount * ($coupon->value / 100); |                     $order->discount_amount = $order->total_amount * ($coupon->value / 100); | ||||||
|                     break; |                     break; | ||||||
|             } |             } | ||||||
|             $order->total_amount = $order->total_amount - $order->discount_amount; |  | ||||||
|             if ($coupon->limit_use !== NULL) { |             if ($coupon->limit_use !== NULL) { | ||||||
|                 $coupon->limit_use = $coupon->limit_use - 1; |                 $coupon->limit_use = $coupon->limit_use - 1; | ||||||
|                 if (!$coupon->save()) { |                 if (!$coupon->save()) { | ||||||
| @@ -148,10 +148,14 @@ class OrderController extends Controller | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         // user only discount |         // user | ||||||
|         if ($user->discount) { |         if ($user->discount) { | ||||||
|             $order->total_amount = $order->total_amount * ($user->discount / 100); |             $order->discount_amount = $order->discount_amount + ($order->total_amount * ($user->discount / 100)); | ||||||
|         } |         } | ||||||
|  |         // discount complete | ||||||
|  |         $order->total_amount = $order->total_amount - $order->discount_amount; | ||||||
|  |         // discount end | ||||||
|  |  | ||||||
|         // free process |         // free process | ||||||
|         if ($order->total_amount <= 0) { |         if ($order->total_amount <= 0) { | ||||||
|             $order->total_amount = 0; |             $order->total_amount = 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user