Drupal Commerce

I posted on Optaros website (EN | DE). Here is the copy of the post:

Drupal has always been good piece of open source software for content management. We use it at Optaros as one of the core components of OCentric. However, Drupal could never stand its ground as a solid e-commerce platform. With the new Commerce module Drupal is moving that direction.

Background

It hasn’t been long since online businesses realized that there are a couple of buzzwords to stick to: social media and SEO. Indeed, social sites are very good place to be and engage with (potential) customers, not mentioning that these sites enable word of mouth (aka viral marketing). Search engine optimization helps to save money and still allow showing up high in Web search results; normally it goes hand in hand with quality content to please not only Web crawlers but (potential) customers as well.

Actually, what this implies is that e-shop owners have very special needs that go something like this:

“I want to create a website where I want to display my products. There I’ll have discount campaigns. The information about them should be sent to customers, but not intrusively (otherwise it goes to spam) rather in a friendly fashion, e.g. somebody tells to friends about it. Then we can introduce some sort of reward system for those customers who brought other customers. Also we want people to come to our website often, therefore we’ll have a blog and a lot of information about products and the field in general. People should have their profile page and see what their friends are buying. We also expect that the shop is something like Amazon.com where you have ratings, comments, and recommendations.” And so on, and so on.

I come across similar business requirements very often. What it comes down to, as far as technology is concerned, is the following:

  • Shopping cart
  • Content management system
  • Social stuff (integration to social networks or local features)

In Optaros parlance it rounds up to the triple of Community, Content, and Commerce (aka C3C). In fact that’s what gave birth to OCentric.

Drupal 6.x and Ubercart

Drupal is a content management system that allows creating community oriented sites very easily. The last piece of the puzzle – commerce – for quite some time was the Ubercart module. I don’t understand why it got so popular. Even for the simplest shop there was something missing.

Ubercart is almost a framework on its own: you need to learn it and live with its limitations (or hacks). My overall impression about Ubercart is that it has many features you normally expect from an e-commerce platform, but as soon as you start working with it you realize that it is a big work around.

Ubercart’s approach is – sell nodes. A node (before Drupal 7.x) is a basic content type. Ubercart is implemented in a way that products are node types, but it’s very unnatural to treat a product as a content type. This is probably the biggest flaw of Ubercart’s architecture (not sure if this has been somehow addressed in Ubercart 3.x).

While in many cases Ubercart does the thing – you can sell stuff on your Drupal site – I stumbled on so many problems that I almost lost hope to have a cool e-shop with Drupal. Just to list a few:

  • It’s nearly impossible to customize the checkout page without hacking Ubercart’s core.
  • Internationalization doesn’t work, because in Drupal a new node is created as a translation, which means a new product gets created as well.
  • Presentation is not well decoupled from data model, therefore theming any part of frontend is very tedious.

Drupal 7.x and Commerce

Drupal 7.x introduced a lot of enhancements both for module and UX developers. The most famous one is the Field API. Having realized the benefits that Drupal 7.x brings Ryan Szrama, the creator of Ubercart, has launched the Drupal Commerce project.

Drupal Commerce is the reimplementation of Ubercart’s featureset on Drupal 7.x. It’s not a port of Ubercart 2.x but literally a reimplementation. You can see the video of Ryan presenting his work on the module at DrupalCon 2010 in Copenhagen.

The Commerce module heavily relies on native Drupal 7.x features, therefore there’s barely any risk that it will become a framework on its own. While Drupal 7.x remains a content management system, it allows for more generic entities than just content. For example, products, order, order line items can all be first class citizens in Drupal 7.x. Therefore the Commerce module is architected in a way that e-shop owners can sell products, without pretending that a node content type is a product. Moreover, the data model is decoupled from presentation, and multilingual shop is no longer an issue as it was in Ubercart.

What makes the Commerce module even more powerful and flexible is that it depends on several great modules (Address Field, Entity API, Rules, Views). For example, Views – almost everything visible in Drupal Commerce is a view. That means you can switch it on/off or customize easily. This is invaluable for checkout and shopping cart pages.

Summary

