Skip to content
Everett Griffiths edited this page Jul 3, 2014 · 1 revision

Your products are formatted with a template like any regular MODX page, but the main distinction is that a product uses "+" style placeholder tags (instead of the traditional "*" placeholder tags).

Available Placeholders

Primary

  • [[+product_id]]
  • [[+store_id]]
  • [[+parent_id]] The parent product, used only if the product is a variation (usually null)
  • [[+template_id]] The id of the template selected to format the output
  • [[+asset_id]] The id of primary image (or asset) for this product. Normally this would get passed as an argument to the Asset Manager's Asset Snippet.
  • [[+name]]
  • [[+title]] Intended for use as the title in a browser.
  • [[+meta_keywords]]
  • [[+description]]
  • [[+content]] the main content block
  • [[+type]]
  • [[+sku]] your (unique) product code. Although uniqueness is encouraged, it is not enforced.
  • [[+sku_vendor]] the SKU your vendor uses for the product (use this if you are reselling an item)
  • [[+alias]] the URL-friendly name for your product, all lowercase using only alphanumeric characters, dashes, and underscores.
  • [[+uri]] this combines the alias of the parent store and the product creating the relative URI (aka URL) for the product. This must be unique.
  • [[+track_quantity]] simple 1 or 0 indicating whether the product is tracking inventory or not.
  • [[+qty_inventory]] integer count of how many items you have in stock
  • [[+qty_alert]] when your inventory level hits this number, generate an alert (only if track_inventory is enabled)
  • [[+qty_min]] the minimum number of products that are added to the cart when the user purchases the product
  • [[+qty_max]] the maximum number of product a user can add to their cart when purchasing the product.
  • [[+qty_backorder_max]] when set, this would allow your inventory to dip negative for up to this amount.
  • [[+price]] raw price for the product, stored as a number with 2 decimal places. Use calculated_price to intelligently toggle between the price and the sale price. The currency is defined in your Foxycart store.
  • [[+price_strike_thru]] a number with 2 decimal places, intended for eye-candy for your templates where a higher price is shown crossed out
  • [[+price_sale]] a number with 2 decimal places indicating the price of your product when on sale.
  • [[+weight]] a number with 2 decimal places indicating the weight of the product. The unit of weight is defined in your Foxycart store.
  • [[+sale_start]] optional date field (in YYYY-MM-DD) when this product goes on sale.
  • [[+sale_end]] optional date field (in YYYY-MM-DD) when the sale for this product ends.
  • [[+category]] the Foxycart category for this product.
  • [[+in_menu]] 1 or 0 used to include a product in menu generation queries

Supplemental

In addition to the regular placeholders, a product may have additional placeholders depending on how you have defined the following:

  • Custom Fields : any custom fields that you have added to your product will have a placeholder available corresponding to the field slug.
  • Options : any options that you have added to your product will have a placeholder available corresponding to the option slug, e.g. [[+size]]

Sample Templates

Here is a sample product template. We're using the Asset Snippet to format the primary image and to render the custom fields named product_specs and product_cad.

[[$html_head]]

<div id="main-wrapper" class="product">
	[[$site_header]]
	<section id="product-container">
		<div class="wrap">
			<section id="gallery-bg"></section>
			<section id="product-gallery">
				<div class="featured-image">
                    [[Asset? &asset_id=`[[+asset_id]]` 
                        &tpl=`<img class="product-image" href="[[+url]]" data-href="[[+url]]" src="[[+url]]" data-src="[[+url]]"/>` ]]
				</div>
				<div class="related-images">
					[[!getProductImages? &outerTpl=`` &innerTpl=`related_image_tpl` &group=`gallery`]]
				</div>
				<div id="product-slider">
					<div class="wrap">
						[[!getProductImages? &outerTpl=`` &innerTpl=`mobile_product_image` &group=`gallery`]]
					</div>
				</div>
			</section>
			<div class="clearfix"></div>
		</div>
		<section id="product-detail">
			<div class="wrap">
				<div class="section-wrap">
					<h1 class="product-title">[[+name]]</h1>
					<p class="price-tag"><span class="price">[[+price]]</span><span>.00</span></p>
					<div class="detail">
						<p class="head">Description</p>
						[[+content]]
						
					</div>
					<div class="detail">
						<p class="head">Dimensions</p>
						<p>[[+dimensions]]</p>
					</div>
					
					[[!addToCartButton? &submit=`Add to Cart` &cssClassSubmit=`add-to-cart` &soldout=`<span class="sold">Sold!</span>` &cssClassOptionLabel=`addcart-lbl` &cssClassOptionSelect=`addcart-select`]]
					
					<div class="more">
						[[Asset? &asset_id=`[[+product_specs]]` &tpl=`<a href="[[+url]]" target="_blank" data-no-instant>Download specs</a>` ]]
						[[Asset? &asset_id=`[[+product_cad]]` &tpl=`<a href="[[+url]]" target="_blank" data-no-instant>Download CAD</a>` ]]
					</div>
					[[$share_buttons]]
				</div>
			</div>
		</section>
	</section>
	[[$site_footer]]
</div>
[[$html_footer]]
Clone this wiki locally