Size Variations

Size variations in the form of small squares, allowing users to see which sizes are available for the item.

Wireframe

Size Variations


Preparation Checklist

Before you start this tweak, it's a good idea to run through our preparation checklist below:

  • Read through the Getting Started to get a better sense of how the control panel, Database and Front End store interact.
  • Learn our recommended Simple Workflow. This makes the implementation process as easy as possible.
  • Create a new Staging Theme for this tweak. This allows you to preview any changes before they are visible to live customers.

Coding Instructions

Step 1: Open the thumbnail templates

  • The gallery thumbnail template can be found here /httpdocs/assets/themes/[THEME-NAME]/templates/thumbs/product/template.html.
  • The list thumbnail template can be found here /httpdocs/assets/themes/[THEME-NAME]/templates/thumbs/product/list.template.html.

Step 2: Add the variations code to the thumbnails

Paste the following code into the template where you would like the element to appear. This is most commonly placed below the product name:

<div class="size_list">
    [%if [@has_child@]%]
        [%list_item_variations id:'[@sku@]'%]
            [%param *variation_body%]
                [%if [@specific_name@] eq 'Size'%]
                    [%if [@value_image@]%]
                        <div class="size">[@value_name@]</div>
                    [%else%]
                        <div class="size">[@value_name@]</div>
                    [%/if%]
                [%/if%]
            [%/param%]
        [%/list_item_variations%]
    [%/if%]
</div>

Notes On The Above Code

This code outputs the "Size" specific values for every child variation of the product. In order for the above to work, the specific name itself must be set to "Size".

Step 3. Add the CSS

Add the below CSS to the appropriate stylesheet:

.size_list {
    margin: 0 0 10px;
    min-height: 25px;
}
.size_list .size {
    margin: 0;
    display: inline-block;
    border: 1px solid #EFEFEF;
    padding: 3px;
    font-size: 12px;
    text-transform: uppercase;
}

Final Result

Size variations

Was this article useful?

Be notified when this page is updated. Optional.