Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 873 | Revision 876 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 873 Revision 874
Zeile 5... Zeile 5...
5
    use Illuminate\Http\Request;
5
    use Illuminate\Http\Request;
6
    use Illuminate\Support\Facades\DB;
6
    use Illuminate\Support\Facades\DB;
Zeile 7... Zeile 7...
7
 
7
 
8
    class ShippingController extends Controller
8
    class ShippingController extends Controller
9
    {
9
    {
10
        public function getShippingOptions( ?int $Land = 47 ): array
10
        public function getShippingOptions(): array|bool
-
 
11
        {
-
 
12
            $Land = 47;
-
 
13
            if ( isset( $_GET["Land"] ) )
-
 
14
            {
-
 
15
                $Land = $_GET["Land"];
-
 
16
                $param = "single";
11
        {
17
            }
12
            $buffer = array();
18
            $buffer = array();
13
            $rufnamen = array();
19
            $rufnamen = array();
14
            $sql = "SELECT
20
            $sql = "SELECT
15
                    z.id,
21
                    z.id,
Zeile 134... Zeile 140...
134
                    $shippingIds[] = $vRow->id;
140
                    $shippingIds[] = $vRow->id;
135
                    if ( $vRow->additions )
141
                    if ( $vRow->additions )
136
                    {
142
                    {
137
                        $vRow->additions = unserialize( $vRow->additions );
143
                        $vRow->additions = unserialize( $vRow->additions );
138
                    }
144
                    }
139
                }
-
 
Zeile 140... Zeile 145...
140
 
145
 
141
                /*if ( $param == "single" )
-
 
142
                {
-
 
143
                    if ( $vRow->name && $_SESSION['SHOP']['BASKET']->paymentInfo["Total"] )
146
                    if ( $param == "single" )
-
 
147
                    {
-
 
148
                        if ( $vRow->name && $_SESSION['SHOP']['BASKET']->paymentInfo["Total"] )
144
                    {
149
                        {
145
                        $summeInklVersand = $vRow->price + $_SESSION['SHOP']['BASKET']->paymentInfo["Total"];
150
                            $summeInklVersand = $vRow->price + $_SESSION['SHOP']['BASKET']->paymentInfo["Total"];
146
                        $vkSummeLaender['price'] = $vRow->price;
151
                            $vkSummeLaender['price'] = $vRow->price;
147
                        $vkSummeLaender['name'] = $vRow->name;
152
                            $vkSummeLaender['name'] = $vRow->name;
148
                        $fmt = new NumberFormatter( "de_DE.UTF-8", NumberFormatter::CURRENCY );
153
                            $fmt = new NumberFormatter( "de_DE.UTF-8", NumberFormatter::CURRENCY );
149
                        $vkSummeLaender['price_formatted'] = $fmt->formatCurrency( $vRow->price, "EUR" );
154
                            $vkSummeLaender['price_formatted'] = $fmt->formatCurrency( $vRow->price, "EUR" );
150
                        $vkSummeLaender['summe_formatted'] = $fmt->formatCurrency( $summeInklVersand, "EUR" );
155
                            $vkSummeLaender['summe_formatted'] = $fmt->formatCurrency( $summeInklVersand, "EUR" );
151
                    }
156
                        }
152
                    else
157
                        else
153
                    {
158
                        {
154
                        echo "<div class=''>Fehler: Keine Versandart gefunden!</div>\n";
159
                            echo "<div class=''>Fehler: Keine Versandart gefunden!</div>\n";
Zeile 155... Zeile 160...
155
                    }
160
                        }
-
 
161
 
156
 
162
 
Zeile 157... Zeile 163...
157
 
163
                        return true;
158
                    return true;
164
                    }
159
                }*/
165
                }
160
 
166
 
Zeile 374... Zeile 380...
374
                }
380
                }
375
                ksort( $buffer );
381
                ksort( $buffer );
376
            }
382
            }
377
            return $buffer;
383
            return $buffer;
378
        }
384
        }
-
 
385
 
-
 
386
        public function updateShipping()
-
 
