Keresés

Új hozzászólás Aktív témák

  • DiabloCorsa

    őstag

    válasz Sk8erPeter #18161 üzenetére

    Itt tartok:

    $xml = simplexml_load_string($nombreFichero, 'SimpleXMLElement', LIBXML_NOCDATA);

    Evvel kapok ilyet:

    SimpleXMLElement Object ( [product] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [code] => ce0101000499090 [generic] => 01010004 [title] => JAY kombinålt kesztyŹ sårga kÊk - 9 [totalDispo] => 0 [unit] => PÁR ) [detail] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [dispo] => 0 [site] => Budapest ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [dispo] => 1 000 - 2 999 [site] => KÜzponti raktår ) ) ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [code] => 0101000499100 [generic] => 01010004 [title] => JAY kombinålt kesztyŹ - 10 [totalDispo] => 10 - 29 [unit] => PÁR ) [detail] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [dispo] => 10 - 29 [site] => Budapest ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [dispo] => 5 000 - 9 999 [site] => KÜzponti raktår ) ) ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [code] => 0101000499110 [generic] => 01010004 [title] => JAY komb. kesztyŹ sårga piros -11 [totalDispo] => 0 [unit] => PÁR ) [detail] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [dispo] => 0 [site] => Budapest ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [dispo] => 10 000 - 19 999 [site] => KÜzponti raktår ) ) ) ) ) )

    Ebből mi lesz a változója pl. a ce0101000499090 értéknek

    ( SimpleXMLElement Object ( [@attributes] => Array ( [code] => ce0101000499090

  • DiabloCorsa

    őstag

    válasz Sk8erPeter #18161 üzenetére

    Nem jön össze.

    Az első példámat feldolgozom így:

    function tep_xml_sincron($nombreFichero = '') {
    $ruta_remota = "../temp/pasztoy.xml";

    $nombreFichero = file_get_contents($ruta_remota);
    if (!$xml = simplexml_load_string($nombreFichero)) {
    exit;
    }
    $array_general = array();
    $contador_no_id = 0;
    foreach($xml as $prod) {
    $prod_name = trim($prod->CONF_NOMBRE);
    $prod_name = str_replace($ant,$desp,$prod_name);
    $sub_mod = $id_gama . '-' . $id_subgama . '-' . $subgama_name . '-' . $prod_name;
    if (!array_key_exists("$sub_mod", $array_general)) {
    $products_model_akh = trim($prod->[B]KOD[/B]);
    $products_kod_akh = $prod->[B]KOD2[/B];
    tep_db_perform(TABLE_PRODUCTS, array(
    'products_model_akh' => $products_model_akh,
    'products_kod_akh' => $products_kod_akh,
    'products_last_modified' => strftime(DATE_TIME_FORMAT)
    ), 'update', 'products_model_akh=\''.$products_model_akh.'\'');

    }
    }
    return 1;
    }

    Ehhez ez az XML tartlama:

    <gumi>
    <KOD>13580R13TK706</KOD>
    <KOD2>1003118</KOD2>
    </gumi>

    A kapott érték: 13580R13TK706, 1003118

    Amit kérdeztem az példa után is ............sötét.

    Ezt kéne 'kihámozni':

    <product code="0101000499090" generic="01010004" title="JAY kombinált - 9" totalDispo="0" unit="PÁR">
    <detail dispo="0" site="Budapest"/>
    <detail dispo="1 000 - 2 999" site="Központi raktár"/>
    </product>

    Itt NINCS külön < > között a kerssett adat.

    Ez van: <product code="0101000499090" generic="01010004" title="JAY kombinált - 9" totalDispo="0" unit="PÁR">

    Ebből kell a code, stb...

Új hozzászólás Aktív témák

Hirdetés