Drupal 7 Business Solutions

4 (1 reviews total)
By Trevor James , Mark Noble
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Planning our Site and Setting up Drupal

About this book

You can use the Drupal 7 content management system to build a small business website quickly. You may add blogs, images, maps, e-commerce, social application integration, and more to your site to connect with your customers and make more money from your business.

Drupal 7 Business Solutions will give you hands-on practical tutorials on how to build a rich and dynamic website for your business quickly using one of the most popular tools in open source.

You’ll start by adding blogs and images to your website. Then you’ll learn how to add a VIP section to your site so that you can give your logged in users special discounts and other VIP freebies. Next, you will learn to send your customers e-mail newsletters and show them a dynamic events calendar.

The book will then teach you to add e-commerce to your site so you can sell your products online. You’ll add YouTube videos and Google maps to help enhance your business site. You will then learn to incorporate feedback mechanisms for your customers.

The book also explains how to maintain your site, upgrade it, and continue adding dynamic content to it.

Publication date:
January 2012
Publisher
Packt
Pages
378
ISBN
9781849516648

 

Chapter 1. Planning our Site and Setting up Drupal

Although several books have been written about Drupal 7, most have been written for developers to help them program sites using Drupal coding standards, enhance sites by using custom modules, and change the appearance of Drupal sites by using themes. In this book, we take a different approach. Throughout the book, we will develop a website for a (fictional) business and meet the needs of this business.

We have included an explanation of all the key features in Drupal that most small-to-medium-sized businesses would want to use on their sites. A thorough step-by-step description of how to integrate each piece of functionality into your website is included, along with an explanation of the business need that is being satisfied by using the functionality.

After reading this book, you will be able to adapt the techniques used in this book to either develop a site for your company on your own, or work with a development firm to create a website that truly meets the needs of your business.

In this chapter, we will introduce our client, the Artisan Bakers Collective and discuss their plans to build a website. We will also introduce Drupal 7 and describe why it is a good fit for our client's website.

In this chapter, we will cover the following topics:

  • Plans for the Artisan Bakers Collective website

  • The advantages and disadvantages of simple, static web pages

  • Advantages and disadvantages of customized PHP and MySQL sites

  • Deciding on Drupal for building the website

  • Getting started with Drupal

 

Artisan Bakers Collective


Baker James is the owner of the Artisan Bakers Collective, a popular artisan bakery, café, and store. The past few years have been very good, and he has expanded from one bakery to three. Each bakery is decorated in a retro theme and Baker James is extremely proud of the decor. The Artisan Bakers Collective offers a wide variety of breads and baked goods, but specializes in creating sourdough bread using traditional European-style slow-rise recipes handed down over generations.

Baker James wants to add an e-commerce component to his business, so that he can reach a larger clientele, which he feels will bring in additional revenue. He also gives baking classes and would like to promote this.

 

Plans for the Artisan Bakers Collective website


Baker James had a website designed for him several years ago, but it has proven to be difficult to maintain and is therefore several years outdated. James would like to build a new website for his businesses that is easy to update and maintain. He would like to provide a destination for his customers where they can visit his bakery online, learn more about the bakery, find out about classes, events, and the featured breads, and receive discounts, if they are loyal customers.

Baker James has several key goals for his site, which are as follows:

  • The site must provide an easy method for updating its content so that it's always current

  • Baker James should be able to make updates to the website without having to pay a consultant to do so

  • He should be able to run a secure and stable website that uses current website development standards

  • The overall website should be easy to maintain in terms of keeping Drupal modules updated and keeping the site secure and stable

  • It should be possible to add new functionalities to the website without requiring a complete start over

After Baker James came to us expressing his desire to have a new website built, we sat down with him to determine what pages and sections should be added to the website, so that we can plan our development. Based on these discussions, we decided on the following features for the site:

  1. Home Page : This includes links to other areas in the site, current events, and sample menu items. Baker James may want the home page to have a design and layout different from the rest of the site.

  2. Pages : This includes pages highlighting bread, other baked goods, and coffee. There will be one method for creating pages—a simple method where each page is developed independently, using a form (in Drupal), that is simple to complete.

  3. Search : This allows visitors to search the menu for the bakery's goods, based on a variety of criteria.

  4. Ratings : This allows visitors to rate items on a scale of 1-5.

  5. About Us Page : This page provides contact information.

  6. Guest Book : This allows visitors to comment on the bakery and give feedback. Baker James can see when new comments are added, and he can optionally remove comments if they do not meet the site's standards.

  7. Map : This helps the visitor find all of the Artisan Bakers Collective bakeries, using Google Maps.

  8. Polls and Surveys : From time to time, the bakery will have polls to see what items patrons want added to the menu, and what they think of the new items on the menu.

  9. Photo Gallery : This shows the pictures of food on the menu as well as pictures of the restaurants.

  10. Monthly Newsletter : This is a newsletter that visitors can subscribe to. Baker James will be able to create the newsletter content on the site. Customers can also view the previous editions of the newsletter.

  11. Event Calendar : This showcases events occurring at the bakeries.

  12. Member Rewards site: This gives details of the discounts for members who have visited the bakery a specified number of times.

  13. Online ordering : This will allow visitors to order breads and sign up for classes through an e-commerce ordering system.

  14. Forum : This is a forum to solicit suggestions and ideas for improvement, to discuss policies, and so on.

  15. Blog: This will be used by Baker James and his employees for discussing topics important to them, including information on new menu recipes, running a bakery, and more.

  16. Administration Area : This helps Baker James optimize his website, so that the visitors can make the most of it.

Selecting a foundation for the Artisan Bakers Collective site

In this section, we will explore a range of possible technologies that could be used to build the Artisan Bakers Collective website. The pros and cons of each method will be discussed, and we will choose the final technology that will be used to build the website.

 

Simple static web pages


Many websites continue to be built by simply creating standalone HTML pages that do not change frequently over time. These pages can be created with a dedicated website design program or with a simple text editor. These pages are then uploaded to the web server, using an FTP client or another transfer client provided by the web host.

Key advantages

There are several advantages of using this method of web development, listed as follows:

  • HTML web editor software can make creating web pages as easy as writing a letter, since the interface is similar to Microsoft Word

  • Website editors may provide pre-built themes to make the website appealing, without any graphical design experience

  • It is a very easy way to get started

  • For simple sites, simple techniques are sometimes appropriate

  • A website can be created relatively quickly

  • Websites can be built for free or for the cost of a website design program

  • The hardware requirements are very low, so the website will run on nearly any host

Key disadvantages

Although static web pages can be easy to develop, there are a number of disadvantages that appear after you deploy the website and try to make revisions to it later. The disadvantages are listed as follows:

  • Adding a new page to the website may require changes to all of the existing pages on the website

  • Changing elements that are common to all pages, such as the header or the footer, may require changes to every page on the website

  • When major changes are needed to the website, it may be easier to rebuild the entire site

  • It is easy to have errors within the website, leading to pages that cannot be reached, or errors that the visitor may encounter. These errors can include broken links and images, and broken navigation menus

  • Advanced functionality cannot be added without custom programming

  • Created code can be inefficient or incorrect, leading to websites that do not display properly in all browsers

  • Security and optimization techniques created by other developers are not automatically applied to your site

 

Fully-customized site with PHP and MySQL


You could also build a fully-customized website, built entirely from scratch, using a programming language such as PHP and a database such as MySQL. In this type of system, one or more programmers build custom code specifically for your website. Some common libraries may be used to speed up development, but the majority of the site will be custom-created.

Key advantages

There are several advantages to developing a completely custom-built website for your company, which are listed as follows:

  • The final website will be fully customized to meet the exact needs of your company

  • New functionality can be added by another programmer, who is skilled in the same programming language, at a later date

  • Complex functionality may be easier to develop, when starting with a clean slate

  • The website may be much more efficient than a website built on a predefined framework or content management system

Key disadvantages

Unfortunately, developing a completely custom website is a difficult, time-consuming process and has several disadvantages. They are listed as follows:

  • Relatively lesser-skilled programmers may create a website that is difficult to maintain and enhance

  • Changing the look and feel of the website may require significant re-work, unless the site is designed to allow customization

  • The website may require a great deal of work by programmers to create and maintain

  • Security flaws may be inadvertently introduced, which could compromise the overall server or private data of your customers

  • The site may require more hardware resources than simpler sites and may require significant resources to run at acceptable speeds

  • Creating all of the functionality from scratch can prove to be very costly

