Try our new AI assistant by clicking the chat icon in the lower right corner.


Sort Order History By Custom Fields

As of version 10.01.00, you can sort the order history list page (ORDH) by additional fields including Order Number, Status, Total, Data and any custom order field.

There are now additional options in the default sort setting to set the default view customers see on their order history list.

Custom Fields

In addition, custom order fields can be assigned to the page which will allow you to output them in the template code.

First Assign the custom fields you want access to the page:

They can then be accessed by the following template code:

Custom Field Name:

Custom Field Values:

In this example, order_ip is the custom order field code.

To view the Order History List screen, login as a customer, go to My Account and click on Order History.

As an example, let’s say we wanted to add a user sortable column to this view to allow the customer to sort their order history by IP Address, which is a custom order field. We can both display the custom order field data and make the column sortable.

Here is code to add the custom field sortable column:

SortBy Parameter will always be in the following format for sorting by custom fields:

Ascending

SortBy=customfield:<module_code>:<custom_field_code>

Descending

SortBy=customfield_desc:<module_code>:<custom_field_code>

Note

Most of the time the module code will be “customfields”. However, there are other modules which implement the custom field API. For example, if you wanted to show a custom field from the Order Workflows module the syntax would look like this: customfield:orderworkflow:successfully_retrieved_orders

Looking for Developer Docs?

We have a whole section for that, including: Developer Training Series, Template Language docs, Module Development tutorials and much, much more.

Head to the Developer Section

This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

Accept

Copyright © 1997 – 2021 Miva©, Miva Merchant©, MivaPay©, MivaCon© Miva, Inc. All Rights Reserved.