Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. diff --git a/wfd/support/models/WFD_ChannelAmazon.php b/wfd/support/models/WFD_Chann
  2. index cb7ee5b..0ed4313 100644
  3. --- a/wfd/support/models/WFD_ChannelAmazon.php
  4. +++ b/wfd/support/models/WFD_ChannelAmazon.php
  5. @@ -859,13 +859,20 @@ class WFD_ChannelAmazon extends WFD_Channel
  6. global $jlf;
  7.  
  8. require_once(__DIR__.'/WFD_ChannelProcess.php');
  9. + require_once(SITE_COMMON_PATH.'/static/GOS_XMLUtils.php');
  10.  
  11. $ka_xml = array(
  12. 'MessageType' => 'Product',
  13. 'PurgeAndReplace' => 'false',
  14. - 'Message' => array()
  15. + 'Message' => 'content'
  16. );
  17. + // Get outer xml and split up so we can write product xml one prodsp
  18. + // This stops it running out of memory.
  19. + $outer_xml = $this->_peek_generic_xml($ka_xml);
  20. + $start_xml = substr($outer_xml,0,strpos($outer_xml,'<Message>content
  21. + $end_xml = substr($outer_xml,strpos($outer_xml,'content</Message>')+
  22.  
  23. + fwrite($handle, $start_xml);
  24. foreach(
  25. $this->get_prodspecs(
  26. array(
  27. @@ -879,20 +886,32 @@ class WFD_ChannelAmazon extends WFD_Channel
  28. )
  29. as $prodspec
  30. ){
  31. +
  32. foreach( $prodspec->peek_channel_entries($this) as $entry ){
  33. if( !$this->test_is_valid($entry) ) continue;
  34. if( !$entry->id ) $entry->save();
  35.  
  36. - $ka_xml['Message'][] = array(
  37. - 'MessageID' => $entry->id,
  38. - 'OperationType' => 'Update',
  39. - 'Product' => $this->peekOneEntryXMLArray($en
  40. +
  41. + fwrite(
  42. + $handle,
  43. + GOS_XMLUtils::tree_to_node_string(
  44. + 'Message',
  45. + GOS_XMLUtils::array_to_tree(
  46. + array(
  47. + 'MessageID' => $entr
  48. + 'OperationType' => '
  49. + 'Product' => $this->
  50. + ),
  51. + 1
  52. + )
  53. + ,
  54. + 1
  55. + )
  56. );
  57. }
  58. }
  59.  
  60. - require_once(SITE_COMMON_PATH.'/static/GOS_XMLUtils.php');
  61. - fwrite($handle, $this->_peek_generic_xml($ka_xml));
  62. + fwrite($handle, $end_xml);
  63. }
  64.  
  65. public function outputPriceXML($handle, $prodspec_id = NULL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement