• 16-05-2016, 12:16:49
    #1
    asd
  • 16-05-2016, 13:25:04
    #2
    bunu denemisin ?
    foreach ($IceriklerXML->urun as $urun)
    {
        var_dump($urun->xpath('Secenek')); 
    }

    burayı da incelersin.
    http://php.net/manual/tr/simplexmlelement.xpath.php
  • 16-05-2016, 14:10:24
    #3
    codefix adlı üyeden alıntı: mesajı görüntüle
    bunu denemisin ?
    foreach ($IceriklerXML->urun as $urun)
    {
        var_dump($urun->xpath('Secenek')); 
    }

    burayı da incelersin.
    http://php.net/manual/tr/simplexmlelement.xpath.php

    Hata verdi hocam. Hem php ile çekmek istediğimizde "
    .$urun->UrunSecenek->Secenek->StokKodu;" buraya ne yazıcaz 2. stokkodu için
  • 16-05-2016, 14:13:16
    #4
    JACKLA adlı üyeden alıntı: mesajı görüntüle
    Hata verdi hocam. Hem php ile çekmek istediğimizde "
    .$urun->UrunSecenek->Secenek->StokKodu;" buraya ne yazıcaz 2. stokkodu için
    aldığınız hata nedir ?
  • 16-05-2016, 14:20:26
    #5
    codefix adlı üyeden alıntı: mesajı görüntüle
    aldığınız hata nedir ?
    { } array(0) ... hatası veriyor hocam

    tam olarak:

    xml dosyası burada: www.xx.xml

    php dosyamın içeriği de bu şekilde.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>remixon stok güncelleme</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" charset='UTF-8'>
    <script type="text/javascript">
    
    function exportExcel() {
         var tableExport = document.getElementById('tableExport');
         var html = tableExport.outerHTML;
    
         while (html.indexOf('ç') != -1) html = html.replace('ç', '&ccedil;');
         while (html.indexOf('ğ') != -1) html = html.replace('ğ', 'ğ');
         while (html.indexOf('ı') != -1) html = html.replace('ı', 'ı');
         while (html.indexOf('ö') != -1) html = html.replace('ö', '&ouml;');
         while (html.indexOf('ş') != -1) html = html.replace('ş', 'ş');
         while (html.indexOf('ü') != -1) html = html.replace('ü', '&uuml;');
    
         while (html.indexOf('Ç') != -1) html = html.replace('Ç', '&Ccedil;');
         while (html.indexOf('Ğ') != -1) html = html.replace('Ğ', 'Ğ');
         while (html.indexOf('İ') != -1) html = html.replace('İ', 'İ');
         while (html.indexOf('Ö') != -1) html = html.replace('Ö', '&Ouml;');
         while (html.indexOf('Ş') != -1) html = html.replace('Ş', 'Ş');
         while (html.indexOf('Ü') != -1) html = html.replace('Ü', '&Uuml;');
    
         window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html));
    }
    
    </script>
    <script>
    function myFunction() {
        alert("hazırlanıyor");
    }
    </script>
    </head>
    <body>
    <button id="btnExport" onclick="exportExcel();">excele aktar</button> - <button id="" onclick="myFunction()"> gönder</button>
    
    
    
    
    
    <?
    
          $IceriklerXML = simplexml_load_file("http://www.remixon.com.tr/remixon.xml");
    	  
    	  	echo "<table id='tableExport' width='200' border='1'>";
      echo "<tr>";
        echo "<td>islem_tipi</td>";
        echo "<td>urun_kod</td>";
        echo "<td>stok_kodu</td>";
        echo "<td>ops_kodu_1</td>";
        echo "<td>ops_tanimi_1</td>";
        echo "<td>ops_kodu_2</td>";
        echo "<td>ops_tanimi_2</td>";
        echo "<td>barkod</td>";
        echo "<td>entegrasyon_kod</td>";
        echo "<td>ops_durum</td>";
        echo "<td>ops_stok_miktari</td>";
     echo " </tr>";
    	  
     
     
     
    foreach ($IceriklerXML->urun as $urun) 
    { 
        var_dump($urun->xpath('Secenek'));  
    
    	
    	
    	
      echo "<tr>";
        echo "<td>G</td>";
    	echo "<td>24-".$urun->UrunKodu;"</td>";
    	echo "<td>".$urun->UrunSecenek->Secenek->StokKodu;"</td>";
    	echo "<td></td>";
    	
        echo "<td>" .$urun->UrunSecenek->Secenek->EkSecenekOzellik->OzellikKodu. "" .$urun->UrunSecenek->Secenek->EkSecenekOzellik->OzellikDegeri; "</td>";
        echo "<td>ops_tanimi_1</td>";
        echo "<td>ops_kodu_2</td>";
        echo "<td>ops_tanimi_2</td>";
        echo "<td>barkod</td>";
        echo "<td>entegrasyon_kod</td>";
        echo "<td>ops_durum</td>";
        echo "<td>ops_stok_miktari</td>";
     echo " </tr>";
     
      echo "<tr>";
         echo "<td colspan='2'>&nbsp;</td>";
        echo " <td>".$urun->UrunSecenek->Secenek-Secenek->StokKodu;"</td>";
        echo " <td colspan='12'>&nbsp;</td>";
      echo " </tr>";
     
     
    }
     echo "</table>";
    
            ?>
  • 16-05-2016, 14:35:45
    #6
    buyrun.

    <?
     
    $content = utf8_encode(file_get_contents('remixon.xml'));
    $xml     = simplexml_load_string($content);
    foreach ($xml->urun as $urun)
    {
        $secenekler = $urun->xpath('UrunSecenek');
    	foreach($secenekler as $secenek)
    	{	
    		foreach($secenek->Secenek as $val)
    		{
    			//var_dump($val);
    			echo $val->StokKodu;
    		}
    	}	
    }
  • 16-05-2016, 15:16:48
    #7
    codefix adlı üyeden alıntı: mesajı görüntüle
    buyrun.

    <?
     
    $content = utf8_encode(file_get_contents('remixon.xml'));
    $xml     = simplexml_load_string($content);
    foreach ($xml->urun as $urun)
    {
        $secenekler = $urun->xpath('UrunSecenek');
    	foreach($secenekler as $secenek)
    	{	
    		foreach($secenek->Secenek as $val)
    		{
    			//var_dump($val);
    			echo $val->StokKodu;
    		}
    	}	
    }
    Eline sağlık hocam,

    ancak 3 tane stok kodu varsa 2. sini yazmıyor. td'yi çoğalttığımda ise aynısını yazdırıyor?

    <?
    
      
    $content = utf8_encode(file_get_contents('r.xml')); 
    $xml     = simplexml_load_string($content); 
    
    
    
    	  
    	  	echo "<table id='tableExport' width='200' border='1' datapagesize='10'>";
      echo "<tr>";
        echo "<td>islem_tipi</td>";
        echo "<td>urun_kod</td>";
        echo "<td>stok_kodu</td>";
        echo "<td>ops_kodu_1</td>";
        echo "<td>ops_tanimi_1</td>";
        echo "<td>ops_kodu_2</td>";
        echo "<td>ops_tanimi_2</td>";
        echo "<td>barkod</td>";
        echo "<td>entegrasyon_kod</td>";
        echo "<td>ops_durum</td>";
        echo "<td>ops_stok_miktari</td>";
     echo " </tr>";
    	  
     
     
    foreach ($xml->urun as $urun) 
    { 
        $secenekler = $urun->xpath('UrunSecenek'); 
        foreach($secenekler as $secenek) 
            
            foreach($secenek->Secenek as $val) 
           
        
    
    
    	
    	
    	
      echo "<tr>";
        echo "<td>G</td>";
    	echo "<td>24-".$urun->UrunKodu;"</td>";
    	echo "<td>".$urun->UrunSecenek->Secenek->StokKodu;"</td>";
    	
        echo "<td>" .$urun->UrunSecenek->Secenek->EkSecenekOzellik->OzellikKodu. "" .$urun->UrunSecenek->Secenek->EkSecenekOzellik->OzellikDegeri; "</td>";
        echo "<td>ops_tanimi_1</td>";
        echo "<td>ops_kodu_2</td>";
        echo "<td>ops_tanimi_2</td>";
        echo "<td>barkod</td>";
        echo "<td>entegrasyon_kod</td>";
        echo "<td>ops_durum</td>";
        echo "<td>ops_stok_miktari</td>";
     echo " </tr>";
    
     
     
     echo " <tr>";
         echo "<td colspan='2'>&nbsp;</td>";
         echo "<td>"  .$val->StokKodu; "</td>";
        echo " <td colspan='12'>&nbsp;</td>";
      echo " </tr>";
       
     echo " <tr>";
         echo "<td colspan='2'>&nbsp;</td>";
         echo "<td>"  .$val->StokKodu; "</td>";
        echo " <td colspan='12'>&nbsp;</td>";
      echo " </tr>";
      
      
      
      
    
     
    }
     echo "</table>";
    
            ?>
  • 16-05-2016, 15:44:49
    #8
    kardeşim data bu şekilde sen tablonu yanlış hazırlıyorsun onu gözden geçirmeni tavsiye ederim.

    foreach ($xml->urun as $urun)
    {
    	echo "Ürün Kodu : ".$urun->UrunKodu; 
            $secenekler = $urun->xpath('UrunSecenek');
    	foreach($secenekler as $secenek)
    	{
    		foreach($secenek->Secenek as $val)
    		{
    			echo $val->StokKodu."<br />";
    		}
    		echo "<hr>";
    	}	
    }