juanrojas Posted June 14, 2022 Share Posted June 14, 2022 Hello, someone who knows a module to import products in JSON that are not the only 2 modules that are in addons, I have tried them and they are not fine Link to comment Share on other sites More sharing options...
knacky Posted June 16, 2022 Share Posted June 16, 2022 (edited) And isn't it faster to convert json feed to xml? $getJson = file_get_contents('myjson.json'); $array = json_decode($getJson, true); $xml = new SimpleXMLElement('<root/>'); array_walk_recursive($array, array($xml, 'addChild')); print $xml->asXML(); Edited June 16, 2022 by knacky (see edit history) Link to comment Share on other sites More sharing options...
juanrojas Posted June 16, 2022 Author Share Posted June 16, 2022 hello, thanks for answering, I imagine that it would also be faster to convert to csv, but we are talking about one more step, the client downloads the JSON from a site and wants this file to remain in a cron task for updates, now well I don't know if the same technique that is used to download those products in JSON gives you the ability to say that you want it in XML. you want is to avoid one more step Link to comment Share on other sites More sharing options...
knacky Posted June 16, 2022 Share Posted June 16, 2022 After all, you can process a JSON file directly. /* { "items": [ { "product": { "googleId": "1111111111111", "author": {"name": "product one, "reference": "ABCD123","price": "123.85"} } } ] } */ $getJson = file_get_contents('myjson.json'); $array = json_decode($getJson, true); foreach ($array>items as $item) { var_dump($item->product->reference); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now