shopp('storefront.product')

Loads a specified product and displays it using the [[product.php content template]].

shopp('storefront', 'product', 'options')

@param string $object the object or object.tag combination, if object.tag is used, the tag parameter can be omitted
@param string $tag the tag, can be hyphenated or not. Prefix with 'get' as shorthand for the return=true option
@param mixed $options associative array, or url-style name=value pairs separated by ampersands (&). Each pair is passed to the theme api tag as an option.
@returns string Markup for a product from the product template

Loads a specified product and displays it using the product.php content template.

This call can be used to load a product into the current product context for use with Product Theme API tags by including the load option. When the load option is set, this tag will load the product from the database but will not display anything, allowing a custom layout of product information to follow.

Options

  • id: Specifies the product to be displayed by matching the product ID number. This is an alternative and is a faster database lookup then using the name.
  • load: Default is false. Loads the product into memory, making it available for using product.php content template rather than displaying the product using the product.php content template.
  • name: Specifies the product to be displayed by the product name. An exact match is necessary (including uppercase/lowercase letters).
  • next: Used to set the current product to be displayed by shopp('product') tags to the next product of the current category context. If no other category context is available, the Catalog Products smart category is used. {{AI1.1}}
  • previous: Used to set the current product to be displayed by shopp('product') tags to the previous product of the current category context. If no other category context is available, the Catalog Products smart category is used. {{AI1.1}}
  • slug: Specifies the product to be displayed by the product slug, the product identifier at the end of a product permalink.

Universal Options

All Theme API calls have these options.

  • return: when set to true, 1, or on, this option forces the tag to return the value instead of displaying/echoing the value to the page. Alternatively, prefix the tag parameter with get to get the same effect. All theme api tags that return a boolean value will return by default.
  • echo: when set to false, 0, or off, this option forces the tag to display the value to the page. This is the default for all non-boolean tags.
  • is: when set to true, 1, or on, this option will evaluate the return of the theme api call as a boolean true or false value. See how values are converted to boolean.

Examples

Load & display a specific product with the layout in the product.php template

<?php shopp('storefront','product','id=555'); ?>

Show a the name of the product with ID of 92 in the database

<?php shopp('storefront','product','id=92&load=on'); ?>
<?php if (shopp('product','found')): ?>


<h1><?php shopp('product','name'); ?></h1>


<?php endif; ?>

Show the image gallery of a product with the slug wordpress-tshirt

<?php shopp('storefront','product','slug=wordpress-tshirt&load=on'); ?>
<?php if (shopp('product','found')): ?>


<h1><?php shopp('product','gallery'); ?></h1>


<?php endif; ?>

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar