shopp('product.found')

Used to test if the requested product is available.

shopp('product.found', '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 boolean true if a product was loaded; false otherwise.

Determines if a product was loaded or not.

Additionally, this tag can be used to load several extra product details in one consolidated query to the database. Alternatively, if any tags are used to access details not pre-loaded with this tag, they would continue to act normally but would generate an extra query to the database. Where performance is a priority, and details that are known to be needed should be pre-loaded using the load option for this tag.

Options

  • load: Default is prices,images,specs. Used to specify what product data to load ahead of time in a single database query. Accepts multiple options separated by commas including: prices, images, categories, specs, tags. This option is useful for speeding up your store’s performance. The tradeoff is that it requires more server memory to process.

Examples

<?php if(shopp('product','found')) { … } ?>

Display a Product

<?php if(shopp('product','found')): ?>
    <h3><?php shopp('product','name'); ?></h3>
<?php else: ?>
    <p>No product found.</p>
<?php endif; ?>

Display a Product and Pre-load All Product Details

<?php if(shopp('product','found','load=prices,images,specs,categories,tags')): ?>
    <h3><?php shopp('product','name'); ?></h3>
<?php else: ?>
    <p>No product found.</p>
<?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