ALPHA STORE DESIGN STUDIO - authorized Yahoo! Small Business Partner
call us at (908).338.3992
 
About Us
Portfolio
System Additions for Store Pages
Custom Graphic Design. How It Works
/
BLOG: A few "tips" and "RTML secrets" of Yahoo store.

OUR BLOG: Yahoo Store from A to Z and RTML development "secrets".


Description of RTML Operators

Here we would like to provide you with more information about RTML programming.
Although the list of RTML operators (with short reference) could be found on Yahoo Help pages:
http://help.yahoo.com/l/us/yahoo/smallbusiness/store/edit/advanced/advanced-44.html, we believe that more detailed explanation of them could be helpful for beginner RTML programmers as well as for those storeowners, who want to reach more efficiency in handling of Yahoo Stores.


RTML Operator “AS-LIST”

In an RTML template the newly created operator looks like:

AS-LIST type nil
        class nil
        id nil
        style nil
        title nil

This operator insert <ul>….</ul> or <ol>….</ol> lists html tags into the page code. The type of tag depends on the attribute type value, either :оrdered or :unordered

EXAMPLE

AS-LIST type :оrdered
  ITEM 
    TEXT "First Notation"
  ITEM
    TEXT "Second Notation"

The HTML code will be generated as:

<ol><li>First Notation</li><li>Second Notation</li></ol>

RTML Operator “AND”

In an RTML Template the “AND” operator looks like:

AND

The operator AND may contain operators and arguments. If any of them returns false or nil, then the operator AND returns false (nil). If all arguments return true or contain some values, the operator returns the value of last arguments.

This operator could be used in combination with the “IF”, “WHEN”, “OR” and “WITH=” operators.

EXAMPLES:

IF test AND
          @custom-free-shipping
          < value1 @ship-weight
            value2 2
   then TEXT "Free Shipping For This Item"
   else nil

In this example, we are verifying if the “Free Shipping” option could be applied for a particular item. If the property @custom-free-shipping is “ON” and the item shipping weight is less than 2 (lb), then the text “Free Shipping For This Item” will appear on the page spot.

IF test AND
          @orderable
          OR
            @sale-price
            @price
   then TEXT "This is Item"
   else nil

In this example we are checking if this is the Item page. If the orderable property is set to the value “Yes” and the sale-price or price is defined, then the text “This is the Product page” will appear on the page spot.

RTML Operator “ACCUMULATE”

In an RTML Template, the “ACCUMULATE” operator looks like:

ACCUMULATE result_var nil
           iter_var nil
           result_init nil
           sequence nil

This operator accumulates certain values in result_var. At the beginning of iteration, result_var holds the value of the result_init variable. Sequence holds the list of objects (for example: the list of items). The ACCUMULATE operator takes elements from this list and passes them into iter_var variable one by one. Then the ACCUMULATE operator evaluates the expression assigned within it and passes the result to result_var.

Let’s look at the following example:

WITH= variable maximum-price
      value ACCUMULATE result_var maxprice
                       iter_var item
                       result_init MINNUM
                       sequence @contents
              MAXIMUM
                maxprice
                WITH-OBJECT item
                  ELEMENT position 0
                          sequence OR
                                     @price
                                     @sale-#price
  WITH= variable minimum-price
        value ACCUMULATE result_var minprice
                         iter_var item
                         result_init MAXNUM
                         sequence @contents
                MINIMUM
                  minprice
                  WITH-OBJECT item
                    ELEMENT position 0
                            sequence OR
                                       @price
                                       @sale-price
    TEXT GRAB
           "price from $"
           TEXT minimum-price
           " to $"
           TEXT maximum-price

In this example, we are defining the minimum and maximum price for the products that is in the listing page’s built-in property contents. For this purpose, we are also using RTML operators MINNUM and MAXNUM. They hold the minimum and maximum numbers in the Yahoo store system. If we want to get the minimum price, then we have to determine the maximum value first in result_init , if we want to obtain the maximum item price, then we have to determine the minimum value first in result_init. Within the ACCUMULATE operator we compare item_var and item price. Then the result will passed to item_var

RTML Operator “>” [greater than]

In an RTML Template the “>” operator looks like:

> value1 nil
  value2 nil

The purpose of this operator is to compare two numbers. If the first argument is greater than the second one, then the operator returns “true”.

EXAMPLES:

TEXT IF test > value1 @custom-variable
               value2 20
        then "Your number greater than 20"
        else "Your number is less or equal to 20"

As a result, if the number defined in the custom property “custom-variable” will be greater than 20, then the text “Your number is greater than 20” will appear at the page spot, otherwise the text ” Your number is less or equal to 20” will appear.

RTML Operator “<” [less than]

In an RTML Template the “<” operator looks like:

< value1 nil
  value2 nil

The purpose of this operator is to compare two numbers. If the first argument is less than the second one, then the operator returns “true”.

This operator could be used in combination with “IF”, “FOR” and “WHEN” operators.

EXAMPLES:

WHEN < value1 @custom-variable
       value2 20
  TEXT "Your number is less than 20"

So, if the number defined in the custom property “custom-variable” will be less than 20,  then the text  “Your number is less than 20” will appear at the page spot.

RTML Operator “BLUE”

Within Yahoo Store RTML Template, this operator is showing as:

BLUE nil

The operator takes color value and returns its blue component of RGB (red green blue) color model in numeric value between 0 and 255.

EXAMPLES:

  WITH= variable blue
        value BLUE @background-color
    WITH= variable red
          value RED @background-color
      WITH= variable green
            value GREEN @background-color
        BODY background-color COLOR red red - 20
                                    green green - 20
                                    blue blue - 20

At this example, we took Red Green and Blue color components from the global variable @background-color. Then, we are using these components to make the body background darker.

RTML Operator “AS-STRING”

Within Yahoo Store RTML Template, this operator is showing as:

AS-STRING nil

The purpose of this operator is to take an argument and convert it to a string.

EXAMPLE:

Let us pretend, that one of our test item has “Saving on Quantity” price value, defined as: 30 5 125 10 200. Where: 1 item price is $30, 5 items price is $125 and 10 items price is $200.

At this case the property @price returns numerical array (30 5 125 10 200), while AS-STRING @price returns text string – 30 5 125 10 200

RTML Operator “AS-NUMBER”

Within Yahoo Store RTML Template, this operator is showing as:

AS-NUMBER nil

The purpose of this operator is to take an argument and convert it (if possible) to a numerical type.

EXAMPLES:

AS-NUMBER “$77”

The argument in this example starts with “$”, where “$” is not a numerical character and therefore the AS-NUMBER returns 0

AS-NUMBER “10.44 20 30”

This example returns 10.44 because AS-NUMBER stops at the not numerical blank character.

RTML Operator “APPEND”

In an RTML Template the “APPEND” operator looks like:

APPEND

This operator joins all sequences pasted within.

NOTE You cannot paste a text string within APPEND operator because it will result in RTML error.

EXAMPLE

WITH= variable bestsellers-ids-together
      value APPEND
              @local-bestsellers-ids
              @global-bestsellers-ids
  TEXT bestsellers-ids-together

In this example, we combine two ID sequences. Then we write the resulting sequence into the text spot.

RTML Operator “ACTION”

In an RTML Template the “ACTION” operator looks like:

ACTION nil

This operator returns a special Yahoo Store URL that will perform a certain action. The possible arguments are :

:email (returns argument mailto: and the e-mail address from the email global variable),
:help (returns http://stores.yahoo.com/help.html),
:request,
:search (returns search page URL), and
:show-order (returns Yahoo basket URL).

EXAMPLE:

FORM destination ACTION :show-order
     method "post"