Drupal content management system

Drupal is an open source content management framework based on PHP and MySQL. To use Drupal, you need to install it onto your web server. After it's installed, you use Drupal to create and edit pages. Drupal handles most of the common functionalities that are needed to build websites of any size, and also handles many complex functionalities with the help of plugin Drupal modules, including:

  • User management

  • Categorization of content

  • Building menus

  • Creating a consistent look for all pages

  • Adding pictures to pages

  • Creating and maintaining blogs

  • Creating and maintaining forums

  • E-commerce

  • Image galleries and other multimedia support

  • Contact forms

  • Translation and internationalization

  • And much more

Although these features alone are sufficient to handle many sites, Drupal also offers a powerful module system that allows developers to create modules that plug in to the core Drupal framework to seamlessly provide new capabilities. Many modules have been created by the Drupal open source community and released for use under open source licenses, free of charge. Modules are available for nearly every conceivable task, but if you don't find what you are looking for, a custom module can always be created to handle your exact needs.

Drupal also provides a powerful theme system that allows you to change the look and feel of your website and have all of the pages changed throughout the entire website, instantly. Hundreds of free themes are available on the Drupal website, and these can be customized to fit your needs. Alternatively, you could develop a custom theme for your own website. Commercial themes can also be purchased.

Benefits of building with Drupal

Drupal offers a number of benefits not found with the other methods of building a website. Many of these are related to the ease of maintenance and the ability to concentrate on business functionality rather than building common, repetitive functionality. The benefits of Drupal are listed as follows:

  • You are free to concentrate on building content and functionality to support your business rather than creating basic functionality already provided by Drupal

  • The look and feel of the website can be easily changed without rewriting the entire site or changing all of the pages

  • All changes to the website take effect immediately, so you can ensure that the changes are correct

  • Changes can be previewed prior to the website being updated, to make sure that it works properly

  • Revisions to pages can be tracked, and you can require pages to go through an approval process prior to being made viewable

  • You do not have to use FTP or other methods to deploy pages to your website. You can also use more stable and secure methods of deploying entire Drupal sites, using tools and software, including git and SVN.

  • Development costs are low, as Drupal is available free of charge

  • There is an active community that can help to answer any questions that you may have

  • Drupal is actively maintained and enhanced, which helps to ensure that potential security issues are rapidly found and fixed

  • Drupal can be used effectively by a wide range of people, even if they do not have any programming experience

  • Site management can be delegated to a team of people, who can share responsibility for the entire website between them or take individual responsibility for specific areas within the site

  • As Drupal is constantly being maintained and updated, you can gain access to new technologies more rapidly

 

Disadvantages of Drupal


Although Drupal is a very powerful tool, its very power causes a few disadvantages:

  • A short learning curve is needed to get started and use the system effectively.

  • It is more hardware-intensive than basic static pages. As it's more hardware-intensive and can create performance issues on a server, you may need to make sure that your organization or business can handle the expense of upgrading a server and the overall server infrastructure to support the site. This may include more expensive hosting options

  • Additional programming may be needed to customize Drupal modules to do exactly what you want. Alternatively, you may have to compromise on desired functionality, based on what is actually available

  • Drupal may be more vulnerable to security issues as there are a large number of sites that use Drupal, and hackers may target Drupal sites as it's a popular open source software used by many site developers

  • Along the same lines as security, Drupal sites require frequent module and software updates in order to keep the website secure and stable. This is extremely important in order to keep your Drupal codebase secure

  • There may be limitations to the framework, which could make building custom functionality more difficult

 

Deciding on Drupal


As you may have guessed from the title of the book, we are picking Drupal, and specifically the latest version, Drupal 7, to build the Artisan Bakers Collective websites. Drupal gives us the best combination of functionality, flexibility, security, and ease of use, for our website. In fact, Drupal is an appropriate choice for a range of websites from small sites to large sites and everything in between. Many large-scale enterprise businesses, non-profit organizations, and private companies are using Drupal to power their website. For example, the White House is using Drupal. Chances are, if you are planning to build a website, Drupal will fulfill all of your needs.

