تابع ووکامرسی woocommerce_cross_sell_display نمایش دیگر محصول برای خرید
تابع ووکامرسی woocommerce_cross_sell_display – نمایش دیگر محصولات برای خرید Cross-selling
Syntax – سینتکس
woocommerce_cross_sell_display( (int) $limit = 2, (int) $columns = 2, (string) $orderby = 'rand', (string) $order = 'desc' );
Parameters – پارامتر ها (4)
- 1- $limit (int)
- 2- $columns (int)
- 3- $orderby (string)
- 4- $order (string)
Usage – نحوه استفاده
if ( !function_exists( 'woocommerce_cross_sell_display' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; } // (default: 2) $limit = 2; // The columns. $columns = 2; // (default: 'rand') $orderby = 'rand'; // (default: 'desc') $order = 'desc'; // NOTICE! Understand what this does before running. $result = woocommerce_cross_sell_display($limit, $columns, $orderby, $order);
Defined – محل تعریف
/includes/wc-template-functions.php
function woocommerce_cross_sell_display( $limit = 2, $columns = 2, $orderby = 'rand', $order = 'desc' ) { global $woocommerce_loop; if ( is_checkout() ) { return; } // Get visble cross sells then sort them at random. $cross_sells = array_filter( array_map( 'wc_get_product', WC()->cart->get_cross_sells() ), 'wc_products_array_filter_visible' ); $woocommerce_loop['name'] = 'cross-sells'; $woocommerce_loop['columns'] = apply_filters( 'woocommerce_cross_sells_columns', $columns ); // Handle orderby and limit results. $orderby = apply_filters( 'woocommerce_cross_sells_orderby', $orderby ); $cross_sells = wc_products_array_orderby( $cross_sells, $orderby, $order ); $limit = apply_filters( 'woocommerce_cross_sells_total', $limit ); $cross_sells = $limit > 0 ? array_slice( $cross_sells, 0, $limit ) : $cross_sells; wc_get_template( 'cart/cross-sells.php', array( 'cross_sells' => $cross_sells, // Not used now, but used in previous version of up-sells.php. 'posts_per_page' => $limit, 'orderby' => $orderby, 'columns' => $columns, ) ); }
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر