Skip to content
fireproofsocks edited this page Nov 8, 2014 · 9 revisions

getProductImages

Returns a list of images associated with the given product (defaults to the current product).

Parameters

  • @param integer $product_id of the product whose images you want. Defaults to the current product (if used in a product template)
  • @param string $content_ph custom content placeholder, default to content
  • @param string $outerTpl Format the Outer Wrapper of List (Optional, default: <ul>[[+content]]</ul>)
  • @param string $innerTpl Format the Inner Item of List. Default: <li><img src="[[+Asset.url]]" width="[[+Asset.width]]" height="[[+Asset.height]]" alt="[[+Asset.alt]]" /></li>
  • @param boolean $is_active Get all active records only
  • @param int $limit Limit the records to be shown (if set to 0, all records will be pulled)
  • @param string $js_paths comma separated values for custom js plugins or script to add effect on images
  • @param string $css_paths comma separated values for custom css to format images
  • &omit mixed comma-separated list of asset ids (or an array). If present, omit these ids.

Available Placeholders in innerTpl

Placeholders in the innerTpl Chunk use the "Asset." prefix (due to the nature of the underlying query).

  • [[+Asset.url]]
  • [[+Asset.width]]
  • [[+Asset.height]]
  • [[+Asset.alt]]
  • [[+Asset.thumbnail_url]]

e.g. to format the large image:

<img src="[[+Asset.url]]" width="[[+Asset.width]]" 
      height="[[+Asset.height]]" alt="[[+Asset.alt]]" />

Thumbnail:

<img src="[[+Asset.thumbnail_url]]" />

If needed, include the System Settings (double ++) :

[[++moxycart.thumbnail_width]]
[[++moxycart.thumbnail_height]]

e.g.

<img src="[[+Asset.thumbnail_url]]" width="[[++moxycart.thumbnail_width]]" 
    height="[[++moxycart.thumbnail_width]]" alt="[[+Asset.alt]]"/>

Available Placeholders for outerTpl

  • [[+content]]

The outerTpl wraps the cumulative output of the innerTpl instances.

Usage

To get all Images on certain product

[[!getProductImages? 
    &product_id=`[[+product_id]]` 
    &outerTpl=`sometpl` 
    &innerTpl=`othertpl` 
    &firstCLass=`first`
    &js_paths=`http://cdnjs.cloudflare.com/ajax/libs/jquery.cycle/3.03/jquery.cycle.all.min.js,[[++moxycart.assets_url]]js/templates/product_images.js` 
   &css_paths=`[[++moxycart.assets_url]]css/templates/product_images.css`
    &is_active=`1` 
    &limit=`0`]]

WARNING: like other Snippets that attempt to support "formatting strings" as in-line replacements for Chunks, it is recommended that you use Chunk names because the in-line formatting strings sometimes do not parse correctly, especially when nested tags are used.

Clone this wiki locally