| @@ 344-375 (lines=32) @@ | ||
| 341 | return false; |
|
| 342 | } |
|
| 343 | ||
| 344 | if ($evaluation_result) { |
|
| 345 | $go_to_index = $evaluation['go_to_index_after']; |
|
| 346 | ||
| 347 | switch ($evaluation['action_unit']) { |
|
| 348 | case 'pieces': |
|
| 349 | $quantity = $evaluation['action_quantity']; |
|
| 350 | break; |
|
| 351 | case 'percentage_of_price_including_vat': |
|
| 352 | $quantity = round(($evaluation['action_quantity']/100)*$basket->getTotalPrice()); |
|
| 353 | break; |
|
| 354 | case 'percentage_of_price_exclusive_vat': |
|
| 355 | $quantity = round(($evaluation['action_quantity']/100)*$basket->getTotalPrice('exclusive_vat')); |
|
| 356 | break; |
|
| 357 | default: |
|
| 358 | throw new Exception("Invalid action_unit in BasketEvaluation->run"); |
|
| 359 | return false; |
|
| 360 | } |
|
| 361 | ||
| 362 | switch ($evaluation['action_action']) { |
|
| 363 | case 'no_action': |
|
| 364 | // fine nothing is done |
|
| 365 | break; |
|
| 366 | case 'add_product_id': |
|
| 367 | if (!$basket->change($evaluation['action_value'], 0, $quantity, '', 0, 1)) { // 1: it is basketevaluation |
|
| 368 | $this->error->set('Could not add product - invalid id or out of stock'); |
|
| 369 | } |
|
| 370 | break; |
|
| 371 | default: |
|
| 372 | throw new Exception("Invalid action_action in BasketEvaluation->run"); |
|
| 373 | return false; |
|
| 374 | } |
|
| 375 | } |
|
| 376 | } |
|
| 377 | return true; |
|
| 378 | } |
|
| @@ 321-352 (lines=32) @@ | ||
| 318 | return false; |
|
| 319 | } |
|
| 320 | ||
| 321 | if ($evaluation_result) { |
|
| 322 | $go_to_index = $evaluation['go_to_index_after']; |
|
| 323 | ||
| 324 | switch ($evaluation['action_unit']) { |
|
| 325 | case 'pieces': |
|
| 326 | $quantity = $evaluation['action_quantity']; |
|
| 327 | break; |
|
| 328 | case 'percentage_of_price_including_vat': |
|
| 329 | $quantity = round(($evaluation['action_quantity']/100)*$basket->getTotalPrice()); |
|
| 330 | break; |
|
| 331 | case 'percentage_of_price_exclusive_vat': |
|
| 332 | $quantity = round(($evaluation['action_quantity']/100)*$basket->getTotalPrice('exclusive_vat')); |
|
| 333 | break; |
|
| 334 | default: |
|
| 335 | throw new Exception("Invalid action_unit in BasketEvaluation->run"); |
|
| 336 | return false; |
|
| 337 | } |
|
| 338 | ||
| 339 | switch ($evaluation['action_action']) { |
|
| 340 | case 'no_action': |
|
| 341 | // fine nothing is done |
|
| 342 | break; |
|
| 343 | case 'add_product_id': |
|
| 344 | if (!$basket->change($evaluation['action_value'], $quantity, '', 0, 1)) { // 1: it is basketevaluation |
|
| 345 | $this->error->set('Could not add product - invalid id or out of stock'); |
|
| 346 | } |
|
| 347 | break; |
|
| 348 | default: |
|
| 349 | throw new Exception("Invalid action_action in BasketEvaluation->run"); |
|
| 350 | return false; |
|
| 351 | } |
|
| 352 | } |
|
| 353 | } |
|
| 354 | return true; |
|
| 355 | } |
|