View Order Custom Tab

Allows a custom template to be rendered within the back-end View Order page.

Overview

This feature allows you to render custom content within the Back-end View Order page that is pertinent to your order fulfilment process.

For example, this could be a Customer Service tab that shows specific processing instructions based upon the order status, payment type or returns status.

🚧

The View Order Custom Tab is for display purposes only and does not support any interactive processes.

All other elements and features on the View Order page are subject to change without warning.

The content embedded within the custom tab should be entirely autonomous, should not interact with any other elements on the page and must be able to react to changes in the orientation of the overall UI.

If an issue occurs on the View Order page, Aurora Commerce reserves the right to disable the custom tab without warning until the issue is resolved.

How to Enable the Custom Tab

To enable the View Order Custom Tab, you must compete the following steps:

  • Enable the Custom Tab and set an optional Tab Name within:
    Store > Settings > Aurora > Orders > View Order Custom Tab
  • Create a template within your front-end templates directory i.e.
    admin/orders/custom-tab.tpl.html

Custom Tab Name

The name of the tab can also be customised by setting the Custom Tab Name value.

This can be a maximum of 16 alphanemuic, hyphen, underscore or space characters.

Custom Tab Placement

The Custom Tab will appear as the last tab within the View Order page using an iFrame with a relative width of 100% and absolute height of 400px e.g.

It should be possible to change the size of the iframe to suit the content from within the custom tab template itself e.g.

window.parent.document.getElementById('custom_tab_iframe').width = '500px';
window.parent.document.getElementById('custom_tab_iframe').height = '500px';

Use the Custom Tab as the Default Tab

If you would like the Custom Tab to be selected as the default tab on page load, this can be set within:
Store > Settings > Aurora > Orders > Default View Order Tab

Custom Tab Template Variables

The following view variables are available within the custom tab template:

Variable NameTypeDescription
$orderArrayOrder details, plus data-points specified below.
$order.additional_fieldsArrayA key/value list of additional fields for the order
i.e. field name => field value
$order.itemsArrayA list of all ordered items.
$order.items[n]ArrayOrdered item details, plus data-points specified below.
$order.items[n].additional_fieldsArrayA key/value list of additional fields for the ordered item i.e. field name => field value
$order.items[n].productArrayProduct details for the ordered item.
$order.items[n].product.additional_fieldsArrayA key/value list of additional fields for the ordered product i.e. field name => field value
$order.items[n].product.variationArrayVariation details for the ordered item.
$order.items[n].product.variation.additional_fieldsArrayA key/value list of additional fields for the ordered variation i.e. field name => field value
$order.notesArrayA list of order notes for the order.
$order.credit_notes[n]ArrayOrder note details, plus data-points specified below.
$order.credit_notes[n].user_nameStringThe name of the user who created the note.
$order.credit_notes[n].status_nameStringThe order status at the time the order note was created.
$order.transactionsArrayA list of transactions for the order.
$order.transactions[n]ArrayOrder transaction details, plus data-points specified below.
$order.transactions[n].admin_nameStringThe name of the administrator user who processed the transaction.
$order.transactions[n].additional_fieldsArrayA key/value list of additional fields for the order transaction i.e. field name => field value
$order.credit_notesArrayA list of credit notes for the order.
$order.credit_notes[n]ArrayCredit note details, plus data-points specified below.
$order.credit_notes[n].user_nameStringThe name of the user who redeemed the credit note.
$order.credit_notes[n].admin_nameStringThe name of the administrator who created the credit note.
$order.fraud_actionStringThe fraud action of the most recent fraud result.
$order.fraud_resultsArrayA list of fraud results for the order.
$order.fraud_results[n]ArrayFraud result details, plus data-points specified below.
$order.fraud_results[n].order_fraud_scoresArrayA list of scores for the fraud result.
$order.card_checksArrayA list of payment transactions that contain card checks for the order.
$order.card_checks[n]ArrayOrder transaction details containing the following card check data-points:
protx_avscv2
protx_addressresult
protx_postcoderesult
protx_cv2result
protx_3dsecurestatus
$order.billing_addressArrayBilling address details for the order.
$order.delivery_addressArrayDelivery address details for the order.
$order.storeArrayShipping store details for the order.
$order.discountsArrayA list of discounts applied to the order.
$order.discounts[n]ArrayDiscount details, plus data-points specified below.
$order.discounts[n].productsArrayA list of products included within the discount.
$order.discounts[n].products[n]ArrayProduct details for the discount.
$order.returnsArrayA list of returns for the order.
$order.returns[n]ArrayReturn details, plus data-points specified below.
$order.returns[n].user_nameStringThe name of the user who processed the return.
$order.returns[n].status_nameStringThe return status.
$order.returns_allowedInteger1 or 0 depending on whether returns are allowed for the specific order.
$order.refunds_allowedInteger1 or 0 depending on whether refunds are allowed for the specific order.
$order.exchanges_allowedInteger1 or 0 depending on whether exchanges are allowed for the specific order.
$countriesArrayA list of available shipping countries.
$countries[n]ArrayCountry details.
$storesArrayA list of available shipping stores.
$stores[n]ArrayStore details.

Custom Tab Example Template

As an example, please see the following Custom Tab template that will allow you to view all available variable data-points:

{assign var="vars" value=[order,countries,stores]}
{function name=printVar}
{if $item|is_array}
<span class="caret">{$label}</span>
<ul class="nested">
    {if $item|count > 0}
    {foreach from=$item key="key" item="val"}
        <li>{call name=printVar label=$key item=$val}</li>
    {/foreach}
    {else}
    <li><i>No values</i></li>
    {/if}
</ul>
{else}
<span class="value">{$label}: {if $item}{$item}{else}<i>No value</i>{/if}</span>
{/if}
{/function}
<div>
    <button id="toggle">Toggle All</button>
    <ul>
    {foreach from=$vars item="var"}
        <li>{call name=printVar label=$var item=${$var}}</li>
    {/foreach}
    </ul>
</div>
<style>{literal}
    ul {list-style-type: none;}
    .caret {cursor: pointer; user-select: none;}
    .caret::before {content: "\25B6"; color: black; display: inline-block; margin-right: 6px;}
    .value::before {content: "\25AE"; color: black; display: inline-block; margin-right: 6px;}
    .caret-down::before {transform: rotate(90deg);}
    .nested {display: none;}
    .active {display: block;}
{/literal}</style>
<script type="application/javascript">{literal}
    for (const caret of document.getElementsByClassName("caret")) {
        caret.addEventListener("click", function() {
            this.parentElement.querySelector(".nested").classList.toggle("active");
            this.classList.toggle("caret-down");
        });
    }
    document.getElementById("toggle").addEventListener("click", function() {
        for (const nested of document.getElementsByClassName("nested")) {
            nested.classList.toggle('active');
        }
        for (const caret of document.getElementsByClassName("caret")) {
            caret.classList.toggle('caret-down');
        }
    });
{/literal}</script>