Last active
August 29, 2015 14:06
-
-
Save hiranthi/a2345fc464423d44804e to your computer and use it in GitHub Desktop.
View all products of the current category (Shopp)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moet ik hier nog wat aanpassen? Als ik deze in functions.php kopieer, krijg ik wit scherm.