Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:19:00+00:00 2026-06-17T19:19:00+00:00

I have to convert XML file from my supplyer to CSV version (for Magento

  • 0

I have to convert XML file from my supplyer to CSV version (for Magento Store).

I wrote simple php script to do that, but I cant figure it out why its not working (i have other supplyers, but their XML version is much simpler.

But to the point:

Im have this XML

<pasaz:Envelope xmlns:pasaz="http://schemas.xmlsoap.org/soap/envelope/">
    <pasaz:Body>
        <loadOffers xmlns="urn:ExportB2B">
            <offers>
                <offer>
                    <id>9</id>
                    <name>
                        <![CDATA[ Luneta celownicza Light Stream 4,5-14x44 30 mm AO ]]>
                    </name>
                    <price>2299</price>
                    <url>
                        <![CDATA[
http://kolba.pl/luneta-celownicza-light-stream-4-5-14x44-30-mm-ao-p9.html
]]>
                    </url>
                    <categoryId>
                        <![CDATA[ Lunety wiatrówkowe ]]>
                    </categoryId>
                    <description>
                        <![CDATA[
description
]]>
                    </description>
                    <image>
                        <![CDATA[
http://kolba.pl/media/images/products/xl_org/p00009.jpg
]]>
                    </image>
                    <availability>1</availability>
                </offer>
                <offer>
                    <id>61</id>
                    <name>
                        <![CDATA[ Szyna- podwyższenie 2 częściowe 11/11 BKL-166 MB ]]>
                    </name>
                    <price>145</price>
                    <url>
                        <![CDATA[
http://kolba.pl/szyna-podwyzszenie-2-czesciowe-11-11-bkl-166-mb-p61.html
]]>
                    </url>
                    <categoryId>
                        <![CDATA[ Montaże ]]>
                    </categoryId>
                    <description>
                        <![CDATA[
description
]]>
                    </description>
                    <image>
                        <![CDATA[
http://kolba.pl/media/images/products/xl_org/p00061.jpg
]]>
                    </image>
                    <availability>1</availability>
                </offer>
            </offers>
        </loadOffers>
    </pasaz:Body>
</pasaz:Envelope>

And im using this script:

$plik=file_get_contents('kolba.xml');
$plik=utf8_encode($plik);
$movies = new SimpleXMLElement($plik);
$stala_czesc='"admin";"base";"Default";"simple";'; 
$stala_czesc2=';"Żaden";0.0000;';
$stala_czesc3='"Not Visible Individually";1;"Włączone"'."\n";   
foreach ($movies->offer as $product) 
{
    //echo '<br>Przetwarzam';
    $wynik="";
    $wynik=$stala_czesc;
    $nazwa=$product->name;
    $nazwa=str_replace('"',"",$nazwa);
    $nazwa = preg_replace("/[^[:alnum:][:punct:] -]/","",$nazwa);
    $wynik.='"'.$product->id.'_kolba";"'.$nazwa.'";
    '.number_format(intval($product->price),4,'.','').';
    '.number_format(intval($product->price),4,'.','').';
    '.number_format(intval($product->price),4,'.','').$stala_czesc2.$product->availability.';'.$stala_czesc3;
    echo '<br>';
    echo $wynik;
}

But FOR iterator never starts, why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:19:02+00:00Added an answer on June 17, 2026 at 7:19 pm

    The problem you are experiencing is because of the namespaced Envelope/Body, here’s a dirty hack to get to your data atleast;

    $movies = new SimpleXMLElement($plik);
    $movies = $movies->children('http://schemas.xmlsoap.org/soap/envelope/');
    $offers = $movies->children()->loadOffers->offers;
    

    and to loop the offers

    foreach ($offers->offer as $product) { .. }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Perl script that reads a simple .csv file like below- header1,header2,header3,header4
I have a project that reads some data from xml file Convert.ToDouble metod works
I have to write a Perl script to convert an XML file into a
I have a string coming from an XML file that appears to have been
I Have this XML File <?xml version=1.0 standalone=yes?> <Root> <Object> <referenceName>People</referenceName> <query>select * from
I have to convert from one XML (XHTML) file to another using XSLT. The
I have to convert from one XML (XHTML) file to another using XSLT. The
I am using LINQ to convert from XML file to a class that I
What is the easiest way to convert xml to html? I have xml file
I have an XML file and I have to convert it into a property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.