lindstrom1989 Posted October 27, 2014 Share Posted October 27, 2014 Hi, I wanted to create a dynamically generated shop using php and mysql inside an existing wordpress site. I have an idea but would like your input as to whether my theory would work or if there would be an easier method I am overlooking. I know there are a few plugins out there and I've chosen "wp shopping cart" but this just creates a shortcode which you can add some information into like price and name which then process's in to paypal. My idea is to create a database containing lots of data like item number, name, price, shipping, thumbnail and image. then dynamically create my shop layout around it based on three different types of page. The main page which lists various categories of item which I will probably use static code for as there are only a few. The category pages that will contain a grid of items within that category with a thumbnail and its name. And finally the item page containing all the item specific data including the button by the "wp shopping cart" plugin. My questions are, to create the category page could I create a loop where I could have an "item div" created with the item info inside until theres are no more items left in that category in the database? so if the where 10 items in the category and I used css to make it each item div 25% width I would have 2 1/2 rows? for example if 1 exists look for 2 if 2 exists look for 3 etc until it can't find anymore and breaks the loop? The main point for this is that its dynamically generated so all I would need to do is update the database and it will show on the website but being wordpress how would I integrate this? how would I make it seo friendly? I've looked in to taxonomy but not sure if thats the right way to go. I know I can create templates that repeat the main code and just insert database values depending on the item but how would I define the item? should I do it by passing php through the url depending on what they click on? I appreciate this is a lot to take in but would be really grateful for some answers and tips, or even a link to a similar example as the ones I have found are close but not quite what I'm trying to do Quote Link to comment https://forums.phpfreaks.com/topic/292100-working-a-shop-into-wordpress/ Share on other sites More sharing options...
lindstrom1989 Posted November 1, 2014 Author Share Posted November 1, 2014 (edited) I could really do with some help with this, I have managed to make a shop application which works in wordpress and dynamically creates pages for me but the permalinks are the same regardless of item and I don't think its going to be good for seo. Basically I have 3 types of page, the category selection page which uses the GET method to send the item category number to the item category page which displays all items within that category number by looping until the loop number = the amount of rows for that category which nicely displays a list of items. Then when you click an item it sends the item number through the url then on the item page using the GET method I display all of the information about that item. All of the item info is stored on my mysql database and works really well but in reality I only have 3 pages and not 100+ pages equal to the amount of items because its dynamically generated. I can't change the page title or permalinks. Also if I try and access any of these pages outside of its parent page it won't generate the page because theres no information in the url telling it what to fetch. Any advice welcome. Edited November 1, 2014 by lindstrom1989 Quote Link to comment https://forums.phpfreaks.com/topic/292100-working-a-shop-into-wordpress/#findComment-1495448 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.