Purchase Tags
From Shopp Documentation
The Purchase tags are used to render a successfully completed order more commonly referred to as the receipt. They are found used in the receipt.php template file.
Most of the purchase tags mirror those of the Cart Tags as their data structure is very similar. However there are a number of differences in the purchase tags that are necessary for fully displaying information related to a completed order such as the transaction information.
id
- Overview
-
<?php shopp('purchase','id'); ?>
Displays the purchase order id number (or invoice number).
- Options
-
- None
date
- Overview
-
<?php shopp('purchase','date'); ?>
Displays the date the purchase order was created.
- Options
-
- None
card
- Overview
-
<?php shopp('purchase','card'); ?>
Displays the last four digits of the credit/debit card used to complete the purchase. The full card number is not stored by Shopp anywhere and is not available.
- Options
-
- None
cardtype
- Overview
-
<?php shopp('purchase','cardtype'); ?>
Displays the type of credit/debit card used to complete the transaction.
- Options
-
- None
transactionid
- Overview
-
<?php shopp('purchase','transactionid'); ?>
Displays the transaction id provided by the payment gateway on successfully processing the purchase.
- Options
-
- None
firstname
- Overview
-
<?php shopp('purchase','firstname'); ?>
Displays the first name of the shopper that placed the order.
- Options
-
- None
lastname
- Overview
-
<?php shopp('purchase','lastname'); ?>
Displays the last name of the shopper that placed the order.
- Options
-
- None
company
- Overview
-
<?php shopp('purchase','company'); ?>
Displays the company of the shopper that placed the order.
- Options
-
- None
- Overview
-
<?php shopp('purchase','email'); ?>
Displays the email address of the shopper that placed the order.
- Options
-
- None
phone
- Overview
-
<?php shopp('purchase','phone'); ?>
Displays the phone number of the shopper that placed the order.
- Options
-
- None
address
- Overview
-
<?php shopp('purchase','address'); ?>
Displays the first line of the billing address.
- Options
-
- None
xaddress
- Overview
-
<?php shopp('purchase','xaddress'); ?>
Displays a secondary line of the billing address.
- Options
-
- None
city
- Overview
-
<?php shopp('purchase','city'); ?>
Displays the name of the city associated with the billing address.
- Options
-
- None
state
- Overview
-
<?php shopp('purchase','state'); ?>
Displays the name of the state/province associated with the billing address.
- Options
-
- None
postcode
- Overview
-
<?php shopp('purchase','postcode'); ?>
Displays the postal code (or US ZIP code) associated with the billing address.
- Options
-
- None
country
- Overview
-
<?php shopp('purchase','country'); ?>
Displays the name of the country associated with the billing address.
- Options
-
- None
shipaddress
- Overview
-
<?php shopp('purchase','shipaddress'); ?>
Displays the first line of the shipping address.
- Options
-
- None
shipxaddress
- Overview
-
<?php shopp('purchase','shipxaddress'); ?>
Displays a secondary line of the shipping address.
- Options
-
- None
shipcity
- Overview
-
<?php shopp('purchase','shipcity'); ?>
Displays the name of the city associated with the shipping address.
- Options
-
- None
shipstate
- Overview
-
<?php shopp('purchase','shipstate'); ?>
Displays the name of the state/province associated with the shipping address.
- Options
-
- None
shippostcode
- Overview
-
<?php shopp('purchase','shippostcode'); ?>
Displays the postal code (or US ZIP code) associated with the shipping address.
- Options
-
- None
shipcountry
- Overview
-
<?php shopp('purchase','shipcountry'); ?>
Displays the name of the country associated with the shipping address.
- Options
-
- None
shipmethod
- Overview
-
<?php shopp('purchase','shipmethod'); ?>
Displays the name of the selected shipping method.
- Options
-
- None
totalitems
- Overview
-
<?php shopp('purchase','totalitems'); ?>
Displays the total number of line items on the order.
- Options
-
- None
hasitems
- Overview
-
<?php if(shopp('purchase','hasitems')) { … } ?>
Used to test if the order has any line items.
- Options
-
- None
- Examples
<?php if(shopp('purchase','hasitems')): ?> …content to show if the order has line items… <?php else: ?> …content to show if the order has no line items… <?php endif; ?>
items
- Overview
-
<?php while(shopp('purchase','items')) { … } ?>
Used to go through (iterate) each line item in the order. Typically used to list each line item. Use the other item-x tags to display different information associated with each line item.
- Options
-
- None
- Examples
<?php while(shopp('purchase','items')): ?> …content to show for each line item entry… <?php endwhile; ?>
item-name
- Overview
-
<?php shopp('purchase','item-name'); ?>
Displays the name of the current line item.
- Options
-
- None
item-product
- Overview
-
<?php shopp('purchase','item-product'); ?>
Displays the product id of the current item
- Options
-
- None
item-options
- Overview
-
<?php shopp('purchase','item-options'); ?>
Displays the selected line item's options, the selected variation's label.
- Options
-
- before: Text to show before the option label.
- after: Text to show after the option label.
item-sku
- Overview
-
<?php shopp('purchase','item-sku'); ?>
Displays the assigned SKU associated with the item (if any).
- Options
-
- None
item-download
- Overview
-
<?php shopp('purchase','item-download'); ?>
Displays a link to download the product file associated with the purchased line item.
- Options
-
- label: Default is Download Now. The text to be used to for the download link.
item-quantity
- Overview
-
<?php shopp('purchase','item-quantity'); ?>
Displays the item quantity ordered.
- Options
-
- None
item-unitprice
- Overview
-
<?php shopp('purchase','item-unitprice'); ?>
Displays the unit price of the line item.
- Options
-
- None
item-total
- Overview
-
<?php shopp('purchase','item-total'); ?>
Displays the total for the line item calculated by multiplying the quantity ordered by the unit price of the item.
- Options
-
- None
item-inputs-list
- Overview
-
<?php shopp('purchase','item-inputs-list'); ?>
Displays all of the custom inputs for the purchased item in an unordered list (<ul>).
- Options
-
- before: Text or markup to be displayed before inputs list.
- after: Text or markup to be displayed after the inputs list.
- class: Default is (empty). Allows you to specify a custom class for the <ul> element.
- exclude: Used to specify names of inputs to exclude from displaying in the list. Multiple inputs can be excluded by separating them with a comma: Input Name 1,Input Name2….
item-hasinputs
- Overview
-
<?php if(shopp('purchase','hasinputs')) { … } ?>
Tests whether the purchased item has any custom inputs.
- Options
-
- None
- Examples
- Display the list of purchased item inputs
<?php if(shopp('purchase','item-hasinputs')): ?> <ul> <?php while(shopp('purchase','item-inputs')): ?> <li><?php shopp('purchase','item-input','name'); ?>: <?php shopp('purchase','item-input'); ?></li> <?php endwhile; ?> </ul> <?php endif; ?>
This example generates a listing identical to the output created by shopp('purchase','item-inputs-list') and provides a base of reference for creating custom markup listings.
item-inputs
- Overview
-
<?php while(shopp('purchase','item-inputs')) { … } ?>
Loops through each purchased item input so that a custom input layout can be specified within the looping block. This is similar to "The Loop" structure in WordPress for displaying a custom layout for WordPress posts.
- Options
-
- None
- Examples
- Display the list of purchased item inputs
<?php if(shopp('purchase','item-hasinputs')): ?> <ul> <?php while(shopp('purchase','item-inputs')): ?> <li><?php shopp('purchase','item-input','name'); ?>: <?php shopp('purchase','item-input'); ?></li> <?php endwhile; ?> </ul> <?php endif; ?>
This example generates a listing identical to the output created by shopp('purchase','item-inputs-list') and provides a base of reference for creating custom markup listings.
item-input
- Overview
-
<?php shopp('purchase','item-input'); ?>
Used in the 'inputs' loop to show an individual purchased item input. With no options specified, this tag displays the value of the input.
- Options
-
- name: Displays the name of the purchased item input.
- Examples
- Display the list of purchased item inputs
<?php if(shopp('purchase','item-hasinputs')): ?> <ul> <?php while(shopp('purchase','item-inputs')): ?> <li><?php shopp('purchase','item-input','name'); ?>: <?php shopp('purchase','item-input'); ?></li> <?php endwhile; ?> </ul> <?php endif; ?>
This example generates a listing identical to the output created by shopp('purchase','item-inputs-list') and provides a base of reference for creating custom markup listings.
subtotal
- Overview
-
<?php shopp('purchase','subtotal'); ?>
Displays the subtotal price of the order in the currency format associated with the base of operations.
- Options
-
- None
hasfreight
- Overview
-
<?php shopp('purchase','hasfreight'); ?>
Displays the subtotal cost of the order in the currency format associated with the base of operations.
- Options
-
- None
freight
- Overview
-
<?php shopp('purchase','freight'); ?>
Displays the total shipping cost int he currency format associated with the base of operations.
- Options
-
- None
hasdiscount
- Overview
-
<?php shopp('purchase','hasdiscount'); ?>
Displays the subtotal price of the order in the currency format associated with the base of operations.
- Options
-
- None
discount
- Overview
-
<?php shopp('purchase','discount'); ?>
Displays the discount amount applied to the order by deducting from the order subtotal, in the currency format associated with the base of operations.
- Options
-
- None
hastax
- Overview
-
<?php shopp('purchase','hastax'); ?>
Displays the discount amount applied to the order by deducting from the order subtotal, in the currency format associated with the base of operations.
- Options
-
- None
tax
- Overview
-
<?php shopp('purchase','tax'); ?>
Displays the tax amount applied to the order based on the order subtotal, in the currency format associated with the base of operations.
- Options
-
- None
total
- Overview
-
<?php shopp('purchase','total'); ?>
Displays the total, final cost of the order in the currency format associated with the base of operations.
- Options
-
- None
