Revision 703 | Revision 715 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?php/*** @author Lars Tiefland* @copyright 2016*//*** Basket** Anzeige und Überarbeitung des Warenkorbs** @package WebanOS CI* @author Lars Tiefland* @copyright 2016* @version $Id: Basket.php 714 2016-09-29 17:51:19Z lars $* @access public*/class Basket extends CI_Controller{/*** Basket::__construct()** @return*/public function __construct(){parent::__construct();$this->load->model('artikel_model', 'artikel');if (!@is_array($_SESSION['SHOP']['BASKET'])){$_SESSION['SHOP']['BASKET'] = array();$_SESSION['SHOP']['MWST'] = array();$_SESSION['SHOP']['SUMME'] = 0;}$GLOBALS['order_db'] = $this->load->database('order_db', TRUE);$GLOBALS['db_red'] = $this->load->database('db_red', TRUE);}/*** Basket::add()** @return*/public function add(){$landID = 47;if (isset($_SESSION['SHOP']['buy']["Persdata"]["liefer_land"])){if (isset($GLOBALS["steuern"][$_SESSION['SHOP']['buy']["Persdata"]["liefer_land"]])){$landID = $_SESSION['SHOP']['buy']["Persdata"]["liefer_land"];}elseif (isset($GLOBALS["INI"]["steuern"]["default_countryID"])){$landID = $GLOBALS["INI"]["steuern"]["default_countryID"];}}elseif (isset($GLOBALS["INI"]["steuern"]["default_countryID"])){$landID = $GLOBALS["INI"]["steuern"]["default_countryID"];}$id_arr = array('ID' => $this->input->post('item'), );$id = implode('-', $id_arr);$item = $this->artikel->get_artikel($this->input->post('item'), true);$menge = $this->input->post('Menge');if (isset($_SESSION['SHOP']['BASKET'][sha1($id)])){$menge += $_SESSION['SHOP']['BASKET'][sha1($id)]['Menge'];}$item = array_merge($item, array('Menge' => $menge,'preis' => $this->input->post('preis'),//'kurzbezeichnung' => $this->input->post('kurzbezeichnung'),));$itemTax = (isset($item["tax1"]) && $item["tax1"] != "") ? $item["tax1"] : 0;$mwst = $GLOBALS["steuern"][$landID][$itemTax];//admin_debug($_SESSION['SHOP'], true);//$_SESSION["netto_preis"] ist gesetzt wenn ein Kunde sich einlogt und dieser zu einer Kundengruppe die in der// Ini gesetzt ist angeh�rt und dort das Flag netto_preis aktiviert ist.if ((isset($GLOBALS["INI"]["netto_preise"]) && $GLOBALS["INI"]["netto_preise"] ==1) || (isset($_SESSION["netto_preis"]) && $_SESSION["netto_preis"] == true)){$mwst = $item['Menge'] * $item['preis'] * $mwst / 100;}else{$mwst = $item['Menge'] * $item['preis'] / (100 + $mwst) * $mwst;}$_SESSION['SHOP']["MWST"][$GLOBALS["steuern"][$landID][$itemTax]] += $mwst;//trigger_error(var_export($this->input->post(), true), E_USER_WARNING);$_SESSION['SHOP']['BASKET'][sha1($id)] = $item;$_SESSION['SHOP']['SUMME'] += $item["preis"];$_SESSION['SHOP']['MWSTVONSUMME'] = array_sum($_SESSION['SHOP']['MWST']);$this->smarty->view('header_wk.tpl');}/*** Basket::update()** @param mixed $bId* @param integer $menge* @param integer $preis* @return*/public function update($bId, $menge = 1, $preis = 0){$_SESSION['SHOP']['BASKET'][$bId]['Menge'] = $menge;header("Location:/basket.html");}/*** Basket::delete()** @param mixed $bId* @return*/public function delete($bId){$item = $_SESSION['SHOP']['BASKET'][$bId];$_SESSION['SHOP']['SUMME'] -= ($item["Menge"] * $item["preis"]);unset($_SESSION['SHOP']['BASKET'][$bId]);header("Location:/basket.html");}/*** Basket::index()** @return*/function index(){$this->smarty->view('login_center.tpl');}}?>