views:

57

answers:

2

I work at an in-house IT department for company running 10 or so only shops of varying complexity. The shops code has been written over the last 8 years, each shop a new branch growing father and father away from the stem (I guess that makes it a bush?)

The need for more and more complex discounts, campaigns and user monitoring are growing rapidly - and changing rapidly as well (you never know what they come up with). So we have decided to write a new system from scratch and bring the different shops back together having them run on the same core code. We have considered .NET, but due to the fact that the design requirements change so fast we have more or less decided to give Rails a try. But we have some uncertainties/questions about rails.

Is Rails (stack) suitable to run to build a shop framework and who should this be organized?

We are running around 10 shops of which some are very much alike only differing in style, where others stands out in functionality, flow and content. But behind the business logic is all the same. The shops functionality is to a great extend the same as well. As an example the checkout page of one shop might display great details about VAT, discounts, P&P, etc. where as another might only show the necessary minimum.

Which approach would you take? Would you build and maintain a runable template shop with a functional superset of the shops. As new functionality is developed then merge the code with the other shops? Sounds a bit cumbersome.

In the example with the checkout page the views would differ from shop to shop, but the controllers and the models would remain the same, as long as you externalize configurations, like payment method types, and so on.

From this perspective it would make more sense just to create a repository of the views and configurations for each shop and then maintain model and controller code in a separate repository.

Would be possible to arrange the views according to shop, keeping all resources in one repositoary /views/shopname/Product. Would this make sense?

What do you think? how would you do this? Will working with rails in this way bring to much trouble?

Our campaign/discount system is growing steadily complex, both GUI and business logic. (in this view Rails seems interesting with its fast turnaround). Our discounts are property based and these properties are stored in a database row.

Making changes in the requirements to the workings of a discount is a real headache. So we are slowly replacing this property based system with a system that for each discount attaches a class (PHP) and a configuration so that each discount type has its own class and each utilization of such discount could specify some values for this class to operate on given current context (basically: what is in the basket)

In rails what approach would you take?

In rails you can easily extend your model (discount) with yet another property, migrate and you are ready (maybe a bit simplified). Could you write a base discount class that relied on a few basic properties and then write modules that hook into (extends) this class in case you need more advanced functionality?

Specifically what would this be in Rails terms a helper?

Some of this post might be a bit unclear. Please do ask questions. Also I'm in the process of learning Rails so please excuse me if don't use the right terms or if I've missed some of the main ideas of Rails.

Thanks Michael

A: 

Is Rails (stack) suitable to run to build a shop framework and how should this be organized?

Sure, it can be suitable see:

I would not recommend it as a first project though.

Sam Saffron
Liquid looks interesting. Right now we are using Smarty, the transition should be a breeze :)In rails you would have to specify all the variables for the template. The shops having different requirements to what is content besides the different layout, this could get kind of ugly. You would have to supply all data possibly useful to any of the shop templates for the page in question. How would you go about this?Do you have any suggestions as of how to organize the our repositories?
Michael
I would go data-driven, and store the customization in the db, then cache the relevant pages. I would also recommend you bring in a contractor with lots of rails experience to review your architecture it is well worth it.
Sam Saffron
A: 

Dont forget Spree Commerce as a viable solution that may or not suid your needs. On the other hand, if you want to roll your own solution, also check ActiveMerchant for payment gateway integration.

pantulis
We will be using ActiveMerchant for sure. Although there is no implementation for our payment provider I'm sure that the library makes that implementation easy.Thanks pantulis.
Michael