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

msGetOrder

Snippet for formed order display.

Is used on ordering page and for mailing notification to customers.

Parameters

ParameterBy defaultDescription
tpltpl.msGetOrderFormatting chunk
includeTVsList of TV parameters for sampling, separated by commas. For example: "action,time" is given by [[+action]] and [[+time]] placeholders.
includeThumbsList of sample preview dimensions, separated by commas. For example: "120x90,360x240" is given by [[+120x90]] and [[+360x240]] placeholders. The pictures should be pre-generated in item s gallery.
toPlaceholderIf filled, the snippet will store all data in placeholder with this name, instead of displaying.
showLogTo show additional information on snippet operation. For authorized in "mgr" context only.

Tip

Another pdoTools general parameters may be used.

Formatting

Snippet counts on work with chunk Fenom and transfers 7 variables there:

  • order - order data array from msOrderobject
  • products - ordered goods array with all their properties
  • user - data array of modUser and modUserProfileobjects with all customer's characteristics
  • address - data array of msAddress object with delivery data
  • delivery - array of selected delivery characteristics ofmsDelivery object
  • payment - array of selected payment characteristics ofmsPaymentobject
  • total - totals order array:
    • cost - total order cost
    • weight - total order weight
    • delivery_cost - separate delivery cost
    • cart_cost - separate ordered goods cost
    • cart_weight - total weight of the ordered goods
    • cart_count - ordered goods number

Data, transferred when calling snippet, may also be present. For example, the variable payment_link may be in new letter formatting chunk

Placeholders

All available order placeholders may be seen when displaying empty chunk:

modx
<pre>[[!msGetOrder?tpl=``]]</pre>

Order creation

It is recommended to call this snippet in junction with the others on ordering page:

modx
[[!msCart]] <!-- Cart view and change, hidden after order creation -->

[[!msOrder]] <!-- Ordering form, hidden after order creation -->

[[!msGetOrder]] <!-- Order information display, showed after its creation -->

Writing letters

This snippet is used by miniShop2 class for writing mail notification to customers, if you switch on such sending in status settings. All msGetOrder snippet variables: order, products, user, address, delivery, payment and total are also available in letters of mail notifications.

All the letters expand single basic mail template tpl.msEmail and change its blocks by default:

  • logo - logo of the shop with home page reference
  • title - letter title
  • products - ordered goods table
  • footer - site reference in letter footage

For example, the letter with new customer's order, is:

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}

As you can see, the main template is inherited, the title is changed, and payment reference is added to the table of goods (if any).

More details of template expanding you may find in Fenom documentation.