Jump to content

Design pattern for small webshop


Wuhtzu

Recommended Posts

Hey

 

I'm about to begin building a small webshop / website to sell and present some t-shirt printing stuff I'm doing, but I'm in doubt about what design pattern I should utilize...

 

More specifically I'm in doubt whether to use the MVC pattern (which I'm fairly new to) or some basic "mix php, mysql and html altogether in script.php" application structure with some includes and stuff.

 

The consists of a minimum of sections:

 

Home -> Home page, offers, news ect.

T-shirts -> View our t-shirts

Information -> Information about payment, shipment ect.

Check out -> Check out and pay for your tshirts

Shopping cart -> View the shopping cart

 

What I would like to obtain URL wise:

 

#1 site.com/tshirts -> View all collections

#2 site.com/tshirts/military -> View t-shirts in the "Military" collection

#3 site.com/tshirts/military/le-tank -> View the t-shirt "Le Tank" within the "Military" collection

 

But I do not see how I can obtain this with the MVC pattern, both well known and homegrown conceptual mvc frameworks all seems to give me something like this:

 

site.com/collections -> View all collections

site.com/collections/view/military -> View t-shirts in the "Military" collection

site.com/tshirts/view/le-tank -> View the t-shirt "Le Tank" within the "Military" collection

 

 

I don't particularly like the URL's which I think is inevitable with the MVC pattern and I don't see them in webshops very often. Can I avoid the URLs and still use the mvc pattern?

 

The tempting way to take is, to make a script for each section (home.php, tshirts.php, information.php, shoppingcart.php ect) and do enough rewriting to make it look nice, but on the other hand it will be one large headache when it comes to making consistent page titles, breadcrumb trail, authentication ect...

 

 

What approach would you suggest I take? I would like to hear any thoughts, ideas or suggestions on how to do this and how not to do this.

 

Best regards

Wuhtzu

 

Link to comment
Share on other sites

I done some work with CakePHP and it took no time to creating a quite astonishing functionality, but to be honest with you I don't like having thousands of functions I don't use. All I need is the basic routing functionality, basic separation of presentation and logic, the url rewriting, some form handling and a structured way of handling page titles.

 

So I'm think about use my own conceptual framework based on articles and tutorials I've red about the net.

 

How will you set up your router to obtain anything other than site.com/module/event/optinal-id-or-something ? (I'm most likely asking a very stupid question here...)

Link to comment
Share on other sites

You'd have to edit the /app/config/routes.php file. For getting what you'd like I'd guess something like the code below would do.

 

Router::connect('/tshirts', array('controller' => 'collections', 'action' => 'index'));
Router::connect('/tshirts/:collection', array('controller' => 'collections', 'action' => 'view'));
Router::connect('/tshirts/:collection/:name', array('controller' => 'tshirts', 'action' => 'view'));

 

Also, check out this: http://manual.cakephp.org/chapter/configuration

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.