Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Drupal theming. Webform module notification letter template

17/04/2025, by Ivan

The catalog we created using the CCK, Taxonomy, and Webform modules allows you to notify the customer and the site administrator (manager) via email about a placed order. However, the manager currently only receives the product name, quantity, and customer details in the email. It would be much more convenient if the email also included a direct link to the ordered product.

Currently, the email received when an order is placed looks like this:

Submitted on Tuesday, November 16, 2010 - 15:56
Submitted by user: Admin
Responses:             
Product Name: Colorful Plate        
Quantity: 1           
E-mail: levmyshkin2@mail.ru           
Address: Omsk City         
Preferences and Comments: Responses can be viewed here: 
http://drupal/node/14/submission/1

You can customize the email template in the webform settings:

Drupal webform

There is a section in the settings for editing the Email template:

email template

Default template: choose the default template, which can be edited in the text area below.

Custom template: choose a template from the Webform module’s templates folder.

Let’s first look at editing the default template. You can add dynamic data using Token values, which include form fields, global site variables, usernames, GET and POST session variables, and more.

Under Included e-mail values, you can choose which form field values to include in the email.

To include a link to the ordered product, you need to add a field for the product ID that will automatically capture the product's ID. In the product ID field, set the default value as %get[id]. In the product order form link, add the id parameter so that the URL looks like this:

<a href="<?php print base_path(); ?>node/14?product=<?php print drupal_get_title(); ?>&id=<?php print arg(1); ?>">Order Product</a>

Next, disable editing for the ID field in the field settings—you can also do this for the product name field.

Drupal template

Now, when a product is ordered, the email will include a line like this:

Product link: http://%site/node/%value[id_product]

Where id_product is the machine name of the product ID field, and %site is a token representing the site domain name.

This way, the order confirmation email will include a direct link to the ordered product.