Reputation: 1831
I have some personal doubts regarding CodeIgniter project management. I am having more than 1 year experience in CodeIgniter as a developer. But now I am working on a project (e-commerce) which is totally managed under me and I am a single developer. Few things at which I am confused at is ...
Upvotes: 0
Views: 1009
Reputation: 3148
so with the usual disclaimers -- my suggestion is to use Libraries for interacting with 3rd parties -- the credit card transaction, creating shipping, etc. Besides separation another reason is that often these services will have PHP libraries that you want to integrate.
otherwise use models. start out general and then refactor so that the models are very specific. use folders to help organize. try and clearly separate out responsibilities. separate display versus the e-commerce tasks. the model that displays the product should be separate from the model that populates the cart. for example:
models/store/product -- display product and its variations
models/cart/item -- gets the current price, validates inventory etc
for many reasons i think its cleaner to do form validation in a model. form fields are available in the model. then the controller is just asking - did this form validate or not. Put validation on any/every form or post call even if there is no obvious user input.
more suggestions: do not use the CI cart library. your admin controllers (create a product , review an order, etc) should be in a completely separate application folder. models/cart/item gets the price directly from product table - do not pass the price in the buy button. keep in mind that people can put things in a cart and come back a week later - having price and inventory checks should be part of the checkout process.
its not a real "order" until you get the money. so however you do the checkout process - have a table that is just the completed final orders.
Upvotes: 1