perch_shop_orders()
Display a list of orders for the logged in customer using perch_shop_orders()
.
Requires
- Perch Shop installed
Parameters
Type | Description |
---|---|
Array | Options array, see table below |
Boolean | Set to true to have the value returned instead of echoed. |
Options array
Name | Value |
---|---|
template | The name of a template to use to display the content. |
sort | The ID of the field to sort on. |
sort-order | Either ASC (ascending), DESC (descending) or RAND (random). |
sort-type | Either alpha or numeric . Default is alpha . |
count | The number of items to display. |
start | The item number to start displaying from. |
filter | The ID of a field to filter the results by. |
match | Used with filter, see the below table for values |
value | Used with filter and match. The value to match. For between and in , takes a comma delimited string. For regex takes PCRE regular expression. |
category | Filter by one or more categories. See Category filtering |
category-match | Either any or all . See Category filtering |
skip-template | True or false. Bypass template processing and return the content in an associative array. |
return-html | True or false. For use with skip-template . Adds the HTML onto the end of the returned array with key html . |
split-items | True or false. Return an array of individually templated items. |
raw | True or false. Returns unprocessed content, for use alongside skip-template. |
paginate | True or false. Whether to use pagination. |
count | Integer. (When used with paginate ) The number of items to show per page if pagination is being used. |
pagination-var | The URL query string parameter name to use for the page number. Defaults to page. |
page-links | True or false. Create numbered page links as well as previous and next links. |
page-link-template | The template to use (if not the default) to generate the page links. |
page-link-style | shortened or all. By default a shortened set of page links are generated. If you want a link for every page, set to all. |
Usage examples
Display orders with the default template. The default template is shop/orders/list.html
.
perch_shop_orders();
This function accepts an array of options to control what is returned. It can be used as follows.
perch_shop_orders([
'template' => 'order_list.html',
'count' => 10,
]);