| @@ 97-118 (lines=22) @@ | ||
| 94 | * @param $price |
|
| 95 | * @return float |
|
| 96 | */ |
|
| 97 | static public function getDiscountPriceOrder( |
|
| 98 | Order $order, |
|
| 99 | SpecialPriceList $specialPrice, |
|
| 100 | $price |
|
| 101 | ) { |
|
| 102 | ||
| 103 | $discountPrice = 0; |
|
| 104 | ||
| 105 | $discountObjects = SpecialPriceObject::findAll( |
|
| 106 | [ |
|
| 107 | 'special_price_list_id' => $specialPrice->id, |
|
| 108 | 'object_model_id' => $order->id |
|
| 109 | ] |
|
| 110 | ); |
|
| 111 | ||
| 112 | foreach ($discountObjects as $object) { |
|
| 113 | $discountPrice += $object->price; |
|
| 114 | } |
|
| 115 | ||
| 116 | ||
| 117 | return $price + $discountPrice; |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * @param Order $order |
|
| @@ 126-143 (lines=18) @@ | ||
| 123 | * @param $price |
|
| 124 | * @return float |
|
| 125 | */ |
|
| 126 | static public function getDeliveryPriceOrder( |
|
| 127 | Order $order, |
|
| 128 | SpecialPriceList $specialPrice, |
|
| 129 | $price |
|
| 130 | ) { |
|
| 131 | $deliveryPrice = 0; |
|
| 132 | ||
| 133 | $deliveryObjects = SpecialPriceObject::findAll([ |
|
| 134 | 'special_price_list_id' => $specialPrice->id, |
|
| 135 | 'object_model_id' => $order->id |
|
| 136 | ]); |
|
| 137 | ||
| 138 | foreach ($deliveryObjects as $object) { |
|
| 139 | $deliveryPrice += $object->price; |
|
| 140 | } |
|
| 141 | ||
| 142 | return $price + $deliveryPrice; |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * @param array $types |
|