Reedyn / Just-Another-Webshop

Webshop built for a university PHP project
2 stars 1 forks source link

Get requests through URl variables #31

Closed Reedyn closed 10 years ago

Reedyn commented 10 years ago

Load pages using URL variables and PHP include() function

Reedyn commented 10 years ago

Suggestion

With this structure one possible url could be http://justanotherwebshop.se/products/consoles/2674330/super-nintendo/

Problems

This structure however requires us to only be able to show products for a single category. If we want to show products that are in a category and all sub-categories for that category we run into the problem where the url is confusing to the user.

If we want to be able to show products that in practice belong to several products we shouldn't have the category as a part of the products url. However we also lose some of the visual hierarchy.

The alternative would be to have /product/product_id/ as the url for products.

Descriptive URl for products

With some extra work we can have descriptive urls for products such as /product/product_id/product_name/ or /product/product_id-product_name/. If we decide to never have two products with the same name (something we haven't implemented in the rest of the system) we can even have the nicest looking structure of /product/product_name/ which in practice would mean urls as nice as http://justanotherwebshop.se/product/super-nintendo/

Reedyn commented 10 years ago

With the following structure we will avoid most problems and keep most of the visual url hierarchy. Added draft on the structure of url-variables.

Reedyn commented 10 years ago

Everything is pretty much finished. What is left is a function to translate a categoryName to categoryId