Subversion-Projekte lars-tiefland.ci

Revision

Revision 528 | Revision 721 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * @author Lars Tiefland
 * @copyright 2016
 */

/**
 * Shop
 * 
 * erstellt die Startseite für den Shop
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id: Shop.php 720 2016-09-30 19:32:26Z lars $
 * @access public
 */
class Shop extends CI_Controller
{

        /**
         * Shop::__construct()
         * 
         * @return
         */
        public function __construct()
        {
                parent::__construct();
                $this->load->model('Aktion_model', 'aktion');
                if (ENVIRONMENT == "production")
                {
                        $this->output->cache(120);
                }
        }
        /**
         * Shop::index()
         * 
         * @return
         */
        public function index()
        {
                $aktion = $this->aktion->get_cur_aktion();
                $this->smarty->assign('title', $GLOBALS['INI']['title']['standard'].' - '.$GLOBALS['INI']['titel_only']);
                $this->smarty->assign('aktion', $aktion);
                $this->smarty->view('start.tpl');
        }

        public function update_session()
        {
                trigger_error(var_export($_POST, true), E_USER_WARNING);
                if ($_POST["thirdPartyPaymentMethod"])
                {
                        $versandOptionen = getVersandItems();
                        foreach ($versandOptionen as $opt)
                        {
                                $method = $_POST["thirdPartyPaymentMethod"];
                                if (substr($opt["kurz"], 0, 25) == $method)
                                {
                                        $VersandItem = array(
                                                "Menge" => 1,
                                                "ID" => $opt["ID"],
                                                "Versand" => true,
                                                "rufname" => $vItem["short_line_1"],
                                                "preis" => $opt["preis"],
                                                );
                                        $_SESSION['SHOP']["VERSAND"] = $VersandItem;
                                        $_SESSION["SHOP"]["SUMMEINCVERSAND"] = $_SESSION["SHOP"]["SUMME"] + $opt["preis"];
                                        $_SESSION["SHOP"]["buy"]["Versand"] = true;
                                        break;
                                }
                        }
                }
                else
                {
                        $versandOptionen = getVersandItems();
                        foreach ($versandOptionen as $opt)
                        {
                                $method = "PayPalPlus";
                                if ($opt["rufname"] == $method)
                                {
                                        $VersandItem = array(
                                                "Menge" => 1,
                                                "ID" => $opt["ID"],
                                                "Versand" => true,
                                                "rufname" => $vItem["short_line_1"],
                                                "preis" => $opt["preis"],
                                                );
                                        $_SESSION['SHOP']["VERSAND"] = $VersandItem;
                                        $_SESSION["SHOP"]["SUMMEINCVERSAND"] = $_SESSION["SHOP"]["SUMME"] + $opt["preis"];
                                        $_SESSION["SHOP"]["buy"]["Versand"] = true;
                                        break;
                                }
                        }
                }

                if ($_POST["ts"])
                {
                        $rufname = $vItem["short_line_1"];
                        $tsID = $_POST["ts"];
                        $max = $GLOBALS["tsItems"][$tsID]["max"];
                        $preis = $GLOBALS["tsItems"][$tsID]["preis"] * 1.19;
                        $preis = sprintf("%.02f", $preis);
                        //admin_debug($preis,true);
                        $buf = array(
                                "ID" => 999999,
                                "kurzbezeichnung" => utf8_encode("Käuferschutz bis ".$max." EUR (".$preis.
                                        " EUR inkl. MwSt)"),
                                "Menge" => 1,
                                "preis" => $preis,
                                "product" => $tsID,
                                "basketItemSumme" => $preis,
                                "method" => $GLOBALS["tsMethods"][$rufname],
                                "ts" => true,
                                );
                        $_SESSION["SHOP"]["BASKET"][] = $buf;

                }
        }
}

?>