Using WordPress 4.3 and we have a custom post type with custom fields. It's easy to just import all of this content from a DB to the WP DB and everything will be there. Problem is, all internal work is done on an external ERP server. No actual changes will be made to the WP site at all from an admin standpoint but
Right now we're using an ajax api to connect to our old website and pull in all the data. What I'd like to do is use this ajax api to pull in the data as the custom content type and save it to the WP DB. Then maybe have a cron or something that will check for changes between what is on the site and what is coming from the server.
The reason for this is think about this custom content type as a product. There are 70k products but are never sold from the website. The website just displays what is there. All sales, prices changes, etc are handled from the ERP server and then it needs to update the WP site.
I don't think it's a good idea to rebuild every time the user needs to look at something so I figured cron and changing the content that way would be the best bet.
1) We have the following on the old site:
Method: POST
URL: "http://api.example.com/api/product/search"
Headers: Content-Type = application/json
Body: {
"categories": [],
"brand": [],
"sizes": [],
"base": [],
"location": [],
"searchTerms": [""]
}
2) How would I use this to create populate the custom post type pages?
3) How would I use this to sort the results by the category?
4) I assume I'm going to be using custom taxonomy for the things like category, brand, size, etc so how do I map those and also fill the fields that are coming from the result? Those things are like price, description, etc.
5) Is there a method I can use to set up this sync as a cron so that it happens every night or something?