Skip to content
  1. Extras
  2. miniShop2
  3. Snippets
  4. msGetOrder

msGetOrder

Snippet for displaying a completed order.

Used on the checkout page and for email notifications to customers.

Parameters

ParameterDefaultDescription
idOrder id; if omitted, taken from $_GET['msorder'].
tpltpl.msGetOrderOutput chunk
includeTVsComma-separated TV list.
includeThumbsComma-separated thumbnail sizes.
toPlaceholderIf set, save output to a placeholder instead of outputting.
includeContentfalseInclude product "content" field in order items.
payStatus1Expected payment status for displaying the payment link.
showLogfalseShow debug info. Only for users authorized in context "mgr".

Подсказка

You can also use other general pdoTools parameters.

Output

The snippet expects a Fenom chunk and passes 7 variables:

  • order — order data from msOrder
  • products — order items with full product data
  • user — customer data from modUser and modUserProfile
  • address — delivery address from msAddress
  • delivery — selected delivery from msDelivery
  • payment — selected payment from msPayment
  • total — order totals: cost, weight, delivery_cost, cart_cost, cart_weight, cart_count, cart_discount

Snippet parameters (e.g. payment_link in email chunks) are also available.

Placeholders

To see all placeholders, use an empty chunk:

modx
<pre>[[!msGetOrder?tpl=``]]</pre>
Example
php
Array
(
    [order] => Array ( [id] => 1, [num] => 2311/1, [cost] => 2100, [status] => 1, ... )
    [products] => Array ( [0] => Array ( [name] => Product 1, [count] => 3, [cost] => 1 500, ... ), ... )
    [user] => Array ( [fullname] => Ivan Ivanov, [email] => ..., ... )
    [address] => Array ( [receiver] => Ivan Ivanov, ... )
    [delivery] => Array ( [name] => Pickup, ... )
    [payment] => Array ( [name] => Cash, ... )
    [total] => Array ( [cost] => 2 100, [cart_count] => 4, ... )
)

Checkout

Use together with other snippets on the checkout page:

modx
[[!msCart]] <!-- Cart; hidden after order is created -->

[[!msOrder]] <!-- Checkout form; hidden after order is created -->

[[!msGetOrder]] <!-- Order info; shown after order is created -->

Email templates

This snippet is used by miniShop2 for email notifications if enabled in order status settings. All msGetOrder variables — order, products, user, address, delivery, payment, total — are available in email chunks.

By default all emails extend one base chunk tpl.msEmail and override blocks:

  • logo — store logo with link to home
  • title — email title
  • products — order products table
  • footer — site link in footer

Example: new order email to customer:

fenom
{extends 'tpl.msEmail'}

{block 'title'}
  {'ms2_email_subject_new_user' | lexicon : $order}
{/block}

{block 'products'}
  {parent}
  {if $payment_link?}
    <p style="margin-left:20px;{$style.p}">
      {'ms2_payment_link' | lexicon : ['link' => $payment_link]}
    </p>
  {/if}
{/block}

Here the base template is extended, the title is set, and the payment link is added to the products block when present.

See Fenom extends documentation for more on template inheritance.