Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $padd = ' '; //4 spaces for identation
  2. $eol = "n"; //end of line
  3. $xml = '<?xml version="1.0"?>'.$eol;
  4. $xml .= '<products>'.$eol;
  5. foreach ($collection as $product) {
  6. $xml .= $padd.'<product>'.$eol;
  7. $xml .= str_repeat($padd, 2).'<name>'.$product->getName().'</name>'.$eol;
  8. $xml .= str_repeat($padd, 2).'<description><![CDATA['.$product->getName().']]></description>'.$eol;
  9. $xml .= str_repeat($padd, 2).'<price><![CDATA['.$product->getFinalPrice().']]></price>'.$eol;
  10. //add here all the attributes you need to export
  11. $xml .= $padd.'</product>'.$eol;
  12. }
  13. $xml .= '</products>'.$eol;
  14. //Do something with $xml - save it in a file or echo it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement