<?php
//  Copyright (c) 2004-2014 randshop
//  http://www.randshop.com
//
//  Unter Lizenz von randshop
//	
//	Letzte Bearbeitung: 12.05.2014


	session_start();

	// Hauptkonfigurationsdatei
	include_once("../../conf/config.inc.php");
	include_once(DATEIPFAD . "conf/db.inc.php");
	include_once(DATEIPFAD . "includes/shopinitialize.inc.php");
    include_once(DATEIPFAD . "includes/functions.mod.kundengruppen.inc.php");
	include_once(DATEIPFAD . "includes/functions.artikel.inc.php");
    include_once(DATEIPFAD . "includes/functions.merkmale.inc.php");
	include_once(DATEIPFAD . "includes/functions.kategorie.inc.php");
    include_once(DATEIPFAD . "includes/functions.versandart.inc.php");
    include_once(DATEIPFAD . "includes/functions.waehrung.inc.php");
	//Sessionregister
	include_once(DATEIPFAD . "includes/session_register.inc.php");
	include_once(DATEIPFAD . "includes/functions.global.inc.php");
	//Spracheninclude
	if (@fopen(DATEIPFAD . "includes/language/langu_" . $_SESSION["languageisocode"] . ".inc.php",r)) {
		include_once(DATEIPFAD . "includes/language/langu_" . $_SESSION["languageisocode"] . ".inc.php");
    } else {
	    include_once(DATEIPFAD . "includes/language/langu_de.inc.php");
    }	

if($katId == "") {
	$_SESSION['kat'] = "";
}
	// Header
	include_once(DATEIPFAD . "includes/header.inc.php");
	
	
if(!$_GET["menueId"]) {
	$_GET["menueId"] = $_POST["menueId"];
}

$tpl_menueId = $_GET["menueId"];
	
$GetMenueObject = GetMenueDetails($_GET["menueId"], $_SESSION["languageid"]);

// Abfrage nach Online Status
if($GetMenueObject->aktiv == "1") {

    $tpl_topnaviName = $GetMenueObject->headline;
    if($GetMenueObject->bigImage != "") {
        if(file_exists("../../images/dbimages/" . $GetMenueObject->bigImage)) 	{
            $imageSize = getimagesize("../../images/dbimages/" . $GetMenueObject->bigImage);
            $tpl_topImage =  "<img src=\"../../images/dbimages/" . $GetMenueObject->bigImage . "\" width=\"" . $imageSize[0] . "\" height=\"" . $imageSize[1] . "\" border=\"0\" align=\"left\">\n";
        }
    }
    $tpl_topEintrag = stripslashes($GetMenueObject->textEintrag) . "\n";


    $WaehrungsObject = GetWaehrungDetail();
    
    //var_dump($_SESSION);
    
    $VersandartenDataArray = GetVersandartenArray($_SESSION["languageid"]);

    foreach ($VersandartenDataArray as &$VersandartenData) {

        $VersandartObject = GetVersandartDetail($VersandartenData["id"], $_SESSION["languageid"]);
        
        $VersandartenData["gewichte"] = $VersandartObject->GewichtArray;
        $VersandartenData["laendergruppeid"] = $VersandartObject->laendergruppeid;

        if ($VersandartObject->laendergruppeid) {
            $SQLString = "SELECT ";
            //$SQLString .= "* ";
            $SQLString .= TABLE_LAENDERGRUPPERELATION . ".landid, ";
            $SQLString .= TABLE_LAENDERGRUPPERELATION . ".laendergruppeid, ";
            $SQLString .= TABLE_LAND_LANGU . ".name ";
            $SQLString .= "FROM ";
            $SQLString .= TABLE_LAND . " ";
            $SQLString .= "LEFT JOIN " . TABLE_LAENDERGRUPPERELATION . " ON id = landid AND laendergruppeid = " . $VersandartObject->laendergruppeid . " OR laendergruppeid IS NULL ";
            $SQLString .= "LEFT JOIN " . TABLE_LAND_LANGU . " ON ((" . TABLE_LAND . ".id = " . TABLE_LAND_LANGU . ".land_id) AND (" . TABLE_LAND_LANGU . ".language_id = " . GetDefaultLanguageID() . "))";
            $SQLString .= "ORDER BY " . TABLE_LAND_LANGU . ".name";
            $LandReference = errorlogged_mysql_query($SQLString);

            while($LandObject = mysql_fetch_object($LandReference)) {
                if (!is_null($LandObject->laendergruppeid)) {
                    $VersandartenData["laender"] .= $LandObject->name . ", ";
                }
            }
        } else {
            $VersandartenData["laender"] = $VersandartenData["landname"];
        }
        
        
        
            
                
            
        // Zebrastreifenmuster 
        if($background == "") {
            $VersandartenData["zebrastreifen"] = "class=\"tdBackground2\"";
        } else {
            $VersandartenData["zebrastreifen"] = "";
        }
        
    }    
    
    
        
        
    $contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/topnavi/versandkosteninfo.tpl";
        
} else { // Ende Abfrage onlinestatus 
	$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/kein_inhalt.tpl";
}

// Letzte globale Zusammenfassung z.B. fuer Warenkorbanzeige, bevor das Template geladen wird.
include_once(DATEIPFAD . "includes/footer.inc.php");


// Template
if($mobilestyle) {
    include_once(DATEIPFAD . "templates/" . $rowTemp->name . "/mobile/layout.phtml");
} else {
    include_once(DATEIPFAD . "templates/" . $rowTemp->name . "/website/index.tpl");
}

	
@mysql_close($db);