News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Query notify.php xml

Started by hrjorgensen, April 24, 2010, 13:59:37 PM

Previous topic - Next topic

hrjorgensen

i want to write a xml file and put it on an external ftp. writing the file and putting it on the ftp works fine, the problem is my query. Nothing between the while ($xmlquery->next_record()){ } statement?

this is the output i get
<?xml version="1.0" encoding="ISO-8859-1">
<order>
<order_id>70</order_id>
</order>


any suggestions

I have put this code in the notify.php file



  $xmlquery = new ps_DB;
    $xmlquery->query = ("SELECT order_item_sku, order_item_name, product_quantity, product_final_price FROM #__{vm}_order_item WHERE order_id='$order_id'" );

       
             
             $xml_content ='<?xml version="1.0" encoding="ISO-8859-1">'.chr(10);
             $xml_content .="<order>".chr(10);
             $xml_content .="<order_id>$order_id</order_id>".chr(10);

               while ($xmlquery->next_record())
             {
                 $product_sku=$xmlquery->f("order_item_sku");
                 $item_name=$xmlquery->f("order_item_name");
                 $product_quantity=$xmlquery->f("product_quantity");
                 $product_final_price=$xmlquery->f("product_final_price");

                 $xml_content .="<product_sku>$product_sku</product_sku>".chr(10);
                 $xml_content .="<item_name>$item_name</item_name>".chr(10);
                 $xml_content .="<product_quantity>$product_quantity</product_quantity>".chr(10);
                 $xml_content .="<product_final_price>$product_final_price</product_final_price>".chr(10);
                 }
            $xml_content .="</order>".chr(10);
    /// jack upload info til ftp

           
           $ftp_path = 'ftp://xx:xx@xx/test.xml';
           $stream_options = array('ftp' => array('overwrite' => true));

           // Creates a stream context resource with the defined options
           $stream_context = stream_context_create($stream_options);
           
           // Opens the file for writing and truncates it to zero length
           if ($fh = fopen($ftp_path, 'w', 0, $stream_context))
           {
               // Writes contents to the file
               fputs($fh, $xml_content);
               
               // Closes the file handle
               fclose($fh);
           }
           else
           {
             //  die('Could not open file.');
           }