Upsells
* Tweak - Removed upsell limit - show whats defined. * Tweak - Args for upsells to control per-page and cols.
This commit is contained in:
parent
66cf7d8e98
commit
f6d0bd2c06
|
@ -176,6 +176,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Tweak - Prefix jquery plugins JS.
|
||||
* Tweak - Made paypal use wc-api for IPN.
|
||||
* Tweak - Due to new session handling, removed session section from the status page.
|
||||
* Tweak - Removed upsell limit - show whats defined.
|
||||
* Tweak - Args for upsells to control per-page and cols.
|
||||
|
||||
* Fix - Added more error messages for coupons.
|
||||
* Fix - Variation sku updating after selection.
|
||||
|
|
|
@ -11,7 +11,7 @@ global $product, $woocommerce_loop;
|
|||
|
||||
$related = $product->get_related();
|
||||
|
||||
if ( sizeof($related) == 0 ) return;
|
||||
if ( sizeof( $related ) == 0 ) return;
|
||||
|
||||
$args = apply_filters('woocommerce_related_products_args', array(
|
||||
'post_type' => 'product',
|
||||
|
|
|
@ -16,14 +16,16 @@ if ( sizeof( $upsells ) == 0 ) return;
|
|||
$args = array(
|
||||
'post_type' => 'product',
|
||||
'ignore_sticky_posts' => 1,
|
||||
'posts_per_page' => 4,
|
||||
'no_found_rows' => 1,
|
||||
'orderby' => 'rand',
|
||||
'posts_per_page' => $posts_per_page,
|
||||
'orderby' => $orderby,
|
||||
'post__in' => $upsells
|
||||
);
|
||||
|
||||
$products = new WP_Query( $args );
|
||||
|
||||
$woocommerce_loop['columns'] = $columns;
|
||||
|
||||
if ( $products->have_posts() ) : ?>
|
||||
|
||||
<div class="upsells products">
|
||||
|
|
|
@ -721,20 +721,22 @@ if ( ! function_exists( 'woocommerce_output_related_products' ) ) {
|
|||
* @return void
|
||||
*/
|
||||
function woocommerce_output_related_products() {
|
||||
woocommerce_related_products( 2, 2 );
|
||||
woocommerce_related_products( 2, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'woocommerce_related_products' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Output the related products.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @param int $posts_per_page (default: 2)
|
||||
* @param int $columns (default: 2)
|
||||
* @param string $orderby (default: 'rand')
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_related_products( $posts_per_page = 4, $columns = 4, $orderby = 'rand' ) {
|
||||
function woocommerce_related_products( $posts_per_page = 2, $columns = 2, $orderby = 'rand' ) {
|
||||
woocommerce_get_template( 'single-product/related.php', array(
|
||||
'posts_per_page' => $posts_per_page,
|
||||
'orderby' => $orderby,
|
||||
|
@ -747,13 +749,19 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
|||
|
||||
/**
|
||||
* Output product up sells.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @param int $posts_per_page (default: -1)
|
||||
* @param int $columns (default: 2)
|
||||
* @param string $orderby (default: 'rand')
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_upsell_display() {
|
||||
woocommerce_get_template( 'single-product/up-sells.php' );
|
||||
function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) {
|
||||
woocommerce_get_template( 'single-product/up-sells.php', array(
|
||||
'posts_per_page' => $posts_per_page,
|
||||
'orderby' => $orderby,
|
||||
'columns' => $columns
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue