Articles written by: Guy Schneerson

Stock for Drupal 8 commerce - Technical overview & use cases

The business requirements

Drawing on the experience of maintaining the Drupal 7 stock module and working with a number of ERPs over the years we have come up with a completely new architecture for Drupal 8 commerce stock module.

The following are the 4 main challenges that I encountered with the Drupal 7 module that needed addressing:

Setting up Brightpearl ERP on a Drupal Commerce site

This article will show how to set up the Brightpearl ERP on A Drupal commerce site to find out more about Brightpearl checkout my previous introduction post.

This guide uses http://simplytest.me to demonstrate the process.

This article will cover the following:

  • Install instructions (consists of two parts)
  • Configuration instructions
  • Un-install notes.

Brightpearl ERP for Drupal Commerce integration

 

After many custom Drupal Commerce ERP integration's we have come across Brightpearl an ERP with all the facilities a small to medium size business would need and decided to share our code with the Drupal community see the Brightpearl module page.    

Also check the Brightpearl setup guide Setting up Brightpearl ERP on a Drupal Commerce site post.

 

Drupal Commerce site for Moscow bakery

We were commissioned to create a Drupal Commerce based web site for a top Moscow bakery.
The site is a custom themed multilingual site offering online ordering, delivery slot choice alongside recipes and other product information.
The Drupal Commerce framework is an ideal platform for the creation of an online shop and with a degree of customisation provides an excellent base for this multilingual online bakery.

Working with Drupal commerce order total

The following gists shows a few approaches for working with Drupal commerce order totals.
All three examples retrieve the order total as two components Ex Vat and VAT:

The first example shows how to get nicely formatted amounts. This is easily done using two functions:
commerce_price_component_total() - Returns the total value and currency for the specified price component in a price array.
commerce_currency_format() - formats the amount with the correct localization and currency symbol

Drupal Commerce Localisation - translate the currency symbol

I didn't see this one coming but on a Multilingual Russian site we recently built, the client asked us to translate the Russian Rubble symbol "руб" to "RUB" when viewing products in English.

As there are no localized options for currency settings I had a look around the commerce code and came across commerce_currency_format() in commerce.module.

Localizing a Drupal 7 Commerce site a step by step guide

This is going to be a step by step guide for localizing & translating a Drupal 7 commerce site. there are many ways and tools Drupal and its contributed modules support and this is just one of them. 

I will not go into too much explanations but will try and make sure I cover all the steps needed to translate a Drupal commerce site.

Note: commerce kickstart 2 comes with some of this but last time I checked it did not provide full localization and translations features.

Setting translators on a multilingual drupal 7 site

Drupal 7 has great support for multilingual site and has various approaches to content translation and localization.
In this quick recipe post I will cover the setting up of a "Translator" role for the following translation approaches

  • Interface translation: The translation of strings used throughout the site
  • Entity translation: The translation of Nodes and other entities using entity/field translation

I will try and cover other translation & localization approaches at a later stage

Move your body (from views to Display suite)

Lately I find myself more and more moving from views fields to using Display suite layouts. However one bit of functionality I love about views is its text trimming and striping.
What I like to do is create a display suite code field that lets you do this using the original views function. I also try and keep my code in a unit and call it from the display suite (so its not hiding in the DB).

Collaborative content editing on a Drupal 7 site

Most Drupal sites require more then one person to be able to edit content on the site.
While out of the box Drupal does not support a great collaborative experience, you can easily enable this functionality using a few contrib modules and configuration.

Drupal 7 - How to get information about node types

Each node has a number of properties like name & description.
Drupal 7 core (node.module) provides two useful functions for accessing this data:
node_type_get_names() and node_type_get_types both functions return an array index by the node type.

Drupal 7 menus in a localized site

i18n / Internationalization module

We use the i18n menu module that comes with the Internationalization module.
While the module provides configuration options for language specific menu items, simply enabling the module creates a new translation text group called "Menu" that exposes all menu items to the translation interface.

You can use the translate interface to translate all the menu items except for once created by nodes for those you should translate the node and specify the translated menu title.

How to let users create 'unpublished' content in Drupal 6

Basic Content authoring in Drupal

Each node in Drupal has an option to be 'Published' or 'Unpublished Published' under “Publishing Options” in the node edit screen. This enables content authors to be able to create content before publishing it on the live site. The field out of the "core" box can have the values of published and unpublished (this can be extended but that's a topic for another post).

Drupal Open Office and Brighton Area Drupal Weekend

As part of the Brighton Digital Festival and the Brighton Area Drupal weekend Blue-Bag and  three other Drupal houses in New England Gouse Brighton UK will be opening their doors this coming Friday.

Drupal 7 commerce multi currency site using a price list

Below are my notes taken as I investigate techniques to achieve my Objective,
(This post is not a normalised set of instructions but the process I went through to figure out the best way to handle multiple currencies c objective)
if I get a chance ill create another post with a normalised set of instructions/explanation.

A custom/optional Drupal teaser in a view using the Views Custom Field module

A client needed implementing a custom teaser/short description for a CCK field (not the body) in his Drupal 6 site. The requirements: if the short description/ teaser is available use it otherwise get the data from the CCK field. It is important to note that Display Suite Drupal module was not available as I think it provides a much better approach (will post about in the future).

I have used the Views Custom Field module , this adds a PHP field that allows us to add PHP code to a view.

Drupal Node actions

Drupal nodes typically have an Edit and View links (rendered as tabs at the top of the node by most themes).
 
Ever wanted to add you own links so you can add custom functionality?
This can be used to automatically populate node data.

The below example will show you how to add a link titled “reviewed” to an article node type, this link will prompt the user for a comment and set two cck field “reviewed” and “note”.

This is not intended as a real example but as an illustration of the how the following techniques can be used as the bases for the creation of powerful work flow.
The techniques covered are
•    hooking into the Drupal menu routing system
•    form creation and validation
•    node manipulation (node_load and node_save)
•    url redirect
 

Drupal Building blocks

- Talk notes from the BAD Monday meetup

By Guy Shneerson of Blue-Bag Ltd (www.blue-bag.com)    Guy [at] blue-bag.com

Notes form my presentation at the Brighton Area Drupal meetup (BAD monday) on Monday 18/04/2011 at the Skiff

Thanks to Steve for organising the evening and to all that attended

Contact