You are currently viewing Allowing eCommerce Customers Their Own Store Customization With Yii Framework

Allowing eCommerce Customers Their Own Store Customization With Yii Framework

  • Post published:April 13, 2015

While we’re well-versed with creating customizations on any platform, anytime, anywhere for our own clients, it’s slightly less frequent that we’re asked to enable their customers themselves to customize at their leisure.

This situation was different.

According to our client users should have beeb able to register with our his eCommerce application, set up their own stores and sell furniture online to their respective customers. The chain of clients, it seemed, never ended.

In that spirit, it was especially important to our client that “customization of every store” be a possibility. In short, he was looking for a function wherein any store owner would freely update the layout and theme of his own, unique store.

As is typically the case when a different development team has already begun work on a project we’re then asked to either complete or salvage, our client’s past developer left them without providing any solution for the requirement. Eventually, our developers suggested that we utilize Yii Framework to build the application, as well as recommending several updates within the database architecture.

But why Yii?

Yii is a high-performance framework with structured, clean and maintainable code. Its ease of use is unrivaled and its layered architecture/multiple themes support would come in especially handy for this particular project.

We began by creating the theme folder inside “root/themes”, following up with the “views” folder for each respective theme. We crafted individual views for every action inside the site controller (if you wanted a different home page for one theme, you’d create an “index.php,” adding the entirety of your code within.) We then modified the unit function of our main controller. Finishing off, we wrote a database query to source each theme name from the store table and passed the theme name to our configuration variable. At this point, after refreshing our main page, the shiny new layout was loaded.