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 - Prefix jquery plugins JS.
|
||||||
* Tweak - Made paypal use wc-api for IPN.
|
* Tweak - Made paypal use wc-api for IPN.
|
||||||
* Tweak - Due to new session handling, removed session section from the status page.
|
* 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 - Added more error messages for coupons.
|
||||||
* Fix - Variation sku updating after selection.
|
* Fix - Variation sku updating after selection.
|
||||||
|
|
|
@ -16,14 +16,16 @@ if ( sizeof( $upsells ) == 0 ) return;
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type' => 'product',
|
'post_type' => 'product',
|
||||||
'ignore_sticky_posts' => 1,
|
'ignore_sticky_posts' => 1,
|
||||||
'posts_per_page' => 4,
|
|
||||||
'no_found_rows' => 1,
|
'no_found_rows' => 1,
|
||||||
'orderby' => 'rand',
|
'posts_per_page' => $posts_per_page,
|
||||||
|
'orderby' => $orderby,
|
||||||
'post__in' => $upsells
|
'post__in' => $upsells
|
||||||
);
|
);
|
||||||
|
|
||||||
$products = new WP_Query( $args );
|
$products = new WP_Query( $args );
|
||||||
|
|
||||||
|
$woocommerce_loop['columns'] = $columns;
|
||||||
|
|
||||||
if ( $products->have_posts() ) : ?>
|
if ( $products->have_posts() ) : ?>
|
||||||
|
|
||||||
<div class="upsells products">
|
<div class="upsells products">
|
||||||
|
|
|
@ -731,10 +731,12 @@ if ( ! function_exists( 'woocommerce_related_products' ) ) {
|
||||||
* Output the related products.
|
* Output the related products.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @subpackage Product
|
* @param int $posts_per_page (default: 2)
|
||||||
|
* @param int $columns (default: 2)
|
||||||
|
* @param string $orderby (default: 'rand')
|
||||||
* @return void
|
* @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(
|
woocommerce_get_template( 'single-product/related.php', array(
|
||||||
'posts_per_page' => $posts_per_page,
|
'posts_per_page' => $posts_per_page,
|
||||||
'orderby' => $orderby,
|
'orderby' => $orderby,
|
||||||
|
@ -749,11 +751,17 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
||||||
* Output product up sells.
|
* Output product up sells.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @subpackage Product
|
* @param int $posts_per_page (default: -1)
|
||||||
|
* @param int $columns (default: 2)
|
||||||
|
* @param string $orderby (default: 'rand')
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_upsell_display() {
|
function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) {
|
||||||
woocommerce_get_template( 'single-product/up-sells.php' );
|
woocommerce_get_template( 'single-product/up-sells.php', array(
|
||||||
|
'posts_per_page' => $posts_per_page,
|
||||||
|
'orderby' => $orderby,
|
||||||
|
'columns' => $columns
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue