Skip to content
  1. Extras
  2. MiniShop3
  3. Snippets

MiniShop3 snippets

MiniShop3 provides a set of snippets for building the store frontend. All snippets work through pdoTools and support the Fenom template engine.

Snippet overview

SnippetPurpose
msProductsProduct list with filtering and sorting
msCartShopping cart display
msOrderCheckout form
msGetOrderOrder information
msGalleryProduct image gallery
msOptionsOptions for product filtering
msProductOptionsSpecific product characteristics
msCustomerCustomer account
msOrderTotalOrder total summary

General principles

Calling snippets

You can call all snippets via Fenom:

fenom
{'msProducts' | snippet : [
    'parents' => 5,
    'limit' => 10
]}

Or via standard MODX syntax:

modx
[[!msProducts?
    &parents=`5`
    &limit=`10`
]]

Caching

Snippets that use the user session (msCart, msOrder, msCustomer) must be called uncached (with !).

return parameter

return values depend on the snippet:

SnippetDefaultValues
msProductsdatadata, json, ids, sql
msCarttpltpl, data
msOrdertpltpl, data
msGetOrderchunk HTML only (no return parameter)
msGallerydatadata, tpl, json, sql
msOptionschunk HTML only
msProductOptionstpltpl, data, array
msCustomertpltpl, data
msOrderTotaltpltpl, data

Common values:

ValueDescription
tplRender through a chunk
dataData array (or HTML string for msProducts — see msProducts)
jsonJSON string (msProducts, msGallery)
idsComma-separated IDs (msProducts)

Numbers and *_formatted (#242)

Price and weight placeholders in chunks are numbers (float). Use *_formatted fields for display. The formatPrices parameter was removed as a no-op.

SnippetBehavior
msProductsprice_formatted, old_price_formatted, weight_formatted. Currency symbol only when withCurrency => true
msCart, msOrder, msGetOrder, msOrderTotal*_formatted always includes currency or weight unit

Customer account and auth — msCustomer snippet and Customer authentication.

toPlaceholder parameter

Instead of direct output, you can save the result to a placeholder:

fenom
{'msProducts' | snippet : [
    'toPlaceholder' => 'products'
]}

{* Use later *}
{$_modx->getPlaceholder('products')}

Default chunks

MiniShop3 ships with a set of ready-made chunks:

SnippetDefault chunk
msProductstpl.msProducts.row
msCarttpl.msCart
msOrdertpl.msOrder
msGetOrdertpl.msGetOrder
msGallerytpl.msGallery
msOptionstpl.msOptions
msProductOptionstpl.msProductOptions
msOrderTotaltpl.msOrderTotal

You can override chunks by creating your own or specifying another chunk in the tpl parameter.