Basic requirement: I want to integrate a catalog with detail product pages inside an existing wordpress installation.
The catalog is a CSV file which I can parse and store the individual items inside the DB. Every item belongs to a individual product group. The stock of the catalog changes. Products are added or deleted. Therefore I need to process the CSV file every day.
Target page structure:
/catalog/ /catalog/product_group_1/ /catalog/product_group_1/item_1/ /catalog/product_group_1/item_2/ /catalog/product_group_1/item_3/ /catalog/product_group_2/ /catalog/product_group_2/item_1/ /catalog/product_group_2/item_2/ /catalog/product_group_2/item_3/ ...
My first approach: The CSV part to store the products is not a problem at all. For the rest I startet to develop a plugin which will do the rest.
I have come that far:
/catalog/ is a static page with a plugin function who shows links to the product_group. The plugin functionsname is showProductGroupFromCatalog(). Inside the plugin I registerd the function with:
And inside the /catalog/ page I placed [showProductGroupFromCatalog] and it works like a charm.
But now I have no clue how I should render the product_group- and item pages. The templates are always the same and should completed with the data from the database.
What I need is like a templateRenderHook where I can decide, on the basis of the URI parts, which template I wanna use to render the HTML. I hope some one can give me an advice. Other approaches or solutions are also welcome.