Creating an extended description longer than 2000 characters

This tutorial will explain a technique for creating an extended description that can handle more than 2,000 characters (the limit for the built in field).  First let's take a look at a page where this 2,000 character limit is causing a problem.

The area highlighted in red shows how this block of HTML is being abruptly cut off.  To fix this problem we are going to introduce a new item level attribute called "alt extended description".  The template that we need to edit is named template_item.vm.  Below you can see where this is located on the template editor.

The first thing we need to do on this template is to add a directive at the top declaring this new item attribute.  The directive is what will tell the GUI to present a field to the user when they edit the item.

Item Attribute Directive
## uc:item-attribute-html="alt extended description"


The next step is to create a single variable that will hold the proper extended description.  The alt extended description attribute if it's specified, otherwise the normal extended description.

Single variable for extended description
## Create a single variable that contains the alt extended description if specified, otherwise the regular extended description
#set($extendedDescription = $item.getExtendedDescriptionNoEscape())
#if ($item.getAttributeValue("alt extended description") && $item.getAttributeValue("alt extended description").length() > 0)
  #set($extendedDescription = $item.getAttributeValue("alt extended description"))

You can see we've spaced this snippet of code just below the directive.

The final step is to use CTRL-F (Find) and CTRL-G (Find Next) to located all the instances of $item.getExtendedDescriptionNoEscape() and $item.getExtendedDescriptionNoEscape() other than our new code and replace them with $extendedDescription.

One example of replacing some of the instances looks like this.

At this point you should be able to save the template and refresh your product page and nothing show appear to change (because you haven't populated the alt extended description of the item).  When you go to the item editor now, you will see a new StoreFront attribute appear for the alt extended description.

Copy the extended description down to the alt extended description and add the additional content.