View Single Post
Old 05-29-2021, 01:17 AM
PhilJ PhilJ is offline

Join Date: Nov 2002
Posts: 3,950

Default Re: Historical Order Status

Here you go... (tested on v4.7.12 but should work fine on earlier versions)

Just search for orders by date-range in the usual way... a new button will appear at the bottom of the results page.

Updated 1st June - Simplified, includes export buttons, supports custom order statuses

1) Create a new file - /skin/common_files/main/orders_list_summary.tpl
{if $active_modules.XOrder_Statuses} {* SETTINGS *} {assign var="button_title" value="Orders Statuses Summary by Date"} {assign var="always_open" value=false} {assign var="status_colors" value=false} {assign var="pdf_export" value=false} {* /SETTINGS *} {tpl_order_statuses var="avail_statuses"} {assign var="df" value=$config.Appearance.date_format} {if $df ne "%m-%d-%Y" && $df ne "%m/%d/%Y"} {assign var="euro_date" value=true} {/if} <link rel="stylesheet" type="text/css" href=""/> {if $pdf_export} <script type="text/javascript" src=""></script> <script type="text/javascript" src=""></script> {/if} <script type="text/javascript" src=""></script> <script src=""></script> <script src=""></script> {if $euro_date} <script src=""></script> {/if} <style> #statuses_summary { border: 1px solid #999; } table.dataTable thead th, table.dataTable thead td { border-bottom: 1px solid #999; } summary { display: inline; cursor: pointer; } summary span { color: #0e55a6; border: 1px solid #3f698b; padding: 0.3em 0.5em; background: #ebf4fe url("images/ui-bg_glass_100_ebf4fe_1x400.png") 50% 50% repeat-x; border-radius: 5px; } .TableHeadSort, .even_row { background: #f5f5f5 !important; } </style> <details{if $always_open} open{/if}> <summary><h3><span><i class="fa fa-calendar"></i> {$button_title} <i class="fa fa-chevron-down"></i></span></h3></summary> <table cellpadding="2" cellspacing="1" width="100%" style="margin:10px 0;" class="display nowrap" id="statuses_summary"> <thead> <tr class="TableHeadSort"> <th style="text-align:left;">{$lng.lbl_date}</th> {foreach from=$avail_statuses item=st} <th{if $status_colors} class="xostatus-orderstatus-background-{$st.code}"{/if}>{$} ({$st.code})</th> {/foreach} </tr> </thead> <tbody> {assign var="p_date" value=""} {foreach from=$orders item=order name=order} {assign var=o_date value=$|date_format:$df} {if $o_date ne $p_date} <tr style="text-align:center;"> <td style="text-align:left;">{$|date_format:$df|replace:'-':'/'|replace:'.':'/'}</td> {foreach from=$avail_statuses item=st} <td>{assign var=o_count value=0}{section name=oid loop=$orders}{if $orders[oid].status eq $st.code && $orders[oid].date|date_format:$df eq $o_date}{assign var=o_count value=$o_count+1}{/if}{/section}{if $o_count}{$o_count}{else}-{/if}</td> {/foreach} </tr> {assign var="p_date" value=$o_date} {/if} {/foreach} </tbody> </table> </details> {literal} <script> $(document).ready(function (){ $.fn.dataTable.moment('{/literal}{$df|replace:'%d':'DD'|replace:'%m':'MM'|replace:'%Y':'YYYY'}{literal}'); $('#statuses_summary').DataTable({ "searching": false, "paging": false, "stripeClasses": [ 'odd_row', 'even_row' ], "columnDefs": [{ type: 'date{/literal}{if $euro_date}-euro{/if}{literal}', targets: 0 }], "order": [[ 0, 'asc' ]], // Date order, asc | desc "dom": 'Bfrtip', "buttons": [ 'copy', 'csv', 'excel',{/literal}{if $pdf_export} 'pdf',{/if}{literal} 'print' ] }); }); </script> {/literal} {else} Please enable the <a href="./modules.php">Custom Order Statuses</a> module. {/if}

2) In /skin/common_files/main/orders.tpl

{if $usertype ne "C" and $mode ne "search" and $current_membership_flag ne 'FS'}
{if $usertype ne "C" && $mode eq "search" && $orders ne ""} {include file="main/orders_list_summary.tpl"} {/if}
3) Clear the template cache.
Attached Files
File Type: tpl orders_list_summary.tpl (3.8 KB, 3 views)
XCARTMODS.CO.UK | reBOOT Template | Changelog
Reply With Quote