In version 7.x Drupal has become quite a generic framework, sort of entity management system, that has built-in content and community features. The Commerce module plugs in very nicely into this framework and solves a lot of issues of its predecessor Ubercart. Given that many businesses need to have content, community and commerce in one, Drupal 7.x may become an option as it matures.

DrupalCon, Copenhagen 2010. Impressions

I won’t hide, the most interesting and relevant session at DrupalCon for me was on Drupal Commerce. Ryan Szrama is doing amazing job with reingineering Ubercart, and I’m really happy to have been able to talk to him in person.

The reason why I’m interested in the Drupal Commerce module is that I worked on Magento and Drupal integration for OCentric at my previous company (Optaros) and I’ve seen how difficult it is to have content, community and commerce mix in one solution. Therefore Drupal 7 + Drupal Commerce mix looks really promising. Just think about having a piece of content and adding a “product field” to it, formatted with “Add to cart” button; or the opposite – take a product page and add a piece of content to it as a field, which can have its own comments, ratings, etc. Really flexible and powerful!

One sentence by Ryan got imprinted in my brain:

“Ubercart was the first PHP and MySQL project in my career, so you guys are pretty brave to use it in production”

Another session that stood out was the keynote by Rasmus Lerdorf, the creator of PHP. It really corrected the way I look at PHP. He also showed some tricks for debugging and tracing the performance problems for Drupal. It was pretty impressive how in 15 minutes he spotted that the bottleneck in Drupal is the rendering engine which he suggested to rewrite in C/C++.

One sentence by Rasmus that imprinted in my brain (with some distortion):

“PHP has always been a templating language. All the heavy coding must be done in C”

The session on Varnish was probably the geekiest of the ones I attended, but Paul-Henning Kamp (the creator) made his point – you have to use Varnish!

And I was totally impressed with Aegir, how come I’ve never stumbled upon it? There is no doubt that this tool combined with drush_make will save the world from the Drupal deployment hell.

All in all, there was quite some buzz about Drupal 7 during the conference, many serious modules are developed directly for 7.x. This is mostly due to the fact that 7.x has this concept of entity (a field) as opposed to nodes/comments, which solves a lot of problems. I’m really looking forward to Drupal 7 and all the goodies that’ll come with it.

This was my first DrupalCon, and I must say that the crowd was really amazing. A bunch of friendly and easygoing people.

DrupalCon Copenhagen 2010 participants

Understanding the Service Oriented Architecture (SOA)

It’s a pretty old term this SOA. A software engineer (or systems integrator) normally associates it to the interface based software design. Just take a bunch of components, define interfaces between them and implement those interfaces. Then each component suddenly can be called a “service”.

Intuitively a service is something that you have an interface to and something that you don’t care about how it’s implemented.

There is a trend on the Web that websites expose their APIs to the outside world. E.g. YouTube, GCalendar, Twitter, etc. So suddenly those webapps become “services”.

Consequently the Internet is a platform for running a huge application called “Web” that is designed in SOA way, where each site is (should be) a service.

Unfortunately we are still not building our webapps to support this. We’re stuck with our software engineering mentality while we actually need to switch to Web engineering.

I think every feature of any webapp should be a service. Why coding and implementing your own contact form, your own blog, your own newsletter subscription module, your own user profile pages, etc.? Even if you have those features in your software package out of the box…

Looks like I’m trying to promote mashups, but that’s only the tip of an iceberg. Imagine that you have a website that you properly Web-engineered. Say you built the contact form feature as a service and it’s hosted on the cloud. And this feature is integrated into your CMS. There is a cool outcome at this point: you provide yourself with a SaaS solution. So you can actually start renting it to others as well. Ok maybe renting SaaS contact forms is not your core business… so what about doing it with the core business features? E.g. social graph, status updates, shopping cart, etc.?

Probably not everyone will go this way but just look at the beauty of this all, we’ve got services like getsatisfaction.com for feedback collection, discuss.com for comments, gravatar for a personal picture, openID for login, etc. etc. etc. The more a service is specialized the more useful it is.

For instance, a business model for Twitter could be renting their status updating feature to various social networks. Anyway every one of them are reimplementing it: LinkedIn, Facebook, MySpace, etc. Such a waste of time.


Posted from my Android

You Know, “running a business…”

As soon as I tell somebody that I’m starting a business with several friends – I get a question: “what kind of business”. And here a difficult part starts… At this early stage of 101senses it’s pretty difficult to explain what we’re trying to do, what we’ll be in 1-3 years, what motivates us, etc. In fact, when I take a moment and think about it then things become quite straightforward and clear. So let me describe what 101senses is all about.

We are currently 5 guys in the team and we want to do fun stuff. The current job is a bit disappointing: you get on a project, you talk to clients, you start building a solution hoping that the client will have guts to go with something fancy and innovative. But then you end up in this quality vs. time vs. money triangle, and you just do what you have to do, not always what you want to. Well, that’s IT consulting.

From several e-commerce projects I learned one thing: e-commerce is a good business. It’s much better than building e-commerce solutions for others. For instance, a private sales module for Magento community edition costs 110$, and guess what’s the revenue of a private sales e-shop…

But doing commerce is tough, and it’s totally different from what me (and most of the 101senses team) is used to, because a big part of the business (at least in the beginning) is not virtual. One has to look for products that sell, people that buy, models that generate cash. All in all, totally new challenges from the ones in the IT world. So now we have the saying “IT part is easy”. It’s a lot of fun to observe how five guys are struggling with product sourcing and otaku searching – the two things that people have been doing for ages.

As a start we decided to sell stockings for girls. Besides the fact that for guys it’s very exciting to deal with this kind of a product on a daily basis, there is real business rationale behind: stockings have a nice margin, take little space, and are easy to ship. So why not? Also if you look around the Web it’s crammed ugly and difficult to use e-shops. In the times of the person-centric Internet this does not make sense and is an area for healthy competition. It’s obvious that an e-shop that provides great user experience but the same products will win. We set an objective for 101senses to strive for the best customer experience in our e-shops. Prettify is going to be our first attempt.

Nowadays it’s quite easy to implement an e-commerce solution we decided to work on 2 shops in parallel. We call them ShopA and ShopB. Prettify is currently our ShopA. The goal of it is to be able to test our process, i.e. get a product, sell it, and deliver it to the customer – no other requirements. ShopB is going to be based on a concept. It could happen that it will be an evolution of the ShopA but it’s not excluded that it can become a totally different shop from Prettify. We’re working on that by reading about exciting commerce and following various twitterers. We’re also running from one conference to another, from one meet-up to another (check our calendar) and we’re keeping an eye on fashion in general. It’s getting more and more interesting everyday.

Most importantly we’ve got culture of openness and sharing at 101senses. There’s no point in hiding what we do and how we do it. I believe it builds trust in the virtual reality – the Internet – the same way honesty does it in real life.

To summarize:

  • we’re 101senses and we want to learn and do fun stuff
  • our first product is stockings on Prettify
  • at the core we’ve got the culture of openness and sharing
  • we like to engage into a public conversation online
  • we strive for technological innovation and great user experience on our e-shop

Some Experience With Google Wave

For my personal projects I’ve got Trac setup (OForge to be more precise). Recently with several friends we started working on a new project – 101senses.ch – and for it we adopted Google Wave as a collaboration tool.

Actually we started with the wiki on Trac. But after jumping on the wave wiki naturally became obsolete, old fashioned, inconvenient.

Some observations about GWave:

It reminds a wiki in some sense, just that collaboration happens real-time. You don’t have to browse through versions and diffs just to see recent updates.

The functionality of folders is ua bit cumbersome or sometimes even useless. At least I was not able to find any good use for them. The only thing I do is to apply a label “Meeting” with the saved search feature.

I start to fear that as the number of waves increases it will be quite a mess. Even now with 20 waves we already have duplicates. And there is no way to unshare a wave or delete it for everyone.

I really need workspaces. I’m working with different teams on different projects and mixing all the waves in the same pile just makes me loose an overview.

Widgets are cool but where do I find them? Would be great to have some kind of an app market on the web.

It’s really great that GWave is open. Because I can extend it with my apps or change it with my own UI. I think it makes a lot of sense. If eventually GWave is adopted as a collaboration platform then we can expect many nice SaaS solutions showing up on the web. The competitive advantage will be determined by a set of features and the user experience, and we won’t need to care about data portability.

– posted from my Android

“Liepsnojantis ledas” (“HotIce”) ir Šiaip Pamąstymai

Šiauliai, 2009-12-27, “Liepsnojantis ledas” – renginys, kurio džiaugiuosi nepraleidęs. Ir ne vien dėl to, kad ant jo neįtikėtinas figūras raitė įvairiausi čempionai, bet ir todėl, kad kažkuriuo momentu supratau, kaip visa tai yra gražu.

Grožis yra sudėtingas dalykas ir man, savamoksliškai besigilinant į meną, jis ne visuomet apsireiškia. Pavyzdžiui, galiu klausytis Mocarto ausis pastatęs, bet kažkaip nepasiekia jis manęs, o va išgirdus Debussy, iš karto užlieja gerumo banga.

O kas ten dėjosi! Moterys sukdamosi skraidė. Vyrai jas kilnojo ir mėtė į viršų. Broliai mindė viens kitą su pačiūžomis ir vartėsi kūlvirsčia. Vieni krito, po to kėlėsi, po to greitai, kaip vilkelis, sukosi. Kiti ne tik kojų, bet rankų ir net kaklo vikrumu vertė publiką aikčioti. Stuburo lankstumas, špagatai, salto… Jergutėliau, ir tai ant ledo, su pačiūžomis!

Ačiū Povilui Vanagui ir Margaritai Drobiazko už jų Dailųjį Čiuožimą! Už tą romantišką plaukiantį šokį, kuris nuteikia taip pat gerai, kaip atlikus ar bent susiruošus atlikti kokį nors gerą darbą. Tai taurina, moko pajusti, gerbti ir didžiuotis vertybėmis.

Turi žmogus, matyt, kažin kokį receptorių, apie kurį per biologijos pamokas nemokina, nes jį nelengva įsprausti į trijų eilučių apibrėžimą. Pas kiekvieną jis sudirginamas vis kitaip ir pasireiškia savaip. Pavyzdžiui, jeigu nugara nubėga šiurpuliukas, reiškia kažkas buvo pasakyta, sušokta, pamatyta, perskaityta, patirta… negi ne? F. Dostojevskis sakė, kad Grožis išgelbės pasaulį. Aš juo tikiu.

Linkiu daug šiurpuliukų ir užliejančių bangų ateinančiais metais.

Šiauliai, 2009-12-27, “Liepsnojantis ledas” – renginys, kurio džiaugiuosi nepraleidęs. Ir ne vien dėl to, kad ant jo neįtikėtinas figūras raitė įvairiausi čempionai, bet ir todėl, kad kažkuriuo momentu supratau, kaip visa tai yra gražu.

Grožis yra sudėtingas dalykas ir man, savamoksliškai besigilinant į meną, jis ne visuomet apsireiškia. Pavyzdžiui, galiu klausytis Mocarto ausis pastatęs, bet kažkaip nepasiekia jis manęs, o va išgirdus De Bussy, iš karto užlieja gerumo banga.

O kas ten dėjosi! Moterys sukdamosi skraidė. Vyrai jas kilnojo ir mėtė į viršų. Broliai mindė viens kitą su pačiūžomis ir vartėsi kūlvirsčia. Vieni krito, po to kėlėsi, po to greitai, kaip vilkelis, sukosi. Kiti ne tik kojų, bet rankų ir net kaklo vikrumu vertė publiką aikčioti. Stuburo lankstumas, špagatai, salto… Jergutėliau, ir tai ant ledo, su pačiūžomis!

Ačiū Povilui Vanagui ir Margaritai Drobiasko už jų Dailųjį Čiuožimą! Už tą romantišką plaukiantį šokį, kuris nuteikia taip pat gerai, kaip atlikus ar bent susiruošus atlikti kokį nors gerą darbą. Tai taurina, moko pajusti, gerbti ir didžiuotis vertybėmis.

Turi žmogus, matyt, kažin kokį receptorių, apie kurį per biologijos pamokas nemokina, nes jį nelengva įsprausti į trijų eilučių apibrėžimą. Pas kiekvieną jis sudirginamas vis kitaip ir pasireiškia savaip. Pavyzdžiui, jeigu nugara nubėga šiurpuliukas, reiškia kažkas buvo pasakyta, sušokta, pamatyta, perskaityta, patirta… negi ne? F. Dostojevskis sakė, kad Grožis išgelbės pasaulį. Aš juo tikiu.

Linkiu daug šiurpuliukų ir užliejančių bangų ateinančiais metais.

Arrange Fields in Trac Tickets

I was struggling one day to organize fields in the order I want when I create tickets in Trac.

  1. Copy templates/ticket.html into trac/myproject/templates/ticket.html
  2. Insert the following code snippet to the beginning of the template:
  3. <?python
      # define the order
      field_types = ["type", "priority", "milestone",  "keywords", "cc",  "component"]
    
      # Sorting function
      def sort_nicely(field1, field2):
        try:
            idx1 = field_types.index(field1['name'])
        except ValueError:
            idx1 = 1000 # no match, push to the end
    
        try:
            idx2 = field_types.index(field2['name'])
        except ValueError:
            idx2 = 1000 # no match, push to the end
    
        return cmp(idx1, idx2)
    
      fields.sort(cmp=sort_nicely)
    ?>
    

That’s it, if you have any custom fields and you want them ordered, put them into the field_types list.

Magento and Drupal Integration

There are numerous ways to integrate Magento with Drupal. Here I will share my experiences while working on that with very smart people at Optaros. I don’t take credit for all the points in this post, because they are the product of the whole team.

The motivation for this kind of integration is the innovative look into where e-commerce is moving. To get a grasp of it look at OCentric. To keep it short, content is free advertisement for products. It allows customers to get more input about products and provides the meat for search engines to index.

Briefly, there are several main approaches to integrate Drupal and Magento:

  1. let Magento be the main component, while leaving Drupal just as a subcomponent
  2. let Drupal be the main component, and have Magento as an e-commerce  module
  3. let  both Magento and Drupal be main components

These are general approaches and each of them have different pros and cons. They will be further detailed by usecases, complexity, technicalities, etc. in the following sections.

Moreover, we will release much of the code as open source, so it’s not only a theoretical discussion here:)

Magento as the Main Component

This is probably the most acceptable approach in terms of implementation complexity. Moreover you can choose different level of complexity to implement.

The straightforward solution is to integrate on the service layer. Meaning that whenever we are on the e-shop product page we have to call a Drupal service to bring related content, for instance blog posts. The same holds for category pages. How to do that:

  • Create a Drupal module that allows you assigning categories and products  to a content node in Drupal
  • Implement XML-RPC client on Magento side and use it to talk to services on Drupal in order to pull the content (e.g. using view.get or node.get funuctions)
  • Rewrite the category and product controllers on Magento to take the content from Drupal into account

There are some challenges in taking this way. They are mainly for those who want to implement features in a generic way. Specifically, whenever you add a CCK field or a feature like rating to a content type, you have some work to do on the Magento side. Namely, you need to modify layout and write templates to handle this additional data coming from Drupal. Hence it’s pretty cumbersome to use Drupal community contributed modules as you need to do some coding on Magento side for every new Drupal feature. This is quite easy when the content from Drupal is read-only, but as soon as you want commenting, rating, flagging, etc. it becomes an issue, because you need to not only redo rendering on Magento but also map the functionality.

A more complex path to take  is to integrate the whole Drupal rendering engine into Magento, however, this means a very tightly coupled architecture… Still, if you plan to use many many many of the Drupal features it may make sense. This will require writing a Drupal module for Magento that will adapt every Drupal core function to Magento. Could end up as a very complicated solution.

We chose the XML-RPC because of the given time frame and specific requirements. Normally a product or a category will be associated with a very specific set of content types, and therefore the fully generic solution may not pay off.

By the way there is already a CMS module for Magento as part of the core. And the question is why would one want to struggle integrating Drupal instead of using that CMS module? Moreover, with enterprise 1.6 version of Magento the module offers quite cool features. Some things from the top of my head to consider:

  • Drupal has a solid community, and it is more stable and feature-rich than the Magento CMS module will ever be (of course it’s good as soon as you make the Drupal-Magento integration reasonably flexible)
  • There is the CCK module that allows to very quickly add additional fields to a content type and make it available to the content producing team
  • Content versioning, workflow, etc. is easy in Drupal
  • …more ?

Drupal as the Main Component

This approach has been already taken by others and you can start digging for it here. We’ve tried out the available modules but didn’t stick with them… Basically there the implementation is based on the notion of synchronizing Magento products, categories, orders, etc.  into Drupal using a cron job.

In general, although Drupal-as-the-main-component approach in the end may give a lot of  flexibility, it may be too complex to implement. Imagine that the whole Magento frontend functionality needs to be rewritten for Drupal. Magento would then only be an e-commerce backend (the admin part) accessible via Web services. Of course you’d be able to use plenty of Drupal modules as well as flexible templating without any hassle, have better performance, and many other goodies but it just looks too expensive to implement.

Still, bringing only a part of Magento into Drupal makes a lot of sense (as in that module that synchronizes products and orders into Drupal using cron job). In this case it’s a decision to make whether the site is more about content or about commerce. When it’s about content, then you don’t really care about SEO for products, fancy business logic, etc.

Both Mangento and Drupal as the main Components

This is reasonable when the content will be displayed on the Drupal site and e-shop on the Magento site. Meaning that no proxying for content happens behind the scenes. So if a product has a blog post attached, then on the product page you’ll have a link (maybe even the post itself loaded using Ajax call) and clicking it will open a Drupal page with that blog post.

One of the challenges here is to maintain two different themes in order not to harm user experience. So that when the customer clicks on the blog link inside the product page the blog is displayed with the same look and feel as the shop. For that you can’t avoid coding on two different frameworks. Apart from theming SEO will have to be also maintained on both components.

Another challenge would be the ability to mix content with product information on the same page. Some kind of communication on the service layer will be necessary for that, which means that it’s not really reasonable to use this dual approach with such a usecase present.

It may make sense, however, to take this path when there are only some of the things to be shared between both components, e.g. users, and everything else is completely separate. For example, when a company has an e-commerce site, a customer community site, and a corporate site.

Additional Points for Integration

The end user display is only one part of the story. When you integrate this kind of monster systems to work seamlessly you get trapped with other things besides templating.

One of them is single sign on. A good thing to do here is to use CAS. Drupal already has the CAS module. Magento, however, needs one (we’ve been writing one). The good news that all the low level protocol implementation is available for PHP as open source.

Another thing is search. Independently of the integration approach chosen eventually you want to search for products and content in the same search box. This may become pretty challenging but it’s not impossible. We’ve got a proof of concept for the store front in Magento, where we leverage Solr search. It performs really well for our suggest box functionality.


There are numerous ways to integrate Magento with Drupal. And here I will share my experiences while working on that with very smart people at Optaros. asdfa sfd

asdf adsfasdf asdfasdf

Interactive Projection

I wonder if there is a technology that allows interaction with a projection. I was looking around the Web but all I could find was fancy and expensive (multi)touch screens.

I think it should be somehow possible to track hand movements from the outside only by means of a little camera and software; similar to the way eye tracking software works.

Imagine you put a little device that is watching how you are doing a presentation by projecting slides on a wall. As soon as you wipe the wall the next slide eases in; you zoom in/out with two hands the same way you achieve that with two fingers on iPhone; when you want to fast forward a movie you wipe with the faster movement; etc.

Probably the challenge would be not to stand in the way of the tracking device and, of course, to clean the wall you’ve been touching after lounch:)

Is HTC Hero for the left handed?

Recently I obtained an HTC Hero and I really like it. I’ve never had an iPhone but my friends say it’s pretty much the same. I say that it’s the same but better. I always prove that with the Google Sky app.

One drawback though is that the “back” button (used very often) is on the bottom right of the device panel. So when you hold it in your right hand it’s physically very uncomfortable to click that button. I mean very.