Tuesday 26 February 2013

Ambiguous instructions and hidden costs

  • Ambiguous instructions
  • Hidden costs

These are the problems for Drupal, made better or worse by evangelical support from people who give lectures or go to groups. It seems rude to someone who is saying "straight out of the box" in a lecture that the thing does not even turn-on for some parts of the audience. It seems rude to parts of the audience that a product does not work from available instructions, and incurs hidden costs.

Just for now I will experiment with Wordpress E-commerce but hope to come back when the first textbook writer dares put instructions in print. I have paid my deposit.

Wednesday 13 February 2013

Inline Entity Form Module

https://vimeo.com/40933753 - I hope this transcript is copied and improved by others. http://lbt.me/Wyw is another page on the same subject, mentioned on the module download page.

http://commerceguys.com/blog/commerce-module-tuesday-inline-entity-form


Hi!. I'm Bojan and I work for Commerce Guys.  This is Commerce Module Tuesday. Today I will show you the  Inline Entity Form Module. [included in some commerce kickstart installations]
It provides a complex widget for reference fields that allows to modify and delete reference entities inline, as well as at
For Drupal Commerce, this means that it solves two important use-cases.
  1. First of all it unifies the management of product-displays and products, allowing you to handle both, from the product display, and edit pages.
  2. Secondly, it also provides more flexible line-item functionality, giving you the ability to modify custom fields that you attach to the line items.

The management of Product Displays and Products

[there is a comment below which might make sense of this]

Let me show you what I mean. I have here a Commerce Kickstart 1 installation [the one with Product One, Product Two, Product Three on the front and a standard Drupal admin menu] , and I have already downloaded and enabled the Inline Entity Form module - the Beta 1 version. [which is included in Commerce Kickstart 2 by default].

Lets imagine for a moment that we are building a website for a  company that sells T shirts.

I already went-ahead and created a new
Store > Products
 + Add product type
product type called T shirt. Aside from the usual fields like Image and Price, it also has the Color and Size fields, which point to the vocabularies which hold the allowed colours and sizes for a T shirt.

In e-commerce language, a product can have several variations. So a sample T shirt can have a new variation for each of the combinations of Color and Size, and each of those variations has a different SKU [part number]. So in Drupal Commerce this means that for each variation, you create a new Product, and then you create a new Product Display that references all those variations, and allows the user to select the correct one. So I have four sizes and four colours. I need to go to the add product page [clicks "create T shirt"]
Store > Products
 Create Product
   a basic product type.
 Create T shirt
 ...and create sixteen different products. Then I would need to go to the...
Products > Actions > Add a product
  Add Product Display
...page, and reference the sixteen products that I have created.

The product display field looks like this, at the bottom of the product page.
I can't find it on the page though. This is where, for me, the video is ambiguous and I do not know how to follow it in order to set-up shop, even after transcribing it carefully. It is better than average among the videos transcribed here, but I guess that the people making the videos do not know where they make sense or don't make sense, and that's why there is often a bit that's impossible to follow for some people watching.

Product
Choose the product(s) to display for sale on this node by SKY. Enter multiple SKUs using a comma separated list.


I'm going to go to Structure > Content Types > Product Display > Manage Fields (which is 2nd tab) &
you will see here (4th line) that we have a Product Reference Field. I am going to edit it.

The first thing is that I am going to change the label to Product Variations because it is slightly more user-friendly in my opinion. We are going to delete the help text because it is not going to be shown anyway.

And I am going to limit the product types that can be referenced to T Shirts alone,
Product types that can be referenced
Product
T-shirt
[using a tick box under the help text field labelled "product types that can be referenced" and un-ticking "Product"]
and save that [using the grey save button at the bottom of the page]
Now I am going to edit it again [using the edit tab to change screens],
Structure > Content types > Product display > Manage Fields > Product Variations

and change the widget to the Inline entity form.
CHANGE WIDGET
Widget type

Done.

So:
36'36" Let's go ahead and add a new product display now. [does so on screen]

You will see when you scroll-down that, instead of having a simple product reference field, I now have the complex vision that is provided by the inline product entity form. I have a product-variation inline-form opened by default. And that form contains three groups for all  the product information. So,
in the first group, I have product atributes,
in the second group I have the SKU, [types on in] the price, and then any other custom fields that might be added under 'attributes', and
in the third group I have variation image. [uploads image]
So I click
...and the first variation is there.
Let me go-ahead and add a few more.
[does so]
So: all of my variations are now here.
I have added all of them from the same screen: not leaving the product display add-product page, and not needing to know anything about Drupal Commerce architecture underneath.

