• Hello,
    Recently I started to develop a theme for new client. The theme should support a “product module” where the client cans “CRUD” (Creat Read Update and Delete) products. Firstly I was thinking about using a custom taxonomy with custom post types and custom fields to do it. The problem is that I have a pretty complex database structure (approximately 20 tables) and I don’t think storing all my products in the wp_post tabs is a good idea. The other option would be create all the custom tables in the wp database then accessing it with custom queries.
    What you guys think about it? What’s the best approach? Should I use another framework or WP could handle complex database structures?
    Cheers,

    Deguima

Viewing 5 replies - 1 through 5 (of 5 total)
  • You could compare the advantages and disadvantages of both methods. See if having a large wp_posts table is worth the WordPress functions you could use on WP posts like pretty permalinks, comments, plugins etc.

    It depends on what features your website is going to have.

    If you think you could recreate all of those and want more flexibility with your code and database structure, then go for creating your own tables.

    IMO no need to use another framework.

    Thread Starter deguima

    (@deguima)

    Thanks, Jomsky.
    I’ll talk to the other developer. It would really be great to have all the WP features available for the products module (featured images, permalinks, page hierarchy etc). On the other hand, as I said, the data structure is pretty complex and I’m not sure on how can I organize the whole thing with custom posts/taxonomies/custom fields.
    What do you mean by: “IMO no need to use another framework.”
    Cheers

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    “In my opinion, there is no need to use any other framework. WordPress can do this.”

    Having a large posts table isn’t a huge worry until you get up to 30k posts and even then, I know people on one DB with more.

    The problem is that I have a pretty complex database structure (approximately 20 tables) and I don’t think storing all my products in the wp_post tabs is a good idea.

    Without knowing more about what this structure is, it’s hard to say.

    Thread Starter deguima

    (@deguima)

    Merci beaucoup pour ton aide, Ipstenu.
    Actually it is a clothes module. I need to handle models, collections, sizes, colors, fabric types, key features and so on. Like this:

    db image

    Do you really think that I can use the custom post approach where each product would be a post.?
    A+,

    Its seems that your database structure’s complexity comes from being able to perform CRUD functions on all the product attributes(colors,sizes, etc.) as well.

    If by any chance you are not planning to create an admin page to perform these functions I suggest merging some of the tables to the main product table.

    The main concern in the moment is you might have a bit big wp_post_meta table because of the attributes. The wp_posts won’t be that big because I don’t even think your products will reach over 10000.

    How about creating custom post types, and then just use your post_id as a foreign key to the other custom tables you plan to create (tables that you think are better of separated from the post_meta table).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Suggestion on how deal with complex database structures in WP.’ is closed to new replies.