diff --git a/readme.txt b/readme.txt index 453eca2e58c..7a299e8c9a2 100644 --- a/readme.txt +++ b/readme.txt @@ -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. diff --git a/templates/single-product/related.php b/templates/single-product/related.php index c91977f833a..897958a2453 100644 --- a/templates/single-product/related.php +++ b/templates/single-product/related.php @@ -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', diff --git a/templates/single-product/up-sells.php b/templates/single-product/up-sells.php index d91eed0ebff..2e7ed5edaa4 100644 --- a/templates/single-product/up-sells.php +++ b/templates/single-product/up-sells.php @@ -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() ) : ?>
diff --git a/woocommerce-template.php b/woocommerce-template.php index df70e9c6315..c5edbfbf4ab 100644 --- a/woocommerce-template.php +++ b/woocommerce-template.php @@ -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 + ) ); } }