| @@ -727,10 +727,10 @@ discard block | ||
| 727 | 727 | } | 
| 728 | 728 | |
| 729 | 729 | $this->update($productId, array( | 
| 730 | - 'quantity' => array( | |
| 731 | - 'relative' => false, | |
| 732 | - 'value' => $amount | |
| 733 | - ), | |
| 730 | + 'quantity' => array( | |
| 731 | + 'relative' => false, | |
| 732 | + 'value' => $amount | |
| 733 | + ), | |
| 734 | 734 | )); | 
| 735 | 735 |              } else { | 
| 736 | 736 | $this->remove($productId); | 
| @@ -796,7 +796,7 @@ discard block | ||
| 796 | 796 | |
| 797 | 797 |                      if ($preSaleDiscount['discount_way'] == 'amount') { | 
| 798 | 798 | $discountValue = "-".$preSaleDiscount->value; | 
| 799 | -                      } elseif ($preSaleDiscount['discount_way'] == 'percent') {           | |
| 799 | +                        } elseif ($preSaleDiscount['discount_way'] == 'percent') {           | |
| 800 | 800 | $discountValue = "-".$preSaleDiscount['value']."%"; | 
| 801 | 801 | } | 
| 802 | 802 | } | 
| @@ -72,9 +72,9 @@ discard block | ||
| 72 | 72 | $this->events = $events; | 
| 73 | 73 | $this->session = $session; | 
| 74 | 74 | $this->instanceName = $instanceName; | 
| 75 | - $this->sessionKeyCartItems = $session_key . '_cart_items'; | |
| 76 | - $this->sessionKeyCartConditions = $session_key . '_cart_conditions'; | |
| 77 | - $this->sessionKeyCartVoucher = $session_key . '_voucher'; | |
| 75 | + $this->sessionKeyCartItems = $session_key.'_cart_items'; | |
| 76 | + $this->sessionKeyCartConditions = $session_key.'_cart_conditions'; | |
| 77 | + $this->sessionKeyCartVoucher = $session_key.'_voucher'; | |
| 78 | 78 |          $this->fireEvent('created'); | 
| 79 | 79 | $this->config = $config; | 
| 80 | 80 | } | 
| @@ -156,7 +156,7 @@ discard block | ||
| 156 | 156 | */ | 
| 157 | 157 | public function update($id, $data) | 
| 158 | 158 |      { | 
| 159 | -        if($this->fireEvent('updating', $data) === false) { | |
| 159 | +        if ($this->fireEvent('updating', $data) === false) { | |
| 160 | 160 | return false; | 
| 161 | 161 | } | 
| 162 | 162 | $cart = $this->getContent(); | 
| @@ -252,7 +252,7 @@ discard block | ||
| 252 | 252 | */ | 
| 253 | 253 | protected function addRow($id, $item) | 
| 254 | 254 |      { | 
| 255 | -        if($this->fireEvent('adding', $item) === false) { | |
| 255 | +        if ($this->fireEvent('adding', $item) === false) { | |
| 256 | 256 | return false; | 
| 257 | 257 | } | 
| 258 | 258 | $cart = $this->getContent(); | 
| @@ -285,7 +285,7 @@ discard block | ||
| 285 | 285 | $condition->setOrder(!is_null($last) ? $last->getOrder() + 1 : 1); | 
| 286 | 286 | } | 
| 287 | 287 | $conditions->put($condition->getName(), $condition); | 
| 288 | -        $conditions = $conditions->sortBy(function ($condition, $key) { | |
| 288 | +        $conditions = $conditions->sortBy(function($condition, $key) { | |
| 289 | 289 | return $condition->getOrder(); | 
| 290 | 290 | }); | 
| 291 | 291 | $this->saveConditions($conditions); | 
| @@ -323,7 +323,7 @@ discard block | ||
| 323 | 323 | */ | 
| 324 | 324 | public function getConditionsByType($type) | 
| 325 | 325 |      { | 
| 326 | -        return $this->getConditions()->filter(function (CartCondition $condition) use ($type) { | |
| 326 | +        return $this->getConditions()->filter(function(CartCondition $condition) use ($type) { | |
| 327 | 327 | return $condition->getType() == $type; | 
| 328 | 328 | }); | 
| 329 | 329 | } | 
| @@ -338,7 +338,7 @@ discard block | ||
| 338 | 338 | */ | 
| 339 | 339 | public function removeConditionsByType($type) | 
| 340 | 340 |      { | 
| 341 | -        $this->getConditionsByType($type)->each(function ($condition) { | |
| 341 | +        $this->getConditionsByType($type)->each(function($condition) { | |
| 342 | 342 | $this->removeCartCondition($condition->getName()); | 
| 343 | 343 | }); | 
| 344 | 344 | } | 
| @@ -449,7 +449,7 @@ discard block | ||
| 449 | 449 | public function getSubTotalWithoutConditions($formatted = true) | 
| 450 | 450 |      { | 
| 451 | 451 | $cart = $this->getContent(); | 
| 452 | -        $sum = $cart->sum(function ($item) { | |
| 452 | +        $sum = $cart->sum(function($item) { | |
| 453 | 453 | return $item->getOriginalPriceWithTaxSum(); | 
| 454 | 454 | }); | 
| 455 | 455 | |
| @@ -464,7 +464,7 @@ discard block | ||
| 464 | 464 | public function getSubTotalWithTax($formatted = true) | 
| 465 | 465 |      { | 
| 466 | 466 | $cart = $this->getContent(); | 
| 467 | -        $sum = $cart->sum(function ($item) { | |
| 467 | +        $sum = $cart->sum(function($item) { | |
| 468 | 468 | return $item->getOriginalPriceWithTaxSum(false); | 
| 469 | 469 | }); | 
| 470 | 470 | |
| @@ -480,7 +480,7 @@ discard block | ||
| 480 | 480 | public function getSubTotalWithoutTax($formatted = true) | 
| 481 | 481 |      { | 
| 482 | 482 | $cart = $this->getContent(); | 
| 483 | -        $sum = $cart->sum(function ($item) { | |
| 483 | +        $sum = $cart->sum(function($item) { | |
| 484 | 484 | return $item->getOriginalPriceWithoutTaxSum(false); | 
| 485 | 485 | }); | 
| 486 | 486 | |
| @@ -500,7 +500,7 @@ discard block | ||
| 500 | 500 | $process = 0; | 
| 501 | 501 | $conditions = $this | 
| 502 | 502 | ->getConditions() | 
| 503 | -            ->filter(function ($cond) { | |
| 503 | +            ->filter(function($cond) { | |
| 504 | 504 | return $cond->getTarget() === 'subtotal'; | 
| 505 | 505 | }); | 
| 506 | 506 | // if no conditions were added, just return the sub total | 
| @@ -508,7 +508,7 @@ discard block | ||
| 508 | 508 | return Helpers::formatValue(floatval($subTotal), $formatted, $this->config); | 
| 509 | 509 | } | 
| 510 | 510 | $conditions | 
| 511 | -            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) { | |
| 511 | +            ->each(function($cond) use ($subTotal, &$newTotal, &$process) { | |
| 512 | 512 | $toBeCalculated = ($process > 0) ? $newTotal : $subTotal; | 
| 513 | 513 | $newTotal = $cond->applyCondition($toBeCalculated); | 
| 514 | 514 | $process++; | 
| @@ -531,7 +531,7 @@ discard block | ||
| 531 | 531 | $process = 0; | 
| 532 | 532 | $conditions = $this | 
| 533 | 533 | ->getConditions() | 
| 534 | -            ->filter(function ($cond) { | |
| 534 | +            ->filter(function($cond) { | |
| 535 | 535 | return $cond->getTarget() === 'subtotal'; | 
| 536 | 536 | }); | 
| 537 | 537 | // if no conditions were added, just return the sub total | 
| @@ -539,7 +539,7 @@ discard block | ||
| 539 | 539 | return $subTotal; | 
| 540 | 540 | } | 
| 541 | 541 | $conditions | 
| 542 | -            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) { | |
| 542 | +            ->each(function($cond) use ($subTotal, &$newTotal, &$process) { | |
| 543 | 543 | $toBeCalculated = ($process > 0) ? $newTotal : $subTotal; | 
| 544 | 544 | $newTotal = $cond->applyConditionWithoutTax($toBeCalculated); | 
| 545 | 545 | $process++; | 
| @@ -557,7 +557,7 @@ discard block | ||
| 557 | 557 | public function remove($id) | 
| 558 | 558 |      { | 
| 559 | 559 | $cart = $this->getContent(); | 
| 560 | -        if($this->fireEvent('removing', $id) === false) { | |
| 560 | +        if ($this->fireEvent('removing', $id) === false) { | |
| 561 | 561 | return false; | 
| 562 | 562 | } | 
| 563 | 563 | $cart->forget($id); | 
| @@ -603,18 +603,18 @@ discard block | ||
| 603 | 603 | public function getVoucher() | 
| 604 | 604 |      { | 
| 605 | 605 | $voucher = $this->session->get($this->sessionKeyCartVoucher); | 
| 606 | -        if($voucher){ | |
| 606 | +        if ($voucher) { | |
| 607 | 607 | |
| 608 | 608 | $totalWithTax = self::getTotalWithTax(); | 
| 609 | 609 | $totalWithoutTax = self::getTotalWithoutTax(); | 
| 610 | - $voucher['used_value_with_tax'] = $voucher['value']; | |
| 611 | - $voucher['used_value_without_tax'] = $voucher['value']; | |
| 612 | -        if($totalWithTax <= $voucher['value']) { | |
| 613 | - $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax); | |
| 610 | + $voucher['used_value_with_tax'] = $voucher['value']; | |
| 611 | + $voucher['used_value_without_tax'] = $voucher['value']; | |
| 612 | +        if ($totalWithTax <= $voucher['value']) { | |
| 613 | + $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax); | |
| 614 | 614 | } | 
| 615 | 615 | |
| 616 | -        if($totalWithTax <= $voucher['value']) { | |
| 617 | - $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax); | |
| 616 | +        if ($totalWithTax <= $voucher['value']) { | |
| 617 | + $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax); | |
| 618 | 618 | } | 
| 619 | 619 | |
| 620 | 620 | $this->session->put($this->sessionKeyCartVoucher, $voucher); | 
| @@ -655,7 +655,7 @@ discard block | ||
| 655 | 655 | */ | 
| 656 | 656 | public function clear() | 
| 657 | 657 |      { | 
| 658 | -        if($this->fireEvent('clearing') === false) { | |
| 658 | +        if ($this->fireEvent('clearing') === false) { | |
| 659 | 659 | return false; | 
| 660 | 660 | } | 
| 661 | 661 | $this->session->put( | 
| @@ -673,7 +673,7 @@ discard block | ||
| 673 | 673 | */ | 
| 674 | 674 | protected function fireEvent($name, $value = []) | 
| 675 | 675 |      { | 
| 676 | - return $this->events->fire($this->getInstanceName() . '.' . $name, array_values([$value, $this])); | |
| 676 | + return $this->events->fire($this->getInstanceName().'.'.$name, array_values([$value, $this])); | |
| 677 | 677 | } | 
| 678 | 678 | |
| 679 | 679 | public function updateAmountProduct($productId, $amount, $leadingAttributeId, $productAttributeId) | 
| @@ -712,7 +712,7 @@ discard block | ||
| 712 | 712 | $productArray['reference_code'] = $productCombination->reference_code; | 
| 713 | 713 | } | 
| 714 | 714 | |
| 715 | - $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId); | |
| 715 | + $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId); | |
| 716 | 716 | } | 
| 717 | 717 | |
| 718 | 718 |              if ($product->amountSeries()->where('active', '=', '1')->count()) { | 
| @@ -720,9 +720,9 @@ discard block | ||
| 720 | 720 |                  $productArray['product_amount_series_range'] = $product->amountSeries()->where('active', '=', '1')->first()->range(); | 
| 721 | 721 | } | 
| 722 | 722 | |
| 723 | -            if($productArray['price_details']['amount'] > 0) { | |
| 723 | +            if ($productArray['price_details']['amount'] > 0) { | |
| 724 | 724 | |
| 725 | -                if($amount >= $productArray['price_details']['amount']) { | |
| 725 | +                if ($amount >= $productArray['price_details']['amount']) { | |
| 726 | 726 | $amount = $productArray['price_details']['amount']; | 
| 727 | 727 | } | 
| 728 | 728 | |
| @@ -736,7 +736,7 @@ discard block | ||
| 736 | 736 | $this->remove($productId); | 
| 737 | 737 | } | 
| 738 | 738 | |
| 739 | -            if($this->getConditionsByType('sending_method_country_price')->count()) { | |
| 739 | +            if ($this->getConditionsByType('sending_method_country_price')->count()) { | |
| 740 | 740 |                  $this->updateSendingMethodCountryPrice($this->getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price_id']);   | 
| 741 | 741 | } | 
| 742 | 742 | } | 
| @@ -776,7 +776,7 @@ discard block | ||
| 776 | 776 | $productArray['reference_code'] = $productCombination->reference_code; | 
| 777 | 777 | } | 
| 778 | 778 | |
| 779 | - $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId)); | |
| 779 | + $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId)); | |
| 780 | 780 | } | 
| 781 | 781 | |
| 782 | 782 | $productId = $productArray['id']; | 
| @@ -787,7 +787,7 @@ discard block | ||
| 787 | 787 | |
| 788 | 788 | $discountValue = false; | 
| 789 | 789 | |
| 790 | -            if(session()->get('preSaleDiscount')) { | |
| 790 | +            if (session()->get('preSaleDiscount')) { | |
| 791 | 791 |                  $preSaleDiscount = session()->get('preSaleDiscount');              | 
| 792 | 792 | |
| 793 | 793 | |
| @@ -801,7 +801,7 @@ discard block | ||
| 801 | 801 | } | 
| 802 | 802 | } | 
| 803 | 803 | |
| 804 | -                if($preSaleDiscount['products']) { | |
| 804 | +                if ($preSaleDiscount['products']) { | |
| 805 | 805 | |
| 806 | 806 | $productIds = array_column($preSaleDiscount['products'], 'id'); | 
| 807 | 807 | |
| @@ -827,7 +827,7 @@ discard block | ||
| 827 | 827 | } | 
| 828 | 828 | |
| 829 | 829 | $discountCondition = array(); | 
| 830 | -            if($discountValue) { | |
| 830 | +            if ($discountValue) { | |
| 831 | 831 | |
| 832 | 832 | $discountCondition = new \Hideyo\Ecommerce\Framework\Services\Cart\CartCondition(array( | 
| 833 | 833 | 'name' => 'Discount', | 
| @@ -837,7 +837,7 @@ discard block | ||
| 837 | 837 | )); | 
| 838 | 838 | } | 
| 839 | 839 | |
| 840 | - return $this->add($productId, $productArray, $amount, $discountCondition); | |
| 840 | + return $this->add($productId, $productArray, $amount, $discountCondition); | |
| 841 | 841 | } | 
| 842 | 842 | |
| 843 | 843 | return false; | 
| @@ -850,7 +850,7 @@ discard block | ||
| 850 | 850 |          if (isset($sendingMethod->id)) { | 
| 851 | 851 | $sendingMethodArray = $sendingMethod->toArray(); | 
| 852 | 852 | $sendingMethodArray['price_details'] = $sendingMethod->getPriceDetails(); | 
| 853 | -            if($sendingMethod->relatedPaymentMethodsActive) { | |
| 853 | +            if ($sendingMethod->relatedPaymentMethodsActive) { | |
| 854 | 854 |                  $sendingMethodArray['related_payment_methods_list'] = $sendingMethod->relatedPaymentMethodsActive->pluck('title', 'id');                 | 
| 855 | 855 | } | 
| 856 | 856 | |
| @@ -890,7 +890,7 @@ discard block | ||
| 890 | 890 | $valueIncTax = $paymentMethodArray['price_details']['original_price_inc_tax']; | 
| 891 | 891 |          $shop = ShopService::find(config()->get('app.shop_id')); | 
| 892 | 892 | $value = $valueIncTax; | 
| 893 | - $freeSending = ( $paymentMethodArray['no_price_from'] - $this->getSubTotalWithTax()); | |
| 893 | + $freeSending = ($paymentMethodArray['no_price_from'] - $this->getSubTotalWithTax()); | |
| 894 | 894 | |
| 895 | 895 | |
| 896 | 896 |          if ($freeSending < 0) { | 
| @@ -943,7 +943,7 @@ discard block | ||
| 943 | 943 | $valueExTax = $sendingMethodArray['price_details']['original_price_ex_tax']; | 
| 944 | 944 | $valueIncTax = $sendingMethodArray['price_details']['original_price_inc_tax']; | 
| 945 | 945 | $value = $valueIncTax; | 
| 946 | - $freeSending = ( $sendingMethodArray['no_price_from'] - $this->getSubTotalWithTax()); | |
| 946 | + $freeSending = ($sendingMethodArray['no_price_from'] - $this->getSubTotalWithTax()); | |
| 947 | 947 | |
| 948 | 948 |              if ($freeSending < 0) { | 
| 949 | 949 | $value = 0; | 
| @@ -1016,12 +1016,12 @@ discard block | ||
| 1016 | 1016 | $couponData = array(); | 
| 1017 | 1017 | $discountValue = 0; | 
| 1018 | 1018 | |
| 1019 | -        if($coupon) { | |
| 1019 | +        if ($coupon) { | |
| 1020 | 1020 | |
| 1021 | 1021 | $couponData = $coupon->toArray(); | 
| 1022 | -            if($coupon->type == 'total_price') { | |
| 1022 | +            if ($coupon->type == 'total_price') { | |
| 1023 | 1023 | |
| 1024 | -                if($coupon->discount_way == 'total') { | |
| 1024 | +                if ($coupon->discount_way == 'total') { | |
| 1025 | 1025 | $discountValue = $coupon->value; | 
| 1026 | 1026 |                  } elseif ($coupon->discount_way == 'percent') { | 
| 1027 | 1027 | $discountValue = $coupon->value.'%'; | 
| @@ -1030,9 +1030,9 @@ discard block | ||
| 1030 | 1030 | $this->setCouponCode($discountValue, $couponData, $couponCode); | 
| 1031 | 1031 | } | 
| 1032 | 1032 | |
| 1033 | -            if($coupon->type == 'product') { | |
| 1033 | +            if ($coupon->type == 'product') { | |
| 1034 | 1034 | |
| 1035 | -                if($coupon->products()->count()) { | |
| 1035 | +                if ($coupon->products()->count()) { | |
| 1036 | 1036 | |
| 1037 | 1037 |                      foreach ($this->getContent() as $row) { | 
| 1038 | 1038 | |
| @@ -1040,9 +1040,9 @@ discard block | ||
| 1040 | 1040 |                          $explode = explode('-', $id); | 
| 1041 | 1041 | $contains = $coupon->products->contains($explode[0]); | 
| 1042 | 1042 | |
| 1043 | -                        if($contains) { | |
| 1043 | +                        if ($contains) { | |
| 1044 | 1044 | |
| 1045 | -                            if($coupon->discount_way == 'total') { | |
| 1045 | +                            if ($coupon->discount_way == 'total') { | |
| 1046 | 1046 | $discountValue += $coupon->value; | 
| 1047 | 1047 |                              } elseif ($coupon->discount_way == 'percent') { | 
| 1048 | 1048 | $value = $coupon->value / 100; | 
| @@ -1055,17 +1055,17 @@ discard block | ||
| 1055 | 1055 | } | 
| 1056 | 1056 | } | 
| 1057 | 1057 | |
| 1058 | -            if($coupon->type == 'product_category') { | |
| 1058 | +            if ($coupon->type == 'product_category') { | |
| 1059 | 1059 | |
| 1060 | -                if($coupon->productCategories()->count()) { | |
| 1060 | +                if ($coupon->productCategories()->count()) { | |
| 1061 | 1061 | |
| 1062 | 1062 |                      foreach ($this->getContent()->sortBy('id')  as $row) { | 
| 1063 | 1063 | |
| 1064 | 1064 | $contains = $coupon->productCategories->contains($row['attributes']['product_category_id']); | 
| 1065 | 1065 | |
| 1066 | -                        if($contains) { | |
| 1066 | +                        if ($contains) { | |
| 1067 | 1067 | |
| 1068 | -                            if($coupon->discount_way == 'total') { | |
| 1068 | +                            if ($coupon->discount_way == 'total') { | |
| 1069 | 1069 | $discountValue += $coupon->value; | 
| 1070 | 1070 |                              } elseif ($coupon->discount_way == 'percent') { | 
| 1071 | 1071 | $value = $coupon->value / 100; | 
| @@ -1079,16 +1079,16 @@ discard block | ||
| 1079 | 1079 | } | 
| 1080 | 1080 | } | 
| 1081 | 1081 | |
| 1082 | -            if($coupon->type == 'sending_method') { | |
| 1082 | +            if ($coupon->type == 'sending_method') { | |
| 1083 | 1083 | |
| 1084 | -                if($coupon->sendingMethodCountries()->count()) { | |
| 1084 | +                if ($coupon->sendingMethodCountries()->count()) { | |
| 1085 | 1085 | |
| 1086 | 1086 |                      foreach ($coupon->sendingMethodCountries as $country) { | 
| 1087 | 1087 | |
| 1088 | -                        if($this->getConditionsByType('sending_method_country_price')){ | |
| 1089 | -                            if($country->name == $this->getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) { | |
| 1088 | +                        if ($this->getConditionsByType('sending_method_country_price')) { | |
| 1089 | +                            if ($country->name == $this->getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) { | |
| 1090 | 1090 | |
| 1091 | -                                if($coupon->discount_way == 'total') { | |
| 1091 | +                                if ($coupon->discount_way == 'total') { | |
| 1092 | 1092 | $discountValue += $coupon->value; | 
| 1093 | 1093 |                                  } elseif ($coupon->discount_way == 'percent') { | 
| 1094 | 1094 | $value = $coupon->value / 100; | 
| @@ -1100,15 +1100,15 @@ discard block | ||
| 1100 | 1100 | |
| 1101 | 1101 | $this->setCouponCode($discountValue, $couponData, $couponCode); | 
| 1102 | 1102 | |
| 1103 | -                } elseif($coupon->sendingMethods()->count()) { | |
| 1103 | +                } elseif ($coupon->sendingMethods()->count()) { | |
| 1104 | 1104 | |
| 1105 | 1105 |                      foreach ($coupon->sendingMethods as $sendingMethod) { | 
| 1106 | 1106 | |
| 1107 | -                        if($this->getConditionsByType('sending_cost')){ | |
| 1107 | +                        if ($this->getConditionsByType('sending_cost')) { | |
| 1108 | 1108 | |
| 1109 | -                            if($sendingMethod->id == $this->getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) { | |
| 1109 | +                            if ($sendingMethod->id == $this->getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) { | |
| 1110 | 1110 | |
| 1111 | -                                if($coupon->discount_way == 'total') { | |
| 1111 | +                                if ($coupon->discount_way == 'total') { | |
| 1112 | 1112 | $discountValue += $coupon->value; | 
| 1113 | 1113 |                                  } elseif ($coupon->discount_way == 'percent') { | 
| 1114 | 1114 | $value = $coupon->value / 100; | 
| @@ -1122,17 +1122,17 @@ discard block | ||
| 1122 | 1122 | } | 
| 1123 | 1123 | } | 
| 1124 | 1124 | |
| 1125 | -            if($coupon->type == 'payment_method') { | |
| 1125 | +            if ($coupon->type == 'payment_method') { | |
| 1126 | 1126 | |
| 1127 | -                if($coupon->paymentMethods()->count()) { | |
| 1127 | +                if ($coupon->paymentMethods()->count()) { | |
| 1128 | 1128 | |
| 1129 | 1129 |                      foreach ($coupon->paymentMethods as $paymentMethod) { | 
| 1130 | 1130 | |
| 1131 | -                        if($this->getConditionsByType('payment_method')){ | |
| 1131 | +                        if ($this->getConditionsByType('payment_method')) { | |
| 1132 | 1132 | |
| 1133 | -                            if($paymentMethod->id == $this->getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) { | |
| 1133 | +                            if ($paymentMethod->id == $this->getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) { | |
| 1134 | 1134 | |
| 1135 | -                                if($coupon->discount_way == 'total') { | |
| 1135 | +                                if ($coupon->discount_way == 'total') { | |
| 1136 | 1136 | $discountValue += $coupon->value; | 
| 1137 | 1137 |                                  } elseif ($coupon->discount_way == 'percent') { | 
| 1138 | 1138 | $value = $coupon->value / 100; | 
| @@ -1183,7 +1183,7 @@ discard block | ||
| 1183 | 1183 | ); | 
| 1184 | 1184 | |
| 1185 | 1185 |          foreach ($replace as $key => $val) { | 
| 1186 | -            $content = str_replace("[" . $key . "]", $val, $content); | |
| 1186 | +            $content = str_replace("[".$key."]", $val, $content); | |
| 1187 | 1187 | } | 
| 1188 | 1188 | $content = nl2br($content); | 
| 1189 | 1189 | return $content; | 
| @@ -20,13 +20,13 @@ discard block | ||
| 20 | 20 | */ | 
| 21 | 21 | public function handle(OrderChangeStatus $event) | 
| 22 | 22 |      { | 
| 23 | -        if($event->order->shop->wholesale) { | |
| 23 | +        if ($event->order->shop->wholesale) { | |
| 24 | 24 | |
| 25 | 25 |              if ($event->status->send_email_to_customer) { | 
| 26 | 26 | |
| 27 | 27 |                  if ($event->status->orderStatusEmailTemplate) { | 
| 28 | 28 | |
| 29 | - $destinationPath = storage_path() . "/app"; | |
| 29 | + $destinationPath = storage_path()."/app"; | |
| 30 | 30 | $orderStatusEmailFromResult = GeneralSettingService::selectOneByShopIdAndName($event->order->shop_id, 'order-status-email-from'); | 
| 31 | 31 | |
| 32 | 32 | $orderStatusEmailFrom = '[email protected]'; | 
| @@ -44,12 +44,12 @@ discard block | ||
| 44 | 44 | |
| 45 | 45 | $orderStatusEmailBcc = '[email protected]'; | 
| 46 | 46 | $language = 'en'; | 
| 47 | -                    if(strtoupper($event->order->orderBillAddress->country) == 'NL') { | |
| 47 | +                    if (strtoupper($event->order->orderBillAddress->country) == 'NL') { | |
| 48 | 48 | $language = 'nl'; | 
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | 51 | |
| 52 | -                    Mail::send('frontend.email.order-status', ['content' => Cart::replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function ($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { | |
| 52 | +                    Mail::send('frontend.email.order-status', ['content' => Cart::replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { | |
| 53 | 53 | $message->from($orderStatusEmailFrom, $orderStatusEmailName); | 
| 54 | 54 | $message->to($event->order->client->email, $event->order->orderBillAddress->firstname)->subject(Cart::replaceTags($event->status->orderStatusEmailTemplate->translate($language)->subject, $event->order)); | 
| 55 | 55 | |
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 |                          if ($event->order and $event->status->attach_order_to_email) { | 
| 61 | 61 | $pdfText = ""; | 
| 62 | 62 | $sign = '€'; | 
| 63 | -                            if($event->order->client->usd) { | |
| 63 | +                            if ($event->order->client->usd) { | |
| 64 | 64 | $sign = '$'; | 
| 65 | 65 | } | 
| 66 | 66 | |
| @@ -83,9 +83,9 @@ discard block | ||
| 83 | 83 | } | 
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | -                if($event->order->type == 'pre_order') { | |
| 86 | +                if ($event->order->type == 'pre_order') { | |
| 87 | 87 | |
| 88 | -                }elseif($event->order->type == 'from_stock') { | |
| 88 | +                }elseif ($event->order->type == 'from_stock') { | |
| 89 | 89 | |
| 90 | 90 | } | 
| 91 | 91 | |
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 |          } else { | 
| 95 | 95 |              if ($event->status->send_email_to_customer) { | 
| 96 | 96 |                  if ($event->status->orderStatusEmailTemplate) { | 
| 97 | - $destinationPath = storage_path() . "/app"; | |
| 97 | + $destinationPath = storage_path()."/app"; | |
| 98 | 98 | $orderStatusEmailFromResult = GeneralSettingService::selectOneByShopIdAndName($event->order->shop_id, 'order-status-email-from'); | 
| 99 | 99 | |
| 100 | 100 | $orderStatusEmailFrom = '[email protected]'; | 
| @@ -117,11 +117,11 @@ discard block | ||
| 117 | 117 | } | 
| 118 | 118 | |
| 119 | 119 | $language = 'en'; | 
| 120 | -                    if(strtoupper($event->order->orderBillAddress->country) == 'NL') { | |
| 120 | +                    if (strtoupper($event->order->orderBillAddress->country) == 'NL') { | |
| 121 | 121 | $language = 'nl'; | 
| 122 | 122 | } | 
| 123 | 123 | |
| 124 | -                    Mail::send('frontend.email.order-status', ['content' => Cart::replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function ($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { | |
| 124 | +                    Mail::send('frontend.email.order-status', ['content' => Cart::replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { | |
| 125 | 125 | $message->from($orderStatusEmailFrom, $orderStatusEmailName); | 
| 126 | 126 | $message->to($event->order->client->email, $event->order->orderBillAddress->firstname)->subject(Cart::replaceTags($event->status->orderStatusEmailTemplate->translate($language)->subject, $event->order)); | 
| 127 | 127 | |