387
        {
-
 
388
            if ( $_GET['param'] == "single" )
-
 
389
            {
-
 
390
                $_SESSION['versand_laenderauswahl'] = $_GET['Land'];
-
 
391
            }
-
 
392
 
-
 
393
            if ( $_GET["Land"] )
-
 
394
            {
-
 
395
                if ( $_SESSION["SHOP"]["Lieferadresse"] !== "false" )
-
 
396
                {
-
 
397
                    $_SESSION['SHOP']['buy']['Persdata']['liefer_Land'] = $_GET["Land"];
-
 
398
                }
-
 
399
                else
-
 
400
                {
-
 
401
                    $_SESSION['SHOP']['buy']['Persdata']['Land'] = $_GET["Land"];
-
 
402
                }
-
 
403
            }
-
 
404
            /*trigger_error( $_GET["Land"] );
-
 
405
            trigger_error( $_SESSION['SHOP']['buy']['Persdata']['liefer_Land'] );
-
 
406
            trigger_error( $_SESSION['SHOP']['buy']['Persdata']['Land'] );*/
-
 
407
 
-
 
408
            if ( $_GET["packstation"] == 1 )
-
 
409
            {
-
 
410
                $_SESSION['SHOP']['buy']['Persdata']['liefer_Land'] = 1;
-
 
411
            }
-
 
412
            $pppVersand = "";
-
 
413
            if ( isset( $_SESSION["SHOP"]["BASKET"]->items ) )
-
 
414
            {
-
 
415
                $this->getShippingOptions();
-
 
416
                $versandOptionen = $_SESSION["SHOP"]["BASKET"]->shipmentCosts;
-
 
417
                $v_opt = array();
-
 
418
                $wunschzustellung = 0;
-
 
419
                if ( is_countable( $versandOptionen ) )
-
 
420
                {
-
 
421
                    $oId = 0;
-
 
422
                    foreach ( $versandOptionen as $o_id => $opt )
-
 
423
                    {
-
 
424
                        if ( $opt->internal_name == "amazon" || $opt->internal_name == "PayPalExpress" || $opt->internal_name == "klarna" )
-
 
425
                        {
-
 
426
                            continue;
-
 
427
                        }
-
 
428
                        elseif ( $_GET["packstation"] == 1 && !stristr( $opt->kurz, "DHL" ) )
-
 
429
                        {
-
 
430
                            continue;
-
 
431
                        }
-
 
432
                        /*if ( $_GET["kurier"] == 1 && ( $opt->express != 1 || stristr( $opt->kurz, "selbstabholung" ) ) )
-
 
433
                        {
-
 
434
                            continue;
-
 
435
                        }*/
-
 
436
                        if ( !key_exists( "beschr", $opt ) )
-
 
437
                        {
-
 
438
                            $opt["beschr"] = $opt["beschreibung"];
-
 
439
                        }
-
 
440
                        $opt['beschr'] = str_replace( "\r\n", "<br>", $opt['beschr'] );
-
 
441
 
-
 
442
                        if ( ( isset( $_SESSION["SHOP"]["buy"]["Versand_selected"] ) && $_SESSION["SHOP"]["buy"]["Versand_selected"] == $opt["ID"] ) || ( !isset( $_SESSION["SHOP"]["buy"]["Versand_selected"] ) && $oId == 0 ) )
-
 
443
                        {
-
 
444
                            $opt["checked"] = 'checked="checked"';
-
 
445
                        }
-
 
446
                        $wunschzustellung = 0;
-
 
447
                        if ( $GLOBALS["INI"]["modules"]["versandgruppen"] == 1 && $GLOBALS["INI"]["wunschzustellung"]["aktiv"] == 1 )
-
 
448
                        {
-
 
449
                            $wzVersandGruppen = array();
-
 
450
                            if ( isset( $GLOBALS["INI"]["wunschzustellung"]["versandgruppen"] ) && $GLOBALS["INI"]["wunschzustellung"]["versandgruppen"] )
-
 
451
                            {
-
 
452
                                $wzVersandGruppen = explode( ",", $GLOBALS["INI"]["wunschzustellung"]["versandgruppen"] );
-
 
453
                            }
-
 
454
                            if ( in_array( $opt["versandgruppe"], $wzVersandGruppen ) || !$wzVersandGruppen )
-
 
455
                            {
-
 
456
                                $wunschzustellung = 1;
-
 
457
                            }
-
 
458
                        }
-
 
459
                        $v_opt[] = $opt;
-
 
460
                        $oId++;
-
 
461
                    }
-
 
462
                    /*$GLOBALS["ui"]->assign( "wunschzustellung", $wunschzustellung );
-
 
463
                    $GLOBALS["ui"]->assign( "versandOptionen", $v_opt );*/
-
 
464
                    \View::share( "wunschzustellung", $wunschzustellung );
-
 
465
                    \View::share( "versandOptionen", $v_opt );
-
 
466
                }
-
 
467
                if ( $GLOBALS["INI"]["PayPalPlus"]["aktiv"] != 1 && $GLOBALS["INI"]["klarna"]["aktiv"] != 1 && $GLOBALS["INI"]["PayPalCheckout"]["aktiv"] != 1 )
-
 
468
                {
-
 
469
                    return view( "update_versand" );
-
 
470
                }
-
 
471
                elseif ( $GLOBALS["INI"]["weban_vk"]["aktiv"] == 1 && $_SESSION["is_b2b"] == 1 )
-
 
472
                {
-
 
473
                    if ( is_array( $versandOptionen ) )
-
 
474
                    {
-
 
475
                        foreach ( $versandOptionen as $o_id => $opt )
-
 
476
                        {
-
 
477
                            if ( strtolower( $opt["rufname"] ) == "paypalplus" || strtolower( $opt["rufname"] ) == "klarna" || strtolower( $opt["rufname"] ) == "paypalcheckout" )
-
 
478
                            {
-
 
479
                                $pppVersand = $opt["ID"];
-
 
480
                                break;
-
 
481
                            }
-
 
482
                        }
-
 
483
                        if ( $_GET["Land"] || $_GET["liefer"] )
-
 
484
                        {
-
 
485
                            echo $pppVersand;
-
 
486
                        }
-
 
487
                        else
-
 
488
                        {
-
 
489
                            \View::share( "ppplusVersand", $pppVersand );
-
 
490
                        }
-
 
491
                    }
-
 
492
                }
-
 
493
                else
-
 
494
                {
-
 
495
                    if ( $_SESSION["SHOP"]["hash"] )
-
 
496
                    {
-
 
497
                        $thirdPartyMethods = array();
-
 
498
                        $customMethods = array(
-
 
499
                            "vorkasse",
-
 
500
                            "selbstabholung",
-
 
501
                            "ratenzahlung",
-
 
502
                            "nachnahme",
-
 
503
                            "sofortueberweisung",
-
 
504
                        );
-
 
505
                        $buy_link_base = $GLOBALS["INI"]["absoluteURL"];
-
 
506
                        $buy_link_base = str_replace( "http:", "https:", $buy_link_base );
-
 
507
                        $url = $buy_link_base . "/bestellen_seite_2.html";
-
 
508
                        $methodNameField = "kurz";
-
 
509
                        if ( $GLOBALS["INI"]["PayPalPlus"]["methodNameField"] )
-
 
510
                        {
-
 
511
                            $methodNameField = $GLOBALS["INI"]["PayPalPlus"]["methodNameField"];
-
 
512
                        }
-
 
513
                        foreach ( $versandOptionen as $o_id => $opt )
-
 
514
                        {
-
 
515
                            $rufname = strtolower( $opt["rufname"] );
-
 
516
                            $opt["beschr"] = $opt["beschreibung"];
-
 
517
                            if ( in_array( $rufname, $customMethods ) )
-
 
518
                            {
-
 
519
                                if ( $methodNameField == "rufname" )
-
 
520
                                {
-
 
521
                                    $methodName = $GLOBALS["rufnamen"][$opt[$methodNameField]];
-
 
522
                                }
-
 
523
                                else
-
 
524
                                {
-
 
525
                                    $methodName = $opt["kurz"];
-
 
526
                                }
-
 
527
                                $method = array(
-
 
528
                                    "redirectUrl" => $url,
-
 
529
                                    "methodName"  => $methodName,
-
 
530
                                    "description" => $opt["beschr"],
-
 
531
                                );
-
 
532
                                $imgBase = "/images/webelemente/versand_";
-
 
533
                                $imgName = $imgBase . $rufname . ".jpg";
-
 
534
                                $imgUrl = "https://" . $_SERVER["SERVER_NAME"] . $imgName;
-
 
535
                                $imgNameFull = $_SERVER["DOCUMENT_ROOT"] . $imgName;
-
 
536
                                if ( $GLOBALS["INI"]["ssl_buy"] == 1 )
-
 
537
                                {
-
 
538
                                    if ( file_exists( $imgNameFull ) )
-
 
539
                                    {
-
 
540
                                        $method["imageUrl"] = $imgUrl;
-
 
541
                                    }
-
 
542
                                }
-
 
543
                                $thirdPartyMethods[] = $method;
-
 
544
                            }
-
 
545
                        }
-
 
546
                        $payPal3rdParty = json_encode( $thirdPartyMethods );
-
 
547
                        require_once "module/creditcard/paypalPlus.php";
-
 
548
                        $c = new paypalPlus();
-
 
549
                        $apporvalUrl = $c->getCreditcardStatus( null );
-
 
550
 
-
 
551
                        $GLOBALS["ui"]->assign( "paymentMethods", $payPal3rdParty );
-
 
552
                        $GLOBALS["ui"]->assign( "approvalUrl", $apporvalUrl );
-
 
553
                        if ( $_GET['account'] )
-
 
554
                        {
-
 
555
                            $GLOBALS["ui"]->assign( "account", "?account=" . $_GET['account'] );
-
 
556
                        }
-
 
557
 
-
 
558
 
-
 
559
                    }
-
 
560
                    if ( is_array( $versandOptionen ) )
-
 
561
                    {
-
 
562
                        foreach ( $versandOptionen as $o_id => $opt )
-
 
563
                        {
-
 
564
                            if ( strtolower( $opt->internal_name ) == "paypalplus" || strtolower( $opt->internal_name ) == "klarna" || strtolower( $opt->internal_name ) == "paypalcheckout" )
-
 
565
                            {
-
 
566
                                $pppVersand = $opt->id;
-
 
567
                                break;
-
 
568
                            }
-
 
569
                        }
-
 
570
                        if ( $_GET["Land"] || $_GET["liefer"] )
-
 
571
                        {
-
 
572
                            echo $pppVersand;
-
 
573
                        }
-
 
574
                        else
-
 
575
                        {
-
 
576
                            \View::share( "ppplusVersand", $pppVersand );
-
 
577
                        }
-
 
578
                    }
-
 
579
                }
-
 
580
            }
-
 
581
        }
379
    }
582
    }