At one point it was more complex to search out modules to use on a Drupal site, and this was looked upon as a disadvantage, but in this book, you'll see that it's actually much easier to locate good stable modules to use in Drupal 7.

 

Getting started with Drupal


In this book, we will jump straight into using Drupal to build a practical website, and not spend a lot of time talking about basic functionalities, the design of Drupal, or theoretical aspects related to Drupal. We will use Drupal 7, the most recent active version of Drupal, throughout this book. Drupal 7 is continuously in development, while Drupal 6 is also still supported and available for use on sites. The roadmap for Drupal already shows that Drupal 8 is in the planning stages.

To start using Drupal, we recommend setting up a development environment on your local desktop (either on your PC or on your Mac). You can develop the website for the client on your local computer using a local server, powered by MAMP (MySQL, Apache, and PHP for Mac) or WAMP (the same for Windows). This allows for quick and robust local development. When you're ready to show the client the site, you can easily transfer the Drupal site files and the database over to the client's web host.

You can also install the Drupal Development Desktop Stack that Acquia provides for download. They call this the Dev Desktop (http://www.acquia.com/products-services/dev-desktop), and it packages the entire Drupal core with PHP, MySQL, and an Apache web server.

This section will assume you have chosen either MAMP or WAMP to install on your local computer. We'll be installing Drupal into the web root of your local environment, which is usually htdocs or www.

You're also going to need to set up a database for your Drupal 7 site to use, since Drupal is database-driven. To do this, navigate to your localhostphpMyAdmin application. In MAMP or WAMP, this is easily located through the MAMP or WAMP control panel.

Follow the given instructions for setting up your database:

  1. Open phpMyAdmin and click on the Privileges tab.

  2. Click on Add a new User:

  3. Type in a User name (here I'll enter the username drupal7); set Host to localhost; and type in a password. Re-type the password.

  4. Select the Create database with same name and grant all privileges radio button.

  5. Then click on the Check All link.

  6. Click on the Go button, to create the database:

  7. Jot down the credentials from above, as you'll need them when you install Drupal.

  8. Your blank database is now created and you can now move on to installing Drupal.

You can use the following steps to install Drupal:

  1. Navigate to http://drupal.org, through your web browser. Click on the Get Started with Drupal button.

  2. On the next page, click on the Download Drupal 7.8 button. This will launch a Download & Extend page. You want to download the 7.x version of Drupal, so click on the tar.gz download link to start the download. Save the tar.gz file to your web root directory. At the time of this book's release, the Drupal version is 7.8. It may be a different 7.x version when you go to download it.

  3. After you download the Drupal installation, you will need to unpack it. The installation is delivered in tar.gz format, to unpack which you may need a specialized tool, such as 7-Zip or WinZip. 7-Zip is a freely-available program designed to work with a wide variety of compressed file formats. On the Mac, you should be able to unzip the file by default, without having to download any tools.

  4. Unzip/unpack the tar.gz file in your htdocs or www folder. The resulting unzipped folder will be called drupal-7.8, by default. This is your Drupal site folder.

  5. You can rename the drupal-7.8 folder to be more specific to the site you're building. Let's rename the folder artisanbakers.

  6. You can now browse to the location where you have installed Drupal in a web browser, to begin the installation process. If you are installing on your localhost environment the URL of the install will be something similar to http://localhost/artisanbakers/install.php . You should see a screen similar to the following screenshot, asking you to Select an installation profile.

  7. Leave the installation profile Standard selected, and then click on the Save and Continue button:

  8. Leave English set as the default language and click on Save and continue:

  9. The next screen will ask you to add your MySQL database credentials for the database you originally created for the site. First, make sure to leave the MySQL, MariaDB, or equivalent radio button selected. Now, add your credentials, including Database name, Database username, and Database password, here. Once you add the credentials, click on Save and continue.

  10. There may be a case where you need to add Advanced Options for your database connection. If you are going to be installing and hosting the database on an external server you'll want to expand this Advanced Options fieldset and add the path to the externally-hosted server. In our case, we're hosting the database on the same localhost server, so we do not need to expand this fieldset now:

  11. Drupal will now proceed with the install.

  12. The Configure site screen will load next. This screen is split up into various fieldsets. First, you want to give your site a Site name and Site e-mail address. The site name can be Artisan Bakers Collective. For the site e-mail address, type in your e-mail address, for now:

  13. Now, you need to set up the Site Maintenance Account. This first user account on the site is the super-user administration account. You'll use this account to do all the site development and, later, to maintain the site. For now let's call the super user "admin", so type in admin as the username. You can use the same e-mail address you used previously. Add a password.

  14. The password should be strong and include special characters, such as, # or @. You may also want to use capital letters mixed with lowercase ones and also add numbers to the password. Drupal will check the password, using the password strength visual prompt, and this will assist you in constructing a strong password. This is essential for keeping your site secure.

  15. For Server Settings, choose the Default country and Default time zone for where you are located. This will automatically use the time zone of your country for all date- and time-related functionalities on your website.

  16. Lastly, leave the checkbox next to Update Notifications ticked, to check for updates automatically and receive e-mail notifications.

  17. Click on Save and continue.

  18. The installation will complete and you'll see a congratulations screen. Click on the Visit your new site link, to launch your Drupal 7 website:

 

Artisan Bakers Collective on the web


You've successfully installed Drupal 7 and actually already have a fully-functional core Drupal 7 website for your client's business. In Chapter 2, Creating the Artisan Bakers Collective Website, we'll dive right into the Drupal 7 interface and start adding our client's content and setting up the website, as per our client's requirements.

If you want to see an example of the techniques used in this book as well as a live example of the complete website, you can visit http://variantcube.com/artisanbakers/. This site contains all of the examples developed throughout the course of this book. If you have questions about how to use Drupal, please post them on the forum at http://variantcube.com/artisanbakers/forum, and I will try to answer your questions, as quickly as possible. You can search on Drupal.org, using the site's default search box. Alternatively, you can visit the Drupal forums at http://www.drupal.org/forum, to see if you can find an answer to your question; if not, you can post the question to the Drupal.org community.

 

Summary


In this chapter, we developed the requirements for Baker James' Artisan Bakers Collective website. We also looked at some of the possible methods of building the website, before deciding that Drupal is perfectly suited for this type of site.

Now that we have our requirements for the website and have decided to build it using Drupal, it's time to get our hands dirty and begin building the website. In this chapter, you successfully installed and configured a development server environment and also installed Drupal. Congratulations! You should be proud of the work you have accomplished so far!

We will start with the basic functionalities that 99 percent of the websites need and then gradually move on to more complex tasks. We will use a step-by-step approach to building the site, so that you can follow along with the examples.

About the Authors

  • Trevor James

    Trevor James is a Drupal developer residing in Middletown, MD, USA. Trevor has been using Drupal intensively since 2007 and designing websites for over 15 years using a combination of HTML, CSS, ColdFusion, PHP, jQuery, and JavaScript.

    Trevor's focus is on building Drupal-based web applications and portals for education, non-profit, and medical systems, and small business environments. He is interested in the best methods of integrating web services with Drupal sites, optimizing Drupal sites' performance, and using Drupal content types, Views, Panels, and other contributed modules to develop front-end interfaces that support data intensive websites.

    He loves teaching people about Drupal and how to use this excellent open source content management framework. Trevor authored the following Packt books:

    • Drupal 7 Business Solutions (https://www.packtpub.com/web-development/drupal-7-business-solutions), published in early 2012
    • Drupal Web Services (https://www.packtpub.com/web-development/drupal-web-services), published in November 2010
    • Drupal 6 Performance Tips (https://www.packtpub.com/web-development/drupal-6-performance-tips), published in February 2010

    Trevor created a 14-hour video tutorial series titled Drupal 7 for Virtual Training Company (VTC) in 2011. The video is available via the VTC website at http://www.vtc.com/products/Drupal-7-Tutorials.htm.

    Browse publications by this author
  • Mark Noble

    Mark Noble has worked in software development and website design for over 13 years in a variety of capacities including development, quality assurance, and management. He takes pride in developing software and websites to make businesses run more effectively and delights in helping users to get their jobs done more easily.

    Mark currently works developing websites to help libraries manage their books. He also does occasional contract work for clients in a variety of industries.

    When he isn’t in front of a computer, Mark enjoys playing with his family, photography, and geocaching.

    Browse publications by this author

Latest Reviews

(1 reviews total)
Just what I needed to know about drupal possibilities