Fatal error on Call to undefined method CatalogProducts::load_images()

Summary

When loading a pre-programmed product collection or tag collection of products, a fatal error occurs.

Symptoms

When loading a product collection that is not a product category, such as featured products, new products, catalog products, etc. a fatal error occurs trying to load product category images.

Error Message(s)

Fatal error: Call to undefined method CatalogProducts::load_images() in wp-content/plugins/shopp/api/theme/collection.php on line 351

Impacts

Shopp Version: 1.2

Known Causes

Only product category collection have images, and the theme api call does not check to make sure the collection is a product category before attempting to load them.

Solution

Make the following change to your ShoppCollectionThemeAPI::has_images() static method to protect against this scenario in shopp/api/theme/collection.php:

static function has_images ($result, $options, $O) {
    if ( ! is_a($O, 'ProductCategory') ) return false;
    if (empty($O->images)) $O->load_images();
    if (empty($O->images)) return false;
    return true;
}

Bug Ticket

#1527

See Also

Fatal error on Call to undefined method CatalogProducts::load_images()
  • 0.00 / 5 5

You must be logged in to post a comment.

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

Skip to toolbar