Displaying Shipping Line Items Using Token

The default output of the token [commerce-order:commerce-line-items] only includes Product line items.

For example, you might get this:
Broken token
and wonder why the Total is $30 more than the line items, when what you want to see is this:
Workin' token

Tokens in Drupal 6

Overview

This documentation is for the Drupal 6 version of the token module and the token API.

See the top level token documentation for more about why the Token API exists.

For Drupal 6 the complete token API is provided by the Token module. Much of the API functionality was moved into core for Drupal 7.

Using Token Replacement

To apply token replacement to a chunk of text, you have two options. The first, and simplest, is:

Token Replacement in Messages

In the Creating Message Types page a very simple example was shown. However, the Message module supports tokens, which provides the ability to create dynamic messages based on the whatever context you choose to add to the message. To use tokens with messages you will need the Token module and Entity Token module (part of Entity module - which is a dependency of the message stack).

Dynamic menu elements with tokens

Under construction.

Creating contextual menu items

Menu Token module allows to insert tokens into menu items title and path.

We are going to create a list of all articles published by the authenticated user using the Menu Token and Views modules.

  1. Create a view with context arguments.
  2. Go to Structure > Views and create a new view named "User Articles" that show "Content" of type "Article" and has the path "/articles".

Selective linking of list entries to nodes with Views 3, CCK (Content) and Token

A common way to use Views is building lists of entities of a certain type (products, projects, blog articles etc.), where each entity is stored in a node and represented by its title. By means of the default Views handler "Link this field to its node", the node titles can be linked easily to their corresponding nodes. But unfortunately the said handler cannot be applied in a selective way - once it is chosen, all titles will be linked without exception. What if you want a complete list of entities with only a restricted scope of links?

Consider the following use case. Suppose you employ Views to build a summary of all your projects. They are filtered by node type and represented by node title as the only field in use. Now you want some, but not all entries to be linked to their nodes - just because some projects are important enough to be showcased, others not. In our scenario, all node titles have to be rendered as "plain text" initially, and in a second step only certain selected titles are to be wrapped in a link.

Drupal 6 - How to Retroactively Reward UserPoints to New Users

How to retroactively reward UserPoints to new users after they register for stuff they did when they were anonymous

This tutorial will show you how to reward anonymous users for interacting with your site, similar to khanacademy.org and queryblitz.com. An example is displaying a message like "You have collected 6 Awards! Log in or Register to claim your prizes."

This tutorial used Flags 2.0, Session API, UserPoints, Token, Custom Tokens, and Rules to give UserPoints to users after they have registered for flags they flagged before they registered.

To give UserPoints to anonymous users for flagging content, first set up a flag. We will call this flag "Awesome". Make sure both anonymous and authenticated users have access to this flag.

Next, create a new token with the Custom Tokens module, set the Type as User and in the PHP text area place the following, exactly as it shows here:

$uid = $account->uid;
$flag = flag_get_flag('awesome') or die('no "awesome" flag');

$count = $flag->get_user_count($uid);

print $count;
Subscribe with RSS Subscribe to RSS - Token