Using Blog Demo to develop e-commerce website

I am learning YII and i’m trying to develop an e-commerce application. I want to have categories of products where products will be stored in categories and each product will have several images.

Is it safe to say that using blog demo logic i can create something like that?

Posts can modified to be Products

Tags can be modified to be Categories (only difference is that each product will only have one category)

Comments can be modified to represent images (products can have as many images as i wish).

If i follow that logic, i’d have to remove one of the FK_tag foreign key from PostTag table to make sure tags (categories) won’t be deleted when Posts (products) are deleted.

And of course i’d rename all the tables and fields properly to suit my needs.

Am i on the right track?

It possible better to rethink your data structure and create your own models. You can always learn from official sources, but it’s kind of weird you want to totally reuse them.

No i wouldn’t want to re-use them 100%. I’m starting from scratch and designing my own database, then running yiic tool for crud operations and then making necessary changes.

i was not sure how i could add products to different categories… so i think the tags functionality could give me ideas. Same thing with comments functionality. A product can have many images, just like the post can have many comments. I hope you catch my drift :)

Of course. :) Yes, your plans follow the ActiveRecord schema very well. You may want to define relations in the corresponding model method, as, let’s say, HAS_MANY in Products model.

Since you only want to refer to a single parent category, you don’t need MANY_MANY relation which you have just found out in the demo.