In this article you'll find what you can use (variables, modifiers or functions), if you want to customize your report templates. 

Quick stats
(Quick reports in the merchant panel)

How to edit this template?
Open your merchant panel and go to Configuration->Design


Now in Design window choose tab: 
  • Affiliate panel theme - if you wan to edit affiliates' quick report appearance
  • Merchant panel theme - if you wan to edit merchant's quick report appearance

Click the  Edit theme  button in your active theme. If  the Create new theme window appears just click the Create button. 
The Theme editor window will appear. You can edit this template by five easy steps:


  1. enter the name of the template to the search box in the Theme Files tab. In this case you will type in the following name: quick_report_content.stpl 
  2. press the Search button.
  3. click the particular file in the file list under the search box. 
  4. On the right side of the theme editor window there will be the source code of the particular template, which you can customize.
  5. When done, press the Save button.
You are done. Make sure the freshly edited (created) theme is the active one - press the 'Set as default' button in it.  After this you can see your changes in action.

In the Quick report template you can use the following variables:

Name: sumTransaction
Description: Helper for summarizing transactions
Example usage:
In this example we iterate through all our transaction types for the first tier, and then we display an output summary. First we must do the math thing:

Example 1:
{$sumTransaction->clear()}
{foreach from=$transactionTypes item=transactions}
   {$sumTransaction->add($transactions)}
{/foreach}
Now we must output the results:

Example 2:
All pending transactions count: {$sumTransaction->count->pending}All pending transactions total cost: {$sumTransaction->totalCost->pending}All approved transactions commissions: {$sumTransaction->commission->approved}
All the possibilities you can use after you add some data to sumTransaction object (like we do in Example 1):

sumTransaction
  • count
    • approved
      • Description: Count of all approved transactions
      • Example use in template: $sumTransaction->count->approved
    • pending
      • Description: Count of all pending transactions
      • Example use in template: $sumTransaction->count->pending
    • declined
      • Description: Count of all declined transactions
      • Example use in template: $sumTransaction->count->declined
    • paid
      • Description: Count of all paid transactions
      • Example use in template: $sumTransaction->count->paid
    • all
      • Description: Count of all transactions (all above types)
      • Example use in template: $sumTransaction->count->all
  • commission
    • approved
    • pending
    • declined
    • paid
    • all
  • totalCost
    • approved
    • pending
    • declined
    • paid
    • all
Name: clicks
Description: Contains count of clicks and commission information for clicks
Example usage:
In this example we print out the count of raw clicks  and commissions for approved clicks:

Example 3:
Raw clicks info:
Count: $clicks->count->raw
Commissions for approved : $clicks->commission->approved
All possibilities you can use with this variable:

clicks
  • count
    • raw
    • unique
    • declined
  • commission
    • approved
    • pending
    • declined
    • all
Name: impressions
Description: Contains count of impressions and commission information for impressions
Example usage:
In this example we print out the count of impressions  and commissions for approved impressions:

Example 4:
Raw impressions info:
Count: $impressions->count->raw
Commissions for approved : $impressions->commission->approved
All possibilities you can use with this variable:

impressions
  • count
    • raw
    • unique
  • commission
    • approved
    • pending
    • declined
    • all
Name: transactionTypes
Description: Contains stats about all types of transactions you have (clicks, sales, actions, etc...) in first tier only.
Example usage:
In this example we print out some information about all the transactions types:

Example 5:
Transactions types list:
<table>
  <tr><td>Name</td><td>Count</td></tr>
  {foreach from=$transactionTypes item=transactions}
    <tr><td>{$transactions->name}</td><td>{$transactions->count->all}</td></tr>
  {/foreach}
Notice, that we need to iterate through this variable to get certain type of transaction and statistics for it. We do that through the {foreach from=$transactionTypes item=transactions}command. From this line (to line that contains {/foreach} ) we can work with variable transactions. Now with this variable we have these possibilities:

transactions
  • type 
    • Description: This varaible contins letter that represent type of the transaction
    • Possible values: A - action, S - sale, C - click, R - refunds, H - chargebacks, I - impressions
    • Example of use: $transactions->type
  • name
    • Description: This varaible contins the name of transaction. This is Sale, Click or similiar name in common basic types. However in action this is the name of action.
    • Example of use: $transactions->name
  • count - counts of certain transactions types
    • pending
    • approved
    • declined
    • paid
    • all
  • commission - commissions sums of certain transactions types
    • pending
    • approved
    • declined
    • paid
    • all
  • totalCost - total cost sums of certain transactions types
    • pending
    • approved
    • declined
    • paid
    • all
  • refunds - refunds sums of certain transactions types
    • pending
    • approved
    • declined
    • paid
    • all
  • chargebacks - chargebacks sums of certain transactions types
    • pending
    • approved
    • declined
    • paid
    • all
Name: transactionTypesTier
Description: Contains stats about all types of transactions you have (clicks, sales, actions, etc...) for tiers higher than 1 (multi-tier).
Example usage: same as for transactionTypes


Using modifiers
In your customized reports you can also use predefined modifiers. These modifiers can help you with formatting of values. You can use the following modifiers:

Name: date
Description: This modifier can help you format the date to your local date format (in PHP environment).
Example of use:
{$myCustomDate|date}
Result:
18.9.1984

Name: number
Description: This modifier can help you format your number value with predefined thousands and decimal separators (used in PAP)
Example use:
{$myValue|number}
Result:
18 456.12

Name: number_span
Description: same as number, but also applies special css div for number used by pap in reports.
Example use:
{$myNumber|number_span}
Example result:

Example result in HTML:
<span class="NumberData">0</span>


Name: currency
Description: This modifier can help you with formatting your currency values (prices etc).
Example use:
{$myPriceValue|currency}
Result:
$ 99.99

Name: currency_span
Description: same as currency, but also apply special css div for currency. This means that when number is negative, value will be red, and if it is positive value will be (by default) blue.
Example use:
{$myPriceValue|currency_span}
Example result:

Example result in HTML:
<span class="CurrencyData">$ 747.59</span>
<span class="NumberDataRed">$ -1,37</span>

Using functions
In smarty you can also use some predefined functions to help you with magic numbers. You can use these functions:

Name: ratioColon
Description: This function helps you print two numbers when you want to compare them.
Example use:
{ratioColon p1='25' p2='35'}
Result:
25 : 35

Name: ratio
Description: This function divides two numbers and then formats number to standard PAP format. 
Precision settings from PAP will be used.
Example use:
{ratio p1='25' p2='35'}
Result:
0.74

Name: ratioPercentage
Description: This function computes ratio in percentage format. Precision settings from PAP will be used.
Example use:
{ratio p1='25' p2='35'}
Result:
74 %



×