I have a ecommerce site that needs to update products via a huge XML file downloaded via ftp from the distributor.
The products.xml file is approx 21MB in size and pulling the data and looping through it is simply too exhaustive for a single pass.
I need to be able to split the original XML file or my processed SimpleXMLElement into 1000 products each, then load the files and process them separately.
I'm pulling the xml into a SimpleXMLElement then casting it to an array so it looks like so:
[1] => Array
(
[PRODUCTS_NAME] => Product Name
[PRODUCTS_DESCRIPTION] => Product Description
[PRODUCTS_IMAGE] => 1234.jpg
[PRODUCTS_PRICE] => 9.99
[PRODUCTS_MODEL] => 1234
[ITEM_BRANDNAME] => Acme Inc.
[ITEM_UPC] => 01234567890
[ITEM_HEIGHT] => 0.500
[ITEM_LENGTH] => 4.250
[ITEM_DIAMETER] => 3.375
[PRODUCTS_WEIGHT] => 0.05
[MANUFACTURERS_NAME] => Acme Distributors
[ITEM_VENDOR_NUMBER] => XXX-1234
[PRODUCTS_QUANTITY] => 100
[DATE_RECIEVED] => 0000-00-00 00:00:00
[PROP_PACKAGING] => Blister Card
[PRODUCT_CLASS] => BAT
[PRODUCTS_TYPE] => Batteries
)
How can I create individual files of 1000 products in each file and save them?