msCart
Snippet is designed to display customer's cart.
Parameters
Parameter | By default | Description |
---|---|---|
tpl | tpl.msCart | Formatting chunk |
includeTVs | List of TV parameters for a sample, separated by commas. For example: "action,time" is given by placeholders [[+action]] and [[+time]] . | |
includeThumbs | List of preview dimensions for a sample, separated by commas. For example: "120x90,360x240" is given by placeholders [[+120x90]] and [[+360x240]] . | |
toPlaceholder | If not empty, snippet will store all data in placeholder with this name, instead of display. | |
showLog | To show additional information of the snippet operation. For authorized in "mgr" context only. |
Tip
Another pdoTools general parameters may be used.
Formatting
Snippet counts on work with Fenom chunk. It transfers there 2 variables:
- total - array of final cart values, in which:
- count - number of goods
- cost - price of goods
- weight - total goods weight
- products - array of cart goods, where every product contains:
- key - a key of the product in the cart, hash of its values and options
- count - quantity of goods
- cost - cost per unit of goods
- id - goods identifier
- pagetitle - title of the goods page
- uri - product address
- other product characteristics, including options, manufacturer's characteristics, etc.
Placeholders
Simply indicating empty chunk, you may see all item characteristics and final values:
modx
<pre>[[!msCart?tpl=``]]</pre>
Also modifier print may be used for debugging. Simply create chunkTestCart
and indicate in it:
fenom
{$total | print}
{foreach $products as $product}
{$product | print}
{/foreach}
Then call it in the cart:
modx
[[!msCart?
&tpl=`TestCart`
]]
And you will see all available placeholders.
Order creation
It is recommended to call this snippet in junction with others in ordering page:
modx
[[!msCart]] <!-- Review and change of the cart. Hidden after order creation -->
[[!msOrder]] <!-- Order form.Hidden after order creation -->
[[!msGetOrder]] <!-- Display of order information. Showed after order creation -->