Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php

    /**
     * @package   Content-management
     * @author    Webagentur Niewerth <tiefland@weban.de>
     * @copyright 2012 Webagentur Niewerth
     * @license   propietary http://www.weban.de
     * @version   $Rev: 957 $
     * @filesource
     * 
     */

    /**
     * 
     * @package   Content-management
     * @author    Webagentur Niewerth <tiefland@weban.de>
     * @copyright 2012 Webagentur Niewerth
     */

    // SVN: $Id: getIceCatInfo.php 957 2012-02-23 08:22:43Z tiefland $

    require_once "../toolbox/common.php";
    $GLOBALS["ui"]->compile_id = "Online-Shop_artikel";
    require_once "Config.php";
    $roh = getIceCatInfo( $_GET["EAN"] );
    $cfg = new Config();
    $cfg = $cfg->parseConfig( $roh, "XML", array( "isFile" => false ) );
    $erg = $cfg->toArray();
    $xml = $erg["root"]["ICECAT-interface"]["Product"];
    if ( is_array( $xml["ProductDescription"] ) )
    {
        $beschreibung = $xml["ProductDescription"]["@"]["LongDesc"];
        $beschreibung = str_replace( '\n', "<br>", $beschreibung );
    }
    foreach ( $xml["CategoryFeatureGroup"] as $group )
    {
        $groups[$group["@"]["ID"]]["name"] = $group["FeatureGroup"]["Name"]["@"]["Value"];
    }
    foreach ( $xml["ProductFeature"] as $e_id => $eigenschaft )
    {
        $groups[$eigenschaft["@"]["CategoryFeatureGroup_ID"]]["sub"][$eigenschaft["Feature"]["Name"]["@"]["Value"]] =
            $eigenschaft["@"]["Presentation_Value"];
    }
    $GLOBALS["ui"]->assign( "roh_xml", htmlentities($roh) );
    $GLOBALS["ui"]->assign( "groups", $groups );
    $GLOBALS["ui"]->assign( "xml", $xml );
    $GLOBALS["ui"]->assign( "beschreibung", $beschreibung );
    $GLOBALS["ui"]->display( "getIceCatInfo.tpl" );

    function getIceCatInfo( $ean )
    {
        $web_settings = getWebSettings( array( 10001, 10002 ) );
        $url = "http://" . urlencode( $web_settings[10001] ) . ":" . urlencode( $web_settings[10002] ) .
            "@data.icecat.biz/xml_s3/xml_server3.cgi?ean_upc=$ean;lang=DE;output=productxml";
        $ret = file_get_contents( $url );
        return $ret;
    }
?>