Creating a Better Selling Experience with Drupal e-Commerce

5 min read

Doug is an avid dinosaur and model enthusiast, and runs his own shop and museum selling model dinosaurs and offering information and facts on various dinosaurs. For the purpose of this article, we will create an e-commerce website named ‘Doug’s Dinos!’ for Doug and his business.

Making Things Easier

Although Doug’s store is relatively simple for his customers to use, it is missing three key features that would make their time on the website easier, these are:

  • An overview of the shopping cart
  • Search features
  • Ability to auto-create user accounts

At the moment, without a search feature the only way for users to find products is by manually browsing through the website and stumbling across a product they like.

Adding a Shopping Cart

We can add a shopping cart to our theme so that customers can continue browsing the website but still know how much is in their shopping cart, and easily get to it later.

To add this block, we need to go to the Blocks section, which is under Site Building within the Administer area. Within the Blocks section, we need to ensure we have all our themes selected (or do this for each theme we are using) and then change the Region of the Shopping cart to the left sidebar.

Once we click on the Save blocks button, the shopping cart block is displayed in our theme:

Adding Search Capabilities

Doug tested the website with a few friends and family members, and their main issue with it was the difficulty in finding products they wanted.

The first thing we need to do is install the Search module, which is grouped under the Core – optional section of Modules in the Administer area.

With the module installed, we now need to enable the Search feature from the Blocks section; otherwise the search box won’t be displayed on the website. We can select this feature by going to Administer | Site Building | Blocks, then set it up in the same way as for the shopping cart and save the settings.

We now have a search box on our website under the header but above the main menu!

Let’s try searching for one of our products, for instance T-Rex. Notice something? No results found! This seems quite strange as we have a product with T-Rex in the name, so why didn’t we get any results?

The reason for this is that Drupal has not yet been indexed. Drupal uses a cron job to create the index of the site. Without the indexing done Search options cannot work. The Search settings under Administer | Site configuration allow us to specify how many pages are indexed per “cron run” and allow us to set the site to be re-indexed.

Cron Jobs
A cron job is a setting on your web host’s server (if you have cPanel hosting, it is available under “crontab”) that performs tasks at specific times. Drupal has a special page that performs various tasks; this can be called by a cron job so that it regularly opens the page and runs the tasks.

This setting depends on having set up a cron job to periodically call the cron.php file. For more information on setting up cron jobs, you should contact your web host. Typically it involves a crontab setting in your hosting control panel such as cPanel.

We can manually run the cron task, by opening the cron.php file in our web browser. In this case we just open: http://www.dougsdinos.com/cron.php.

Once we have opened this page, let’s try searching for T-Rex again. This time we will get some results!

Customers will now be able to find products and other content on Doug’s website much more easily!

Auto-Creating User Accounts

If a customer is not a user on our site, we can automatically create a user account for them once they have placed their order; this saves the inconvenience of using an anonymous purchase policy where the user has to log in or register, but it gives the user the added convenience of having their details saved for future orders.

This is something Doug wants to enable to make things easier for regular customers on this site. The first thing we need to do is install the module. The module is called EC Useracc and is listed in the E-Commerce Uncategorized group of modules.

Now under E-Commerce configuration we have a new option called User Account; let’s take a look at it. This has the following settings:

  • Confirmation e-mail
  • Welcome mail
  • Days to confirm expiry

The Confirmation e-mail is to see if the customer wants to create a user account; this email expires after the number of days set in the Days to confirmation expiry setting has passed, and the Welcome mail is the email sent when the account is created. These emails can be configured on the Mail page.

These settings don’t actually enable the feature though; we have installed the module and looked at the global settings, but to actually get it to work we need to set how we would like each product to work in relation to this module. If we go to edit any product, there is a new section, which was not there previously, called User account provision; this is what we need to change.

As Doug wants this feature enabled, we need to check the option Create an account for the user when this product is purchased. The other option, Block the user’s account when this product expires, relates to using recurring billing in products (mainly non-tangible products i.e. services) such as a customer support contract or a magazine subscription.

Packt

Share
Published by
Packt

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago