Skip to content

Instantly share code, notes, and snippets.

@hiranthi
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiranthi/a2345fc464423d44804e to your computer and use it in GitHub Desktop.
Save hiranthi/a2345fc464423d44804e to your computer and use it in GitHub Desktop.
View all products of the current category (Shopp)
<?php
/**
* Filter $load_options
*/
function onx_custom_filter($load_options)
{
if ( is_admin() ) return $load_options;
if ( isset($_REQUEST['viewall']) || isset($_REQUEST['view-all']) )
$load_options['limit'] = 99999; // unreasonable high number
else
$load_options['paged'] = 10; // default number of products per page
//unset($load_options['where'][1]);
//$load_options['published'] = 'on';
//$load_options['debug'] = true;
//wp_die('<pre>'._object_r($load_options).'</pre>'); die;
return $load_options;
} // end onx_custom_filter
// smart-categories of Shopp
$slugs = array(
'catalog',
'new',
'featured',
'onsale',
'bestsellers',
'tag',
'related',
'alsobought',
'random',
'viewed',
'promo',
'search-results'
);
// attach the filter to all smart categories
foreach ( $slugs as $slug ) {
add_filter("shopp_{$slug}_collection_load_options", 'onx_custom_filter');
}
//---> The link for viewing all / disable viewing all:
/*
<a href="<?php echo (isset($_GET['view-all']))?add_query_arg('view-all',false):add_query_arg('view-all',true); ?>" title="<?php echo (isset($_GET['view-all']))?__('View less'):__('View all'); ?>"><?php echo (isset($_GET['view-all']))?__('View less'):__('View all'); ?></a>
*/
@chantalcoolsma
Copy link

Moet ik hier nog wat aanpassen? Als ik deze in functions.php kopieer, krijg ik wit scherm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment