تابع ووکامرسی woocommerce_upsell_display نمایش پیشنهاد محصول برای مشتری
تابع ووکامرسی woocommerce_upsell_display – نمایش پیشنهاد محصول برای مشتری
Syntax – سینتکس
woocommerce_upsell_display( (string) $limit = '-1', (int) $columns = 4, (string) $orderby = 'rand', (string) $order = 'desc' );
Parameters – پارامتر ها (4)
- 1- $limit (string)
- 2- $columns (int)
- 3- $orderby (string)
- 4- $order (string)
Usage – نحوه استفاده
if ( !function_exists( 'woocommerce_upsell_display' ) ) { require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; } // (default: -1) $limit = '-1'; // The columns. $columns = 4; // Supported values - rand, title, ID, date, modified, menu_order, price. $orderby = 'rand'; // Sort direction. $order = 'desc'; // NOTICE! Understand what this does before running. $result = woocommerce_upsell_display($limit, $columns, $orderby, $order);
Defined – محل تعریف
/includes/wc-template-functions.php
function woocommerce_upsell_display( $limit = '-1', $columns = 4, $orderby = 'rand', $order = 'desc' ) { global $product, $woocommerce_loop; if ( ! $product ) { return; } // Handle the legacy filter which controlled posts per page etc. $args = apply_filters( 'woocommerce_upsell_display_args', array( 'posts_per_page' => $limit, 'orderby' => $orderby, 'columns' => $columns, ) ); $woocommerce_loop['name'] = 'up-sells'; $woocommerce_loop['columns'] = apply_filters( 'woocommerce_upsells_columns', isset( $args['columns'] ) ? $args['columns'] : $columns ); $orderby = apply_filters( 'woocommerce_upsells_orderby', isset( $args['orderby'] ) ? $args['orderby'] : $orderby ); $limit = apply_filters( 'woocommerce_upsells_total', isset( $args['posts_per_page'] ) ? $args['posts_per_page'] : $limit ); // Get visble upsells then sort them at random, then limit result set. $upsells = wc_products_array_orderby( array_filter( array_map( 'wc_get_product', $product->get_upsell_ids() ), 'wc_products_array_filter_visible' ), $orderby, $order ); $upsells = $limit > 0 ? array_slice( $upsells, 0, $limit ) : $upsells; wc_get_template( 'single-product/up-sells.php', array( 'upsells' => $upsells, // 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
ارسال نظر