If I need to, of course, I can delete a specific variation. For example this one
And of course I can edit the ones that I have already added
Clicking the edit button opens a form right below the row being edited, and allows me to change the inforation that I want to change. [changes a price on screen as an example].

So, I go ahead and save that [using a button at the bottom of the screen]

5'32" And you will see that it now works!

And I also want to make it possible for the user to reference multiple product types. In which case they can go back and enable the...
Product types that can be referenced
Product
 ...product as well. And now when I go back, [clicking to another browser tab] you will see that the widget has changed.


Instead of just having an "add variation" button, I also have a drop-down option to select the appropriate product type. If I click "select product" and click "add", I will get an add form for this product type. Which for example does not have any attribute fields. Different product types have different attributes, which are not shown in the table itself. Instead I have the variation title. And this one is automatically generated by the ???? form, by taking the node title and appending any attributes, if they exist.
6'30"

Of course, you can turn this functionality off if you want to. So...
I can, once again, go to the INLINE ENTITY FORM field set, and disable auto-generating of the product title.

INLINE ENTITY FORM: COMMERCE PRODUCT
Auto generate the product title

press save

So now [going back to the previous page] I now get an actual Variation Title field on the add and edit screens, allowing you full control over the product variation type.

7'00"

We currently don't have a UI (user interface) for detirmining which columns should be shown in the table. There is an open issue in the issue queues (on the Commerce web site discussion board). Feel free to comment on that. And that's it for managing products!


modify custom fields that you attach to the line items.

Lets take a look at various cases.


So: these T shirts might have the customer's name printed on them.

So I have added a custom field to the line items called Print Name which allows the customer to enter the name which they want to be printed on the T shirt. [this shows to customers next to color and size. We act like a customer fill it in with the name Bojan, then press order buttons to take this T shirt through the shopping cart]

Now, the problem occures when the store administrator looks at the orders
Store > Orders EDIT Tab
So he sees one and goes to edit it [an edit link on the line leads us to tab two of three], but he has no way to edit the print name field, and if he tries to add a new T-shirt, he can only select the product, but not actually fill-in the print-name-field or other custom fields that might be added.

One again, the inline entity form helps-out here. So I can go to
Store > Configuration > Order settings> MANAGE FIELDS tab
[looking at a table ith columns LABEL, NAME, FIELD] - you will see that I have a line-item reference here, with the line item editor widget. [the last two columns are WIDGET and OPERATIONS, which included EDIT and DELETE]. [Clicking on "edit" leads to another tabbed page - EDIT, FIELD SETTINGS, WIDGET TYPE, DELETE. We click the WIDGET TYPE tab and see a drop-down menu.
and change the widget to the Inline entity form.
CHANGE WIDGET
Widget type

And now when I go back to the same
Store > Orders
page, you will see that the widget has changed it. [the culumns for each line shown under the EDIT tab are
LABEL, UNIT PRICE, QUANTITY, TOTAL OPERATIONS, with

showing in the last column. I now have a proper edit button allowing me to change all the information on this line item, including the print name field. I can also add new items, and fill-in all the relevant information.

So: that's it for the inline entity form [module of included in Kickstart 2]. Feel free to provide feedback with the issue queue, Internet Relay Chat - and see you next week!.
 

Transcribed videos: -
[Drupal 7 / Ubercart video tutorial 7 of 10 showed how to use the default catalog module]
[Drupal 7 / Ubercart video tutorial 8 of 10 showed an alternative flexible method of showing a catalog]
[Drupal 7 / Ubercart video tutorial 9 of 10 shows how to use product kits, stock, and order states]
[Drupal 7 / Ubercart video tutorial 10 of 10 shows a simple checkout, reports, and suggests a theme]


Tuesday 25 December 2012

Happy winter!

The new Commerce Kickstart installation is OK with a few error messages "right out of the box" as they say on the videos, and seems to work very slowly. Ignoring the error messages, I know from using Drupal Core that there is a heading in the menus called performance for things like cache to turn-on and make it fast. How to turn them on in Kickstart?

  • Core Drupal 7: I can speed-up the program by turning-on the cache (but I can't follow instructions for adding a product which is tricky, so I'm not using this dashboard for my shop). In Core Drupal, I try menu options until Configuration: my speeding-up options are in a box there marked Performance. Once there, the path reads:

    Home » Administration » Configuration » Development 
  • Commerce Kickstart 7.2: I can begin to follow instructions for adding a product, but I can't speed-up the program by finding the cache setting and turning it on. Moreover, the jargon has changed. Core Drupal had nodes and now has content. Commerce Kickstart has - something I still need to get my head around, which uses other terms.

    Found the answer! There are two settings menus and the second hides a lot of tekkie stuff away somewhere where I thought I'd looked, but had missed it. It's easy to miss something called Development when you know you're not a great developer. Trying the Kickstart web site it turns-out that I have asked this question before and got an answer, suggesting that cache still does exist so I had another look.



I was going to post a great picture of a man in Pants to Poverty undies standing next to a decorated cow, but their Shopify site is down today.



Update: Pants to Poverty have a picture of a dressed-up cow back online today, and I have disabled the overlay module which helps according to guides like http://friendlymachine.net/posts/2011/5-ways-to-improve-performance-in-drupal

Update: Pants to Poverty are now on http://pantstopoverty.org.uk

Oh. That page doesn't mention disabling the Overlay module [done] and replacing Toolbar with Admin Menu as other googlable pages do. Do I loose the toolbar if I disable the Toolbar Menu? Probably. One thing I did notice is that the module list is most easily searched from the top left index to modules called "All". I used this to disable the Jiraffe module, which eats money.

A note for later is that the Boost module works on cheap shared hosting where Memcached doesn't.


https://www.youtube.com/watch?v=aJcJbKaCZJs is a Lynda.com video that shows pictures of the sites that speed-y-up modules come from, but doesn't say much about which work with which.


Sunday 23 December 2012

Fatal error: Call to undefined function field_attach_load() in C:\commerce_kickstart-7.x-2.0\includes\entity.inc on line 321

There is a new Commerce Kickstart.
Installing it is slow but possible. An option is not to use the special shopkeepers' toolbar. I chose not to, because I have been trying some of the videos on http://nodeone.se/sv/learn-drupal and wanted to use the same default tooblar, but without it I didn't manage to follow the product-adding instructions.

  • With hindsight, I could have googled "Toolbar_magicmenu" and installed the .gz file by clicking "modules" on the admin menu and using the box where you can paste-in the url of a module to install before pressing "install", and probably something after like "enable". Next, "Commerce_Kickstartmenu".
  • With a reset option to go back to the default install, I can try to do just that, using a confirmation button which says "Kill Me!", as you do.

Having killed my product-less site, I try again:

Fatal error: Call to undefined function field_attach_load() in C:\commerce_kickstart-7.x-2.0\includes\entity.inc on line 321

Two or three attempts to use control+backarrow, retype second password and click return all fail.

Attempt: I cut the question mark and everything after it from the url and pressed return. This takes me back one stage further in the installation process to a page beginning "

Welcome

Thank you for choosing Commerce Kickstart!

I click the "get started" button and fill-in the usual name for the test site. Result? (from memory)
Fatal error: Call to undefined function field_attach_load() in C:\commerce_kickstart-7.x-2.0\includes\entity.inc on line 321

bugger.

On googling the error message I find that Commerce Guys have been producing this syrup-voiced set of videos as though Drupal worked, while some 57 different people in one thread alone out of two or three. Solutions are often highly technical and require knowledge of databases and php files. I am using the most basic installation on an Aquia stack, using a Windows XP computer but it seems that software vendors are unaware of the problem and just use glib meaningless phrases like "right out of the box" instead of addressing problems.

One of the solutions posted was to "clear the database cache". I am using Aquia Drupal Stack Installer as suggested in the Tom Geller Youtube video. There is a button for databases. I found one table in this base for cache and deleted the contents. Some success: I now have a basic drupal default logon screen, but no username and password. Another table in the base - the last on the list I think - had "placeholder" for user 1 and password, so I added that and an email and tried again. Is this the start of a revived Commerce Kickstart? No.


Fatal error: Call to undefined function field_attach_load() in C:\commerce_kickstart-7.x-2.0\includes\entity.inc on line 321

I can find the file on my hard disc and have a look. Line 321 is the third last of this paragraph:

  protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
    // Attach fields.
    if ($this->entityInfo['fieldable']) {
      if ($revision_id) {
        field_attach_load_revision($this->entityType, $queried_entities);
      }
      else {
        field_attach_load($this->entityType, $queried_entities);
      }
    }  


Using Notepad++ as a handy bit of free editing software I try turning "FALSE" into "TRUE" in the file above. No difference in outcomes. I try deleting contents of the cache again. Same again. This is a bit like trying to fly without any wings and I have no idea what I am doing

here are some Ubercart instuctions. Ubercart hopes to be a shortcut to writing ecommerce sites using Drupal.
Transcribed videos: -
[Drupal 7 / Ubercart video tutorial 7 of 10 showed how to use the default catalog module]
[Drupal 7 / Ubercart video tutorial 8 of 10 showed an alternative flexible method of showing a catalog]
[Drupal 7 / Ubercart video tutorial 9 of 10 shows how to use product kits, stock, and order states]
[Drupal 7 / Ubercart video tutorial 10 of 10 shows a simple checkout, reports, and suggests a theme


Tuesday 23 October 2012

Commerce Kickstart 2 works on my hard disc now

Commerce Kickstart 2 works on my hard disc now,
very slowly, but seems to speed-up a little bit now the cache is turned-on

Installation was very very slow. It takes a lot of pottering-about and avoiding the computer while blue bars work their way from left to right across the screen over an hour or so.

Installation of the full Kickstart 2 with core Drupal installed a slightly older version of Drupal core.

Discoveries or methods: Drupal Core can be unpacked on the desktop
(with anything except windows unzipping utility which can change file names)

Every drupal standard file can be cut-and-pasted in one go over the top of your old Drupal Core installation.
(non standard files are in the "sites" folder which should not be cut and pasted)
(there are probably other complications, but this method worked for me to replace a new old Drupal with a new new Drupal within a version number)

Experiments that didn't work.
Tweaking the auto-installed Aquia Drupal didn't work. I couldn't get rid of all their bits from the control panel, nor cut-and-paste over them in the folder.

Saturday 20 October 2012

new start

Big business can pay for people to be polite to the executives by over-chargingAfter a day trying to change the Drupal version XXXfecking!x core, I decided that maybe someone else will work-out how to do this more simply in future as has been very well done for modules. I am still happy each time I download a module in a lazy way, knowing what a chore it was to move files about and read or amend text files next to them a year or two ago; so much depends on things that vary between individual users, like whether I had put my altered & site-specific files in a folder called "sites" away from the default files, and whether I have read the text tile called readme.txt which tells me to rename the default.settings.txt file to "settings.txt" and change a line in it. All fine if you're used to it and good at it but otherwise a bit like trying to fly before there were seats on cheap airlines; the choice is pay or make your own plane and ask strangers online for advice while they can't see what you are building. And if you're selling honest goods made in a democratic welfare state, there isn't the margin to pay, as McDonalds still do, to get a good version of Commerce Kickstart going.

Following the Youtube video by Tom Geller that I transcribed before, I'm using Aquia Drupal's stack installer. Can I just adapt the Aquia Drupal that comes with it from scratch? There is a nag message that says I should disable and delete all their chosen extra modules before it goes, and then says that some of the modules cannot be disabled. I ask the sales chat thingey: "How do I uninstall the Aquia modules? (I want to keep things simple for now and maybe use Aquia help later, so I want to start with core drupal and nothing else)"
Answer: "just go to drupal.org and download Drupal 7 core". So I am back to following the Youtube video by Tom Geller that I transcribed before.


/q=user (when locked out after trying to replace drupal core)

Upgrading Drupal Core. Why? Because the machine told me to, and because I can't upgrade Kickstarter 1 to Kickstarter 2 and an old Drupal Core might be the reason.

How to upgrade? I've forgotten. It's about moving a bunch of default files to the right directory, which you have to be able to find, and changing "default.settings.php" to "settings.php" with a line changed to "TRUE" instead of "FALSE" if you are locked out of your site. I can't keep track of what I've done or explain it, but after a day searching for any files with "TRUE" or "FALSE" in them on my hard disc and changing about all of them, I was still locked out until finding this post:

http://groups.drupal.org/comment/reply/134314/437279 which suggests http://yoursite.com/?q=user as a way to log-on.

Happiness!
It only works on one of my sites.
The site is still using the old version of Drupal core which I thought I had deleted.
But something has happened, anyway.