Tuesday, 31 January 2012

Installation: possible?

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 85 bytes) in /home/veganlin/public_html/X/includes/menu.inc on line 3669

This is what happens if I install Drupal 7 from my web host's installation aid, something like Fantastico or Scriptulicious, and then install each of the modules required for Drupal Commerce. I pick one that has little else depending on it - I think it was advanced help - and I get a Fatal error. From experience, I think it's possible to use control+backarrow and have another go. Sometimes the thing installs second or third time. But this is not going to be a reliable site.

The other way of installing Commerce is what the 25 minutes lecture below suggests. I tried importing the database this morning and got an error message, which is odd because I think it has worked before:

It looks as though the hardest problem with Drupal 7 is going to be squeezing it onto cheap server space and finding ways to install without overloading the memory. There is some other system I've read about but know nothing about - I don't quite remember even what it's called - is it Drush and is that the answer?

Sunday, 22 January 2012

Building an awesome e-commerce site in 25 minutes (without losing your soul)


Hullo. My name is Andrew. I work for a company called Real World Technology. We do a range of different things, but I am here to talk about a wonderful thing in the Drupal ecosystem in my opinion, and that's called Drupal Commerce. So you're probably, or you might have heard other people speaking about it a little bit this weekend. It's come-up. It's been cursed in some talks; it's been praised in some talks. I think it's one of the best things that's come to the e-commerce community as part of Drupal.

We're going to have a chat a little bit about that, and we're going to have a go at making a working, ready, production, e-commerce website, in - pretty much on 25 minutes. So all being well; no computer and technical glitches, that should be all good.

What is Drupal Commerce? [screen]
  • A modular eCommerce framework
  • Designed to let you "build" new stuff
  • It's really cool

So before we actually get-in-to Drupal Commerce, I just want to do a quick show of hands:
how many of you have built an ecommerce site before? OK.
How many of you have enjoyed the experience? I've got two hands! And a half!
Who has used Drupal Commerce before now? OK: we've got a few people around.
How many people have used Ubercart? OK: a few more of you.
Magento? Yes.
OSCommerce? [two or three]
Who has written their own [holds-up his own hand]
Things not written in Drupal that do e-commerce?
Anyone used Shopify or any of those sorts of things? No: OK. One. That's good. OK.

Drupal Commerce is a little bit different to most other ecommerce distributions that are available on the market. Drupal Commerce is really a framework to allow you to build ecommerce stores and ecommerce platforms. Drupal Commerce in and of itself is a bunch of really really small modules that do a set of small, defined, contained things. And, out of the box if you just go to Drupal.org and grab the Commerce project and install it on your site, you're probably going to be finding that what you've got is something that
  • doesn't do a lot, is
  • pretty confusing, and a
  • little bit hard to get started with.
We're going to talk a little bit about that today, but the thing about Drupal Commerce, that sets it apart from everything else, is that it is a set of components that allows you to build something big. And build something better. My background: I build e-commerce sites. I've been building them since I was about 15.  The first e-commerce site I built was a custom-built site. It lived in asp.net. Or I should say "asp": this was before .net even existed. It sold products for a store. I can't even remember what it did. It had a Microsoft Access database back-end because - you know - when you're 15, Access is cool. Then you grow-up and realise that it really wasn't, but that's OK! That was the first site that I built. Since then I've built sites on Magento; things built on Zend framework, some stuff built on Syphony, ran a very large website built in OSCommerce for around five years. So I've had a bit of an exposure to what's available in ecommerce platforms, and building different things. And together with my company we've built web sites for some very very small people, through to some very very large NGOs and other organisations that wanted to extend their business onto the internet.

The thing that I found, time and time again, is that when I go and I download something like Magento, or I go and I download something like Ubercart,  I discover that, provided that what I want to do works straight out of the box, the solution is absolutely perfect. But the moment that my customer comes to me and says "what I want is X and Y and Z", and I can't quite do it; the modules don't quite get there or I can't change what I want easily.... I end-up hacking something together and making changes and doing things that break my upgrade path. That in the end means that the customer gets a solution that they're not really happy with. It just becomes a bit of a mess.

I see that Drupal Commerce addresses a number of these issues, by - instead of trying to be something that is all things to all people out of the box - it tries to be building-blocks that give you pieces of the bigger puzzle. So: it's really cool like that.

What does Drupal do? It does most of the things that you'd expect an ecommerce platform to do.

What can it do?
  • Manage products and display them
  • Manage orders
  • Take payments
  • Calculate tax
  • Give discounts
That's what it will do pretty much out of the box.  We can also handle shipping; we can do stock, we can do coupons and vouchers. Some of those things might not sound like very big business goals. But I started using Magento when it was a 0.9 release. It was the coolest php-based shopping cart system available on the market and probably one of the best that was available at the time. It had a nice UI (user interface); a nice customer experience that was only rivalled by some of the really really big ecommerce stores. But then we wanted to give coupons to our customers to allow them to buy on it. They only realeased that module into the community about 12 months ago. That's like three years after the product was there. But Drupal Commerce has it today there right now. So they are really quite good.

What are people using Drupal Commerce for?
  • Everyday online stores (eg ozonekites.com.eu)Today if you are online you can go and jump on there now. It's an Australian-based store. They sell kites. It's pretty cool.
  • Membership websites (eg subhub.com)Dries mentioned in his keyonote [speech] this morning Subhub.com. Subhub is an example which I've come accross which is really unique. They have a Drupal-based-web-site that sells Drupal-based-web-sites to sell stuff! Which is, kind of, a bit of inception, but it's pretty good! So you can go and you can buy a website from Subhub to sell subscriptions to your magazine. Or to allow you to download music from your music-band-thing that you play in or record for or something like that. It's pretty cool.
  • Discount style websites... is another unique thing. Someone has gone and built an entire clone of the Groupon website, in Drupal Commerce, packaged it up as a Drupal Distribution, and you can go, download that, install that on your web server, add a bit of theming and bits and pieces: and you've got your own Groupon site. And you can give your friends and family discounts to - I don't know: whatever it you want to give them discounts to. Or however that wants to work. But it's there. It works today right out of the box.
  • Donations (eg ioby.org)... and there's
  • Many more (see drupalcommerce.org/showcase) There's a long list there. That's only half of what Drupal Commerce is doing out-there in the wild today.
One of the things that I promised was that we were going to build and awesome Drupal Commerce website from scratch in only 25 minutes. So let's get-in and do that. We've only got 13 or 14 minutes left in this session!

Installing Commerce
  • So, we're going to Start with something called the Commerce_Kickstart install profile
    Commerce Kickstart is basically a full Drupal 7.10 (at the moment) distribution, with all of the Commerce bits and pieces ready to go, which you can download. Install on your web server [if it has the capacity which cheap ones don't: you have to install from a database]. Follow the install script. And have a functional working Drupal Commerce website.
  • But it's really designed for being used in the US. So what we're going to do, then, is: we're going to grab the Commerce_Australia module for some country specific configuration - which has some configuration for currency display and GST Time, and it just makes it easy to get them up and running, and install that, and taht's what we're going to do to start with.
  • Let the fun begin
[...] [8' 20 seconds]
I've pre - downloaded an installer module onto my machine, set-up a web host: all of those sort sof things

OK, it's going to run away and it's going to install all the modules. It's going to configure everything as a kind of a base starting point and get us ready to go, and when this is finished in just a few seconds we'll get to the configure site . I'll set some settings like you would if you were normally installing Drupal. And then we install some example stuff. And we wait. This is probably the most boring bit. If anyone feels like donating me a faster macbook pro I'll gladly accept.

The advantage that the Commerce Kickstart module has over downloading Drupal and adding the Commerce module is that there is a bunch of things that you need to get Commerce working. We'll talk a little bit more about some of those things in a minute but there's a lot of dependencies, which are normal things that you'd probably run on your Drupal website, but the Commerce Kickstart distribution has those things in it from day onee. So you don't need to worry about those sorts of things. You can install it in a Drupal site if you've got it up and running and add bits and pieces. We're just doing it this way because we have limited time, because I set  a rediculous time limit!

We're going to call the site... I think we're going to sell some Ferraris. [see screen] Save and continue.
We're going to put some example content in because it makes our life easier. In case you were wondering, we have now been running for three minutes out of our 25 minutes, and we now have installed Drupal Commerce, and we have a working functioning ecommerce store.

  • I can add products to my cart
  • I can view my cart
  • I can make the quantity five
  • I can update my cart
  • I can checkout
  • I can fill-in some details and go right through and it will work. We'll look at that a little bit more later.

What we're going to do is we're going to do a little bit more than that; there is a little bit more to be done.
This is what we're actually going to build. We are going to build the Drupal Downunder 2012 Farrari Store. We are going to sell Micky Mouse cars; we are going to sell Honda Civics and Farraris - maybe. We'll definately sell Farraris: I'm not so sure about the rest of them.
A couple of things that Commerce can do. One of the nice things is that it groups products together like this [attributes] so that we can have a yellow Farrari featuring red starbursts; we can have a lime green Farrari. You'll notice that as I do this it updates the displays and it changes the price and the text and you'll see that there's some features on some of these cars: I think the yellow car features starburst paint. They're all updating nicely in the background. As a website developer, and a themer (and bits and pieces) I've done nothing to get that working out of the box. It's just there. It just happens. It just works. No effort involved. Straight working, day one. [so why can't I do it?: because there are no instructions. Will the nice man explain?]

The other thing that we are going to do, if I actually add this car to my cart - we'll just jump across to the checkout. We've got our starburst Farrari here at $59.95 . We've got some shipping in here. There's no [?] doubledation on this. Whatever. We're not going to talk about that today but it can be done. We've got some shipping and we've got two different shipping rules. If you've got a product that you want to sell for less than $100 - or less than $50 in this particualr store - you'll get $15 shipping charged. And when your cart value is over $50 you get free shipping. So the idea is that you might want to give some particular shipping to some people, or if they are some kind of VIP customer or things like that: all sorts of things that we can do. We can go right through [as a customer], confirm, put in some payment details, and then magically checkout is complete. I can view my order, and see what I have bought. I can go into my account and see what I have bought before. I've got a few orders in there including one that's been deleted and one order that's been completed. I can come in here as an admin; view some orders. See what's been - ordered. I can delete an order. I can modify the payment details. These are some of the things that you can do with Drupal Commerce straight out of the box, mostly, without too much work.

Understanding the Workflow
Install Commerce>>Confirgure Currency>>Configure Tax Rates>>Build Product Types>>Add Sample Product(s)>>Build Product Display>>Configure Shipping / Payment methods>> Add more products and displays>> Test and Launch?

how to we go about actually getting from a base install to something that is relatively functional; which we can use to delivery an e-commerce product to our customers?

So the first thing that we do is that we
install Commerce. Relatively straightforward.
Then we
configure the currency settings. By default Commerce installs, running in $US. Not that that's really a problem, but you probably want your store, if you're in Australia, to be running in Australian dollars.
  • We set-up some tax rules and tax rates.
  • We build our product types - and I will explain a little bit more about what that is in a moment.
  • We add some sample products.
  • We build product displays.
  • We configure shipping and payment methods.
  • We finish populating our store.
  • We test it to make sure it's working right
  • Then we go live and we make lots of money because everyone makes lots of money when they launch an online store. [laughs]

Understanding Rules
Rules govern the operation of each element of the store - including calculating prices, discounts, checkout steps, add-to-cart rules, confirmation emails, user registration.
The first thing about Drupal Commerce is that it makes use of standard Drupal ways of doing things. So there are some key components of Commerce which live in the background and aren't immediately obvious. They make Commerce work and really really sing when it comes to Commerce being a good ecommerce tool. The first thing is Rules. Rules drive Drupal Commerce. Rules are your business logic that detirmines how your ecommerce store works. So you have Rules to calculate tax. You have rules to detirmine whether you can add a product to your cart. You have Rules that set what shipping method you can choose. You have Rules that detirmine whether or not the user is allowed to check-out. You have a Rule, and there's actually a screen-shot of one here, that detirmines what emails get sent to the customer when they purchase the item, and whether or not you as a store admin get the email. You have Rules which integrate Drupal Commerce with your back-end ERP system. So if you have something like AdEmpire [?] or you're making use of a financial package like, say, Zero or Sassuu or something like that, someone can write modules that interact with those Rules, so that, say, when you place an order it triggers the invoice to be created in Zero, the payment to be recorded, and all of those thing fit together very very nicely. Now: no-one has done that yet, but it is entirely possible within the way that Drupal Commerce works.

Understanding Views
Views display (almost) every part of the store - including order lists, the checkout, shopping cart and product listings.
The next thing to say about Drupal Commerce is that it relies heavily on Views. So Views is a way of representing data within your website. You can have Views that display nodes; you can have Views that display all kinds of different things. One of the neat things about Drupal Commerce is that pretty much whenever it displays a list of stuff, it is using Views. So if you want to change the columns that you see... One of the common things that customers say to me is that "We've got our web site, we've got our admin section; we've got our product listing, and we want to change the order of things". So: take something like Magento. You can print a picking-list out of Magento, which my default shows the product code, product name, price, and that's about all. And if you want to change that, you've got a change a bunch of stuff:
- you've got to change a bunch of XML files
- you've got to change a bunch of PHP files
- change the way that that all comes together. It's a little bit messy and a little bit nasty.
With Drupal Commerce you jump-in, you edit the View; you edit the column, and you're done! It's really nice. Really really easy. You want to display the SKU, so the part code appears in the shopping cart: you just go-ahead and you add the column. That's the way that it works. It's really really nice because it makes use of standard Drupal features, that people who are used to building and assembling Drupal websites use every day and night.

Understanding Products
A product is an item you want to sell, and is an "entitity". A product contains all the important details about an item, and there is generally one for each part code in the catalogue.
The next thing to say is that Products are not Nodes. If you are coming from a Drupal 6 mind-set, where everything is a node, it's really important to understand that products are not nodes. Products are products, and they are displayed using nodes. We'll talk about product displays in a minute. A Product is essentially a group of fields, which is a group of information about a product. So a Product must contain an SKU - which is a part code; a product must contain a name, and a product can (but doesn't have to) contain a price. Most products will contain a price. Although some people want stores where they don't actually want to sell anything - they just want to put products online. So those kinds of things are there. But say you wanted to record the colour of an item. You can add a field to your product type that has a colour in it, much in the way that you can add a field to your content type to record the information. But they're distinct from product types.

Understanding Product Displays
A product display groups one or more products together for display, and is a "node". Product displays usually contain descriptions and formatting rules.
Prouduct Displays groups products together into logical groups. So an example which I have been (kind of) thinking-through is... Say I was an Apple reseller, and I wanted to sell Iphones. There's currently eight or nine different models of Iphones you can get. But want I want to do is have someone come to my online store, and be able to pick-up, or go to the Iphone page and have all of the different options listed there together, so there is one page for them to go and see. I don't really want them to go to a page that has the 34gig Iphone, the 64gig Iphone, and black and white - and there's way more than six models I've just realised - I want them all grouped together in a single node. So that's what a Product Display is: it groups products together in a form for display. And you can add extra information there. You can add descriptions - in fact, any field you want to add to a product display, you can.

Understanding Currency
Multi-currency aware. Products can be priced in more than one currency. Currencies can be selected based on rules.
Currency is the next thing we are going to talk about. Drupal Commerce is actually is multi-currency aware. So if you wanted to sell products in Australian dollars and US dollars and  New Zealand dollars and British Pounds, and Yen, or whatever it is you want to do, Drupal Commerce on day-one out-of-the-box supports multiple currencies. By default it has not way of converting between currencies, so if you put prices in in Australian dollars, it won't go and work out what the price is in US dollars or something like that. But there's no reason why you could not do that, if you wanted to. Most people probably wouldn't want to do that because they want to sell in nice numbers, so they want to sell at $49.95 in Australian dollars and $199.99 dollars in the US or however that works.

Which currency people see can be selected using Rules. There are modules which will tell Rules what country someone is in. Rules will detirmine on the basis of that what currency someone should see when they look at your store.

Understanding Taxes
Taxes are very flexible. Consist of Tax Types and Tax Rates. Fully managable by Rules.
The other thing that we'll quickly touch on is taxes. In Australia taxes are relatively boring. There's just one single tax for everything and that's called GST (Goods and Services Tax). It's about 10% of the product price. Most of you probably deal with that when you deal with everything you buy. In other countries there are other tax rules. But say you wanted to sell houses using Drupal Commerce. In New South Wales where I am from, we have this thing called Stamp Duty. Stamp Duty is 1½% of the sale price. So you could have a tax rate for Stamp Duty within Drupal Commerce, know when to calculate that Stamp Duty using Rules, and correctly apply it to the products, using  Rules, all automatically, without having to do anything. So you can have mulitple tax rates, multiple tax types; you can display prices including, excluding: all those types of things. You can have taxes not on. In fact - a kind of self plug here - the Commerce Australia  module which you can download from Drupal.org, it has a rule in there which says "If you are in Australia, charge GST, and if you're not in Australia, don't charge GST", because if you ship the product outside of Australia then you don't charge GST on it. When I used to run a website in OSCommerce, that was a big pain whenever someone placed an order from New Zealand, because we had to take the GST off and modify it and a bunch of things like that, and it didn't do it well, and then we tried it in Ubercart and it was even worse. So it just works out of the box, day one. Great.
So lets actually get-in and do this. We've got 25 minutes from now. Maybe some time for questions. By the way, feel free to stop me at any time and ask questions on what we're doing.
This is the website we've just installed.

Saturday, 7 January 2012

I'm probably not concentrating on this properly, but "installing products on Drupal Commerce Bulk Product Installer" seems to be a video about how to use pre-set data, without any instructions for setting-up the data. I hope to crack this, because it's the only Drupal Commerce setup video I've seen that's like a set of instructions for driving a car for the first time rather than a review of how the car compares with others.

I think the cruch is the instruction "So I have this Genre field created here." - how, Mr free teacher? Maybe with enough twiddling I could discover by accident.

Sadly, Drupal Commerce is very weak on bulk product installation as its writers admit, so a video in broken english about how to install data which was installed before the video is a frustrating thing to try to use.

Monday, 2 January 2012

installing products on Drupal Commerce Bulk Product Installer

Vimeo.com/34385004 - video -

Hi this is Pedro Cambria from Commerce Guys in another commerce module video. This week I'm going to show you how to use Commerce Bulk Product Creation Module. This was the first contrib[uted] module created for Commerce, and allows you to bulk-create products. Basically if you [...?...] of your SKU, or you can generate your SKU easily by tokens, this module is going to be ideal for you. It manages the creation of the product, but also, when the product variations are created, this module has also [got] options to manage the displays associated with these variations. What this module doesn't manage, as yet, is to edit or modify the products once created. [1']

OK. For this demo I have Commerce Kickstart installed, with these modules already installed: you need:
  • Commerce Bulk Product Creation commerce_bpc, and we see also the
  • [included but to be enabled - "Just to be sure: Did you enable the "Enable this field to function as an attribute field on Add to Cart forms." under "Attribute Settings" in the field settings of the taxonomy fields? This is currently required."] Taxonomy Reference Integration bpc_taxonomy
OK. I have also a couple of product types. If I go to Store>View Products>Product Types tab, I have a
  • Product with a single attribute, and a
  • Product with taxonomy attributes to demonstrate how this module works.[So how do I get one?]
OK. The first thing you need once you have installed these modules is to have a
Field (Store>View Products>Click on product created with a single attribute>manage fields) [2']
or some fields of list type . Also boolian. And if you have the taxonomy_bpc module installed you can do this with taxonomy fields as well. So I have this Genre field created here. It's a list of texts. And here [further down the page in a box] you will see Bulk Product Creation options. We are going to use this field for bulk product creation operations. And we have that field that's an attribute in the cart. So. We have three allowed values [in the allowed values box]

For Bulk Product Creation you have to go to
Store>Products and in the Product listing you will find [just before "add a product"] a link [3']
"Bulk Add Products".]
If you click here you are prompted to select one of the product types you have more than one that are eligible to be created by this massive operation. If you have a product type without any field that is eligible for this, it won't display and you won't be able to use this module. So if you don't have a list field, a boolean field, or taxonomy fields, you won't see the options here.

Let's select a simple one. You'll see the interface of the module. [headed "Bulk add Product with a single attribute" in white, and "Bulk Product Creation Form" in black] Let's go step by step.
  • First you have the Product Information. You can field [used as a verb meaning to fill-in the box or field] the SKU. This uses tokens to generate the values. Let's call it "PRODUCT". On the right side you will see ["example variant SKU PRODUCT --Action"] an example cocaffeinated [?] as an example. It gets these examples [Genres: Action, Comedy and Drama appear] from the combinations. You need to set a price - a fixed price - for each variation. And a Title. That works the same way as the SKU [in being a form field to fill-in]. So you can see an example of how a product is created. You can configure this and we will see that in a moment. 
  • Then you have the combinations. [headed COMBINATIONS in blue]. The combinations you can select. For example if you don't want to get Comedy generated you just fill this out and it won't generate it. Or you can select everything. [all options shown highighted in white on black]. 
  • You also have "STATIC VALUES" [a blue heading to a box at the bottom of the screen]. You have combinations, and if you have fields that you generate as static; it won't generate any combinations for that.
We have create products; we have create products and create product display. So let's create product display in a minute. If you click - this has actually generated three new products. There are the three products that are a combination of our fields.

You can configure how the bulk product creation module behaves. If you go to store>configuration>bulk product creation, you have some options here [on a page headed "PATTERNS" in black under "Bulk product creation" in white]
  • You can define the SKU pattern, [6] with whatever separator you want, or whatever.
  • The Title as well.
  • And you have Tokens support for this. Some of the tokens you can use - title; a combination of values, and also you have the  
  • display node settings.These are very interesting because here is where you decide if you want to create a display associated with the product. You can have the [radio] button "save and create display" [selected], and you will get into a pre-populated display form with the product generated. 
  • You can avoid [destracting attention] from the user with this. You can [as it says on the screen] silently create a display node automatically, so the user won't notice. An excellant way to start hiding the user's display if you don't want the user to see that.
  • You can also create a display for every product. [it says "create a display node automatically for every product created] These [top two radio buttons if either is selected] will create a display for all the products created in a work operation, but this one will create a node for each product; it will associate 1:1.
  • And you can hide the display node fortunately. [this is the last of the 4 radio button options]
Let's use this first option [of the 4]. [Going down the screen to settings for created display nodes] You can also select a content type for the node created.

[Going down the screen past Tokens to "after successful bulk creation, send the user to -"
There's you're redirection. By default you get redirected to the list of products [first radio button] but you can also select a custom location and set the path here. So let's select this and let's...
...take a look at our other product type. We have a second product type with taxonomy attributes. I created a couple of taxonomies - one for colour and one for size. Size and colour and associated term reference here. So they are exposed to the bulk product creation, and also exposed as attributes in the cart form. OK. So if I go to products>bulk add product with taxonomoy attributes , I will have the same product information here for the fields SKU, Price, Title. Here [appearing to the left of these fields on the form] are the examples of what it will look like. So you have the combination. And here [on two new drop-down select menus below] we have all the combinations we want. If we select all of them we are ending with nine products created, but you could also avoid to create a combination for a small size, or just create it for a small size. If you have many fields, all of the values are going to be displayed here, so you can safely select whatever you want.
So after the field creation settings, let's create the product and create the display.
I'm going to end. This is the Node form. It created [states "successfully created nine new products"] nine new products. We are in the product display creation form. When you are here you can fill all these fields for the display. And here in the product selection you will have [in a separated list] all the nine products that we have just created. So we save this [presses save; goes to the front page]. We have the product, we have the size, and we have the attribute form created.

So check the whole [node] page [on Drupal.org] for the latest changes because this module is in active development. [11] There is a 1.0 branch that is stable, and all the new features are committed to the 2.0 branch. Bug fixes are of course committed to both branches. Thank you to Sven Laeur for maintaining this module and keeping-up to the active development. And also, if you are using entity reference with Commerce, you may want to check this entity extension; this entitiy reference integration ... which allows you to create values based on the values of the entity reference field.

I hope you enjoyed this commerce sworay and see you in the next one.[answers on a postcard please]

Sunday, 1 January 2012

C:\WINDOWS\web\svhost.exe Windows cannot access the specified device, path, or file. You may not have the appropriate persmissions to access the item. I'm using Windows XP and have tried a registry cleaner. This error doesn't seem to effect much except the deletion of certain files, for which I'm using http://www.emptyloop.com/unlocker/. Looking around on the net it seems tricky thing to solve. The problem started when I had both Bitnami and Aquia Drupal Stack installed and continues after removing Bitnami.