LoginLogin  Blog About
Search:

Support » Knowledge Base » Shop-Script » Design setup »

How to add a custom text string with translation

In order to add custom HTML code or a text string to the storefront of WebAsyst Shop-Script use the custom HTML code adding feature in the built-in design editor. To ensure automatic changing of the added string or HTML code every time a customer changes the storefront language, creating a custom localization string is necessary as described below.

Adding a new localization variable

  1. Go to section "Design -> Languages & Translation" and click on "Edit translations" to the right of the default language name.
  2. Click on "Add new string" and type a unique ID for the new string in the left text field. The ID may only contain Latin letters, digits and the underscore character. Type the desired HTML code or text string in the right text field and click on "Save".
  3. Save translation of the newly added localization string for other languages in your store. To do so, click on the "Edit translations" links to the right of those languages names. Use the search box to find the necessary string and save appropriate translation.

Embedding custom text in the storefront

The created localization string can be used either in the built-in design editor or in Smarty template files as described further:

  • To add a localization string using the WYSIWYG mode of the design editor click on "Custom HTML code" in the right panel. Type the following code into the text box that will appear:
    {lbl_my_string}
  • To add a localization string using the HTML editing mode of the design editor, go to the corresponding mode by clicking on "Advanced mode (HTML)". Add the following code in the appropriate place of the HTML editing window:
    {"my_string"|translate}
  • To add a localization string to a Smarty template file, open the necessary file in directory published/SC/html/scripts/templates/frontend/ and add the following code in the appropriate place:
    {"my_string"|translate}
Instead of my_string the ID of your custom localization string should be used in the above examples.