I have a XML file that consist of product information.
Format of XML file :
<product> <name>Product-1</name> <description>this is product 1 description</description> <category>Category-1<category> <merchant>1234</merchant> <price>12</price> <instock>1<instock> <stockstatus>45</stockstatus> <image>http://www.example.com/1.jpg</image> <manufacture>987</manufacture> </product>
I need to write a script that will add these detail as a product. For now I am not using any WP plugin for eCommerce purpose.
I am planning to create a custom post type as wpproduct that will store these products details.
So for now I can use
post content and
post thumbnail. And for storing the meta data I can store it in
So I can create the post by using
wp_insert_post and whatever
ID it will return, I will use that ID in
update_post_meta to update the meta data such as price, stock status , stock quantity, manufacturer etc.
Like this it can be done..
So for a single product I need to write 1
wp_insert_post and then 6
update_meta_data query. So 7 query for 1 product. Not exactly 7 query as WP inbuilt function uses many query for validation check.
What will happen if my XML file has 1 lakh product. So for adding 1 lakh product 7 lakh mysql query will run.
I am just eager to know like can I add custom column in WP wp_posts table so that I can add 1 product in 1 query only. I might use raw mysql query to add it.
Please help me and guide the best way to do it.