I got most of this working. I need to be able to write each correct expression to a csv file. I am getting
Warning: fputcsv() expects parameter 2 to be array, boolean given line 34
Here is the updated code.
//XML Structure
/<datafeed>
<items>
<item>
<model>
<title>
<price>
<category>
<loc>
<image>
<description>
<weight>
<option_type>
<option_value>
<suggest_retail>
<special_handling>
<manufacturer>
<manufacturer_code>
<packaging>
<in_stock>
<last_updated>
</item>
<items>
</datafeed>/
$xml = simplexml_load_file('xrproducts.xml');
$with = fopen('inventorywithoptionsactive.txt', 'w');
$without = fopen('inventorywithoutactive.txt', 'w');
foreach ($xml->xpath('//item[in_stock="Yes"]') as $output){
$data = print_r($output->asxml());
fputcsv($with, $data , '|');
}
fclose($with);
fclose($without);