 Hello, everyone. Thank you for coming so early. So this is about the challenges of building rental stores. So if you're looking for something else, you're in the wrong room. I've got a lot of materials, so I'm going to be going pretty fast. If you get dizzy, raise your hand, ask questions. I'll try to answer them quickly and we'll try to keep some time at the end of the presentation. About me, I was born in the year Drupal 610. I'm Bizon Bleu on Drupal.org. I'm a site builder. I'm a freelance and it all started with HyperCard. Who knows HyperCard here? One individual. Moving on. So the session plan. So basically three parts. The first part is about workflow analysis, buying versus renting. We will see that it's a very different paradigm. After that, we will be looking at the Drupal commerce offering. If you want to create a rental store, what's available, what is there. And we'll also look at a postmortem for a rental store that I did. So we'll have some concrete examples. Just a show of hands. Who is familiar or knows commerce? Okay, most people. And who is a site builder? And programmers? Hardcore people? Alright, moving on. So basically I'm going to be doing this presentation from the perspective of a site builder. So I'm a site builder and I'm proud of being a site builder. And what I do when I build sites, I usually look at contrib modules first. I do a little bit of coding of course, but I usually try to find available solutions. So workflow analysis, buy versus rent. Buying is the most common e-commerce use case. Essentially, when you go on a website and you want to buy something, you will search, find it, add it to your cart, check out, finish, done. So it's pretty simple. Step one and two, finding and adding to the cart, you know, you can repeat that a number of times and that's usually acceptable. From the point of view of the store, there are a few more considerations. The store is going to want to know what's the product, what attributes, and we will talk a little later on about attributes. In stock, what's the price? Are there attribute price adjustment? By that I mean if you buy a t-shirt and you buy a large t-shirt, maybe there's a price adjustment because it's a large t-shirt. That's an attribute. Are there taxes? And I put a little star there because taxes can get very complicated, especially if you sell your t-shirts to the world. Who's buying? You need to know who's buying, so you will be managing customers and profiles, the payment methods, PayPal, credit card, Bitcoins, anyone. Do I need to send an invoice? What kind of invoice? Is there shipping? So do I need to consider managing fulfillment? Those are all considerations that a buying store needs to look at. Let's look at the renting workflow from the customer's point of view and basically more or less the same steps, but I've highlighted in red what's specific to rental. You will search and find a product and then you will have to select a rental period. So if you rent a lawnmower or whatever, how long do you want it for? Four hours, a day, two days, you know, whatever. So that's something that you need to consider. You add it to the cart, you check out, and then of course there's the pickup. You need to pick up the lawnmower, whatever, and you need to return it. That's the customer's point of view. So not so common and more or less we can see that there are roughly twice as many steps as our simple buying workflow. From the store's perspective, it gets a little more complicated. Again in red, what's different, the rental period. So what are the time units? Is there a start date? Is there a name date? What about availability? If I have four lawnmowers in my store, do I have one available for you or something like that? And the booking system, the inventory, that's all, those are all considerations. And I've put two stars to some of those elements because they are more complicated and more challenging if you want. There will be rental period price adjustments of course because if you rent something for a weekend, there's a price for that. What if you rent it for two weeks or two months? The price will vary according to that also. Moving on, five, six, payment method. I've added the internal budget codes because the use case that I will be presenting is basically an internet. So there was no payment but they needed budget code so they needed to be able to add a whole bunch of tools to the cart and then pay with an internal budget code. So that might be a consideration. And of course the pickup and the return is a little more complicated from the store's perspective because I need to check that the lawnmower that you're going to go away with is functional before I hand it over. And the return is again, I have to receive, check the product, other penalties, final invoice. So it's just the issues or the considerations keep piling up. So renting can be, there's a lot more to renting than you might think. Other important consideration, adding products to the cart one item at a time usually works but it may not cut it. A bulk at the cart functionality may be essential in your case and we will see that later depending on the size of orders. A proper booking system for automatically managing inventory is an important consideration. Can anyone think of more considerations about rental stores? Things that you would have to consider by recurring rentals, that's possible. Membership, what if I'm renting videos, not necessarily movies but what about teaching videos and stuff like that. So that might be membership, I might have to consider memberships and I might have to consider user accounts and more. So there's a lot of things there. So summing up, the first part which is the workflow analysis, renting is not like buying definitely. The back end requirements do get very rapidly complex. Sure it's like buying, there's a cart and there's a checkout process but there's a lot more to it. It's like the tip of the iceberg. Alright so now that we have a basic sense of the difference between buying and renting, what can I find on Drupal? So basically if you do a quick search with keywords Drupal, 708, e-commerce and rental, you will find some interesting results. Presto comes up pretty quickly. Presto is a distribution, so it's a Drupal 8 e-commerce 2.x distribution. Everyone knows what a distribution is. So basically if you want to quickly start playing with a fully functional e-commerce site, Presto is the way to go. You can install it on simplytest.me but it has no store. So you will only see what it looks like but you won't be able to play with the store. So if you want to play with Presto you can have to install it with Composer. That's the only way. So everyone comfortable with Composer? I wasn't so it took me a while. There's also Easy Booking. Easy Booking is a distribution but it's for D7. And it's basically geared towards bed and breakfast, Airbnb, hotel room management so it's pretty cool. And Easy Booking uses the rooms module which is pretty useful also. And finally, BAT. BAT is a module which is wrapped around a PHP library and it's a booking and availability management tool. So it would allow me in my rental store for example to be able to know which lawnmower is out when it's coming back etc. So searching on Google you do find things but not so easy. What about on Drupal.org? Drupal.org I did some just for fun but I did some searches and if you search with the keyword commerce you get 1600 modules, 27 distribution, 47.x. Of course it falls dramatically for Drupal 8. Drupal 8 represents about 13% of the offering of whatever content available regarding commerce. What if we refine to stable release? Again, the modules for Drupal 7 there's quite a few of them, distribution also. But if you go to Drupal 8 then it falls down to basically next to nothing. Drupal 8 represents 8% of the offering. Of course that's understandable. Drupal 8 is, although it's more than a year old, it's taking a lot more time to mature. It's much bigger. It has a lot of new technologies into it. So don't get too caught up with stable releases because, I mean, might as well pick up bowling. You won't get anywhere. You'll be using a lot of dev versions. Of course, Google commerce 2.x just was released recently as a release candidate one. Make sure you take time to read the project page of the module, of the distributions, explore the issue queues. There's a basic stuff but if you don't do your homework you're going to get hurt. Again, just as a reminder, when you look at the Drupal core release, Drupal 837, the next patch release of Drupal 8 blah blah blah, and if you need stability and features from the widest variety, Drupal 7. So if you have to build a store today, I would say as a site builder or if you're a solo kind of shop, you're a one guy or one woman shop, Drupal 7 might be a better bet. If you're really keen or you have a client that has deep pockets and a patch on the shoulder saying, don't worry kid, we're a big company, then maybe you want to go to Drupal 8, as long as you have enough time to learn all the stuff. This is just again a quick look to play commerce 2.x releases. I just did that for my own kind of, okay, so just give me a sense of where I stand. This was before release candidate one but it gives you an idea of what's happening. The D8 installs of commerce represent 1.3% of the 65,000 commerce installs. And this is what commerce looks like. July 2014 was commerce 2.x, the very first release of the dev. It reached 60,000 installs a year later and it basically peaked at about 72,000 last year. So that's commerce. As comparison commerce kickstart which is great for Drupal 7 because it's a fully functional distribution that a lot of people are using to start commerce shops. It has peaked two years ago and it's peaked more or less coincides with the Drupal 8 development ramping up. So it's kind of going down now because it's getting less input from the folks at commerce guys. It's like a lot of the developers have migrated from kickstart to, of course, Drupal 8. So that's the basic what's available commerce-wise. So let's look at this post-mortem. So this is a real life time. The objective was to create a commerce kickstart to better manage equipment rental internally. So this is an intranet thing and it's for a multinational. So basically they have many, many, many, many productions and they have an internal store where they rent all the tools, the stage stuff. And they were doing that on Excel sheet so they figured maybe we should move to something else. The implicit objective maybe from my perspective was to make Drupal commerce do something that is not really made for out of the box. So the main project task of course import a thousand products using CSVs plus the images. To implement a rental pricing scheme, not much information exists about that so we had to kind of sit down, draw and figure it out. And also they really wanted to implement a one-click bulk at the cart. For them it made no sense not to have that because they have orders of 60, 80, 90 items. They don't want to do that one item at a time. What I mean by that is I don't mean 10 quantities of product A. What I mean is product A, product B, product C. They have like 60, 90, you know, others. We'll see a little more about that. So importing the 1000 products of course everyone is probably familiar with commerce feeds and feed stampers. Everyone familiar with those modules? You will need to import twice because this is a Drupal 7 project of course. You will need to import twice because the first import you create the product entities, the Drupal commerce product entities. The second import you create the product displays which are nodes. And a node can have 3, 4, 5, 6 product entities. So the entities, the product entities need to exist first before we create the product displays. And that's what this says. Pre-requisites. Of course there are pre-requisites. If you're going to import you need your product types, right? And you need your product displays. And you need CSV files too for creating both entities. And the CSV files is, how do you say Pierre Angulat? It's the cornerstone of your project. If you have a dirty CSV file and you try to use that to create your products and your product displays, it's going to be hell. So you know, I would say when the client says, oh here's a very clean file. Look at this. Two days later you're going to have a clean file. So make sure that the CSV file that you get is properly suited, is properly cleaned up. So what's, and we're going to go right now quickly to some basics. But what's a product type? Well the product type is the same idea as the content type. It's a template to create specific products. There are physical products. There are digital products. Of course t-shirts, books, tools, cars, those are all physical products. In the store that I'm talking about we had I think nine or ten different product types. And the reason for that is because different products need different fields to be able to define them if you want. And also almost at the end of the project the client said, oh yeah, by the way, can we also make them purchase the product? So I needed some product type that would be rent only and I needed some product type that would purchase also. And digital downloads are good examples of digital products that you might sell. Membership, tickets, rolls, whatever, events also. The type of fields that you find on a product type are of course skew, title, price, status, images, and attributes. Attributes are very important and we'll talk more about that. Created products are all, nomenclature in commerce1.x is a bit confusing. And when you move to 2.x some things have changed names so it's more confusing but it's, yes. I was just wondering, do you have any tools that help import these products that you use for people? Yes, I just spoke about that. It's feeds, commerce feeds. And we'll see, I'm going to show a little example of how this is done. So product variations, commerce product entities, those are back store entities. By that I mean customers usually don't see products or say product entities. Alright, so importing the products, the prerequisite was a product display. A product display is almost just another content type. It's a template again. But it has one difference, it has a product reference field. So any content type, if you add a product reference field to it becomes all of a sudden a product display. There are also nodes at product display node, product reference node, product display entities. So this kind of mix of language is at one point it gets confusing. And of course the product display is the front store, it's the user facing entity. And here's a little bit of graphic of how this looks. On the left we have the store, on the right we have the back store. So on the left the store that's the product display. That's also what I call the parent entity. The parent entity because you need the product display which is a node to house the product entities themselves. Which are the product variations. So you have a name, an image, a body, a description. Be careful because the description here applies to all your variations. So if you need a description which is specific to a product entity you're going to have to create a field at the product level and rig it in. Like let's say product specs. So product specs would be at the product level and it would show in the node display. But it would be different for every, or it could be different for every variation. Is that clear? Okay, importing products, prerequisites. So you need a good CSV file. Everyone knows what a CSV file is. It's your ticket to bulk create everything. Product variations must have a unique SKU. That's one of the... So when you create your commerce product entities the unique identifier is the SKU. So you need a SKU for every entry. The preferred price for Drupal commerce at least in 1.x is what they call raw minor units. So the price that you will put in your CSV is not 9.99 but rather 999. Okay, we'll see an example of that. And again, you will need those two CSV files because you first create your product entity and then you create the product display node. So here's what it looks like. So the first... At the top of the page what we see is the first CSV that allows me to create the various product variations. So we have a number of columns here. We have the SKU category, subcategory, name, price. Notice that the price which is here... Can I do a select? Which is 137.150. So that's in raw minor units. Also we have price. We have rental price. We have length. And we can have any number of attributes. Of course you can also import images. And if you import images you want the path to the image. Yes? How do you determine the SKU? Okay, so SKU basically... It's up to you. There's no module that will create SKUs automatically for you. Although some things exist. But basically your SKU needs to tell you what's the product and it needs to tell you what are the attributes. So if I only have one attribute which is 4, 5, 8 and 10 feet it needs to be reflected in your SKU. If it's not reflected in your SKU how can you tell the difference in your store between like the 4 feet whatever range and the 10 feet range? There's no way to do it. So basically for every attribute you need a specific SKU. So for t-shirts if I have size and color as attributes then I need something like maybe TS and then some kind of short code for the colors and a short code for the size. That's the only way to... But you're on your own to come up with the most appropriate SKU. Again, don't spend some time really looking at how you want to describe your product with SKUs because once all your products are in it's kind of difficult to change all your SKUs. You can get all SKUs up. Okay so that's the top part. And the second CSV file it's basically the same information. The only difference is because here I will be creating node product displays all the product variations that belong to the product display appear here in the common separated list. So that way when the node is created these product entities will be added to the node automatically. So that's why you need those two files. Question? All good? Implementing the rental pricing scheme. This raises of course many questions. How do products and attributes play affect one another? What are attributes? What's a good attribute? What's a bad attribute? There are skewable attributes and non skewable attributes. So size and color are skewable attributes. But what if I rent a t-shirt? Do I need a separate skew if I rent it for one day or if I rent it for a week? Maybe not. So you need to consider that and of course depending on the use case this will vary and the big question was should I create a standard attribute to handle a rental pricing scheme? Of course this will require some thinking. Again just like SKU you need to sit down you need to you know pay per pen stuff do some models make sure that you have a good understanding of your product model, your attributes, the price calculations. I always like to think that a little paper R&D goes a long way so you know don't be shy. In hindsight keep it as simple as you can. Don't get fancy. If you start getting fancy it's going to bite you back at one point. So about attributes I think I can skip through this because I basically said anything but basically if you walk into a store and you say I want a beautiful and original t-shirt just for me I mean there's no attributes for that right? So someone's going to come and say okay what's your size what's your preferred color, yes? You were just saying don't get too fancy I was just wondering if you can give an example. That's a good question. The answer is coming I think. So I'll skip through this because we've got some more interesting stuff coming. Right size, color, those are both important attributes for a t-shirt. Remember attributes can affect pricing they don't have to but they can. Color has no effect but size usually will. Each attribute again requires a unique skew which is mostly true 99.9% of the time I would say especially if you need to manage inventory. So I didn't have my shop it was not a t-shirt shop it was a tool shop so length is a reasonable rope if we have a rope product then length is a reasonable attribute it's going to affect price right? 100 feet is different than 500 feet. If we have five options of length that means I have to create five product variations then I will have five skews that relate to the rope right? Oh what if I throw width in there? That's also a reasonable attribute again you know 1.16 of an inch versus 3.8 has a different cost so it was more so if we need three widths that means I'll end up with 15 product variations because I have five length, three width and if you had 10 load capacities then you're at 150 so beware of combination of attributes they can quickly spiral out of control so that's one answer to the question can you give me an example of stay simple beware of multiplying attributes try to bring things okay so for the pricing scheme basically this meant because we did discuss can we have different pricing scheme depending on context, product and quickly we said no no no no we need one single pricing scheme for every product it has to be a simple formula and there has to be no exceptions so this was a discussion with the client and the client understood that okay maybe he wouldn't get the exact price he would like on the different objects so he would have to adapt to a formula that we came up with and that was close to most of his request but not exactly dead on so here's what we came up with basically on the left that's what the client needed so there was a base price so the one day is your base price so and it will be very useful later on you'll see and then a week, 15 days, a month and they also added purchase at the end so we needed some kind of formula that can account for all that and on the right you see the key value pair that ended up in the field so it's basically but we will look at that so the simple formula was to okay can we have a unit price start with a unit price and we kick in some kind of operator is it plus, minus, is it a percent, blah blah blah we need a factor and then this will give us the final price this is what we came up with so if you have a unit price of $1 and the operator is multiply then the key in the key value pair for one day one day is one so you stay at the one day price and after that it was 3.5 for a week 10.5 for a month all the way to to $195 for purchase so basically we looked at all the prices of every product and we found the best way to fit their prices and the $195 for a purchase is there's no exception so the client really had to to really figure the unit price very precisely so that things would work out in the end but this was a big savior I mean just having the client say okay I can live with prices that are slightly different from what I want just to get that single yes I see that the formula that you have there is like multiplying could you do something like using a rate like if you had specific prices for types of products you know what I mean could you use an array that has absolute values I guess you could do you know what I'm getting at right? yeah you could do anything you want like a factor like having it linked to an array that has prices associated yeah you could do that I mean again my perspective was from a site builder's point of view what's available what modules can I go get start using that will make this work with no coding almost it could be but you would have to write the module right which is fine you know but you would have to write the module there's no module that no I mean there's very little as far as renting because it's not a very common use case thank you you could use rules yeah you could do that I was looking for again existing modules see how they could work you know like you find a solution and then someone says hey you could do that too you could probably do it maybe it would have implications so kind of there are many ways you know Drupal is there's 50 ways there's 50 ways to do the same project is that specifically just for rentals no but this is adapted to a rental use case so remember the question should the rental period be a standard attribute the short answer is are you out of your mind because we you know remember that rope you know five length three width and if we have 10 options in the rental period that means that all of a sudden I have to create 150 product variations from my little room you know and that's one product out of a thousand so makes no sense and no sense also yeah just doesn't make any sense so we had to find another way and this implementation is one solution so if you look to do this something like this in D7 right now you can do this using three modules you need commerce product option which allows you to create option sets and these are non skewable attribute it's basically a non skewable attribute you it has a dependency and then you need commerce pricing attribute basically the choice of operator it comes from commerce pricing attribute you know you could use a plus if you want a percent also I use the multiply and works pretty good in the end sorry so that's the that's what exists now and works the only issue is that since the store was launched a commerce pricing attribute is now declared obsolete although it's being used by 1500, 1600 people it is declared obsolete and the two other modules are not seeing a lot of development so you could say it's fragile or you could say it's there, it's working every new commerce update does not break it finding another solution would probably make a lot of sense this is another solution which was essentially suggested and introduced as a best practice like two years later it doesn't use any contrib module and basically instead of using those three modules we simply add a field to the line item type with the options that we want and it works it works for Drupal 7 works for Drupal 8 I tried it in Drupal 8 and you can see it in Drupal 7 all you need after that is a pricing rule at a pricing rule and you get what you want in Drupal 8 there's some development required there's nothing available off the shelf if you want to it doesn't work with a rule well it doesn't work with a rule in Drupal 8 rule is kind of behind in development it's not really available or it's only partly available so let's have a quick look this is the D7 store so it's exactly the way you saw it so okay the only thing that you're seeing here extra is this is a bolt at the cart form and the way this works so I can filter my products look for I guess it doesn't matter but basically you see the rental period here is this requires an integration but it's there so I could say okay give me this for a month you see the price changes and I can say give me four of those let's go find something else so I'm going to find something here I need this for 120 days the price has changed and give me 50 of those alright so we can go on and on and on so barring any big issues look at our cart now see so we have this stage automation show control we've got four and the price here is a per month price and we've got these sensors which cost 47 46 per 120 days and we've got 50 of those so it works pretty good looking at Drupal 8 so Drupal 8 I'm not sure I would do a store in Drupal 8 but so I created this Drupal 8 it's pretty basic and I created the rope that we spoke about and so we do have those two attributes that works in the same way so what about the rental period so the rental period is here line item types 14 order line types order item order item thank you so it's a little more so what I want to do is so I created a field rental period in here and I can manage its display in cart right here save that go back to my product see now we have the rental period and it works does it work so what doesn't work at this time in Drupal 8 is it affecting price so this works but if I do this for 60 90 days fine and if I look at my cart so I do see right that's a previous so I do see the rope I do see the price I do see the rental period but the rental period here has no effect yet on the price because I did not go that far it would need some coding or maybe rules could help us doing that so just quickly because time flies go back here does Drupal 8 have the same product display versus product entity in functioning with Drupal yes but more and more they are hiding the product display because it's the products that they are more and more hiding because when you go into your product display well because of inline entity form you do all your stuff so it's a little clearer they are trying to that's correct but the product entity still exists and the product display still exists so we spoke about that moving on so we did see this order we did speak about the so we did see the bulk at the cart function for five products it's relatively easy to go okay find them add them to the cart but of course when the order has 60 or more lines it just takes 30 minutes of your time at the bulk at the cart is great and the module that does that is commerce at the cart extras so what this module does it does everything except the rental period column is a custom integration so basically you have to create a custom handler and views and then tie that field to the other field in D7 because we're using commerce option it's an option set so we need to tie up to this option set the new way that I'm looking at doing this so removing commerce option commerce pressing attribute putting the field on the line item then you still require the handler and views but now you connect to the line item field instead of the other one but the nice thing about that is that after doing that you get rid of three modules which are which are making your store fragile if you want summing up so we've seen how the integration of the rental period works watch out for attributes I did mention that use the same rental period for all your products and stick with that and defend it in the face of your client or or make and buy you a time bank just for doing some fun stuff the integration of the bulk at the card farm farm form some coding is required the integration that you saw is a custom integration so it's not available as a module we have not looked at booking systems the most promising project from my perspective in D7 is the BAT project so I invite you to have a look at that the rooms project offers a basic booking management for rooms so you could look at the rooms module and adapt it to your use case if you want but some code of course is required some already and we are at the question period alright that's about it maybe I'll just do a quick it's 9.54 I'll show you the Presto so this is Presto the Drupal 8 commerce 2.x distribution it comes with a bootstrap team it's very very basic I created some dummy articles it has products and they created physical products and digital products so I can whatever give me two of those let's see if it works should check the card there you go it's pretty nice this is probably your quickest ticket to playing with Drupal 8 commerce 2.x if again your machine is set up with Composer then it's just a question of installing it did I run into some issues you need PHP 5.6 above and another maybe hint is if you install commerce 2.x on Pantheon beware of one thing because commerce 2.x installation via Composer brings in some some of the packages have hidden git directories and hidden Travis directories and others and if you don't remove those before committing and pushing them to Pantheon your Pantheon side will boot so that's the only but otherwise works really nice so question is there a replacement for commerce kickstart or is there a 2.x version of kickstart there's no version of commerce kickstart and reading the various comments by the folks from commerce guys I would be surprised to see a commerce kickstart anytime soon because commerce is there's so much more work still to be done that they're not going to spend some time doing that so is Presto done by someone else it's an individual who's done it so it's pretty good there's a commerce base on kit hub it's also kind of like a distribution it has some stuff that's sort of a commerce that's for base no more questions this is good thank you