WC_Report_Stock::column_default()
Get column value.
Метод класса: WC_Report_Stock{}
Возвращает
null
. Ничего (null).
Использование
$WC_Report_Stock = new WC_Report_Stock(); $WC_Report_Stock->column_default( $item, $column_name );
- $item(разное) (обязательный)
- -
- $column_name(строка) (обязательный)
- -
Код WC_Report_Stock::column_default() WC Report Stock::column default WC 9.4.2
<?php public function column_default( $item, $column_name ) { global $product; if ( ! $product || $product->get_id() !== $item->id ) { $product = wc_get_product( $item->id ); } if ( ! $product ) { return; } switch ( $column_name ) { case 'product': if ( $sku = $product->get_sku() ) { echo esc_html( $sku ) . ' - '; } echo esc_html( $product->get_name() ); // Get variation data. if ( $product->is_type( 'variation' ) ) { echo '<div class="description">' . wp_kses_post( wc_get_formatted_variation( $product, true ) ) . '</div>'; } break; case 'parent': if ( $item->parent ) { echo esc_html( get_the_title( $item->parent ) ); } else { echo '-'; } break; case 'stock_status': if ( $product->is_on_backorder() ) { $stock_html = '<mark class="onbackorder">' . __( 'On backorder', 'woocommerce' ) . '</mark>'; } elseif ( $product->is_in_stock() ) { $stock_html = '<mark class="instock">' . __( 'In stock', 'woocommerce' ) . '</mark>'; } else { $stock_html = '<mark class="outofstock">' . __( 'Out of stock', 'woocommerce' ) . '</mark>'; } echo apply_filters( 'woocommerce_admin_stock_html', $stock_html, $product ); break; case 'stock_level': echo esc_html( $product->get_stock_quantity() ); break; case 'wc_actions': ?><p> <?php $actions = array(); $action_id = $product->is_type( 'variation' ) ? $item->parent : $item->id; $actions['edit'] = array( 'url' => admin_url( 'post.php?post=' . $action_id . '&action=edit' ), 'name' => __( 'Edit', 'woocommerce' ), 'action' => 'edit', ); if ( $product->is_visible() ) { $actions['view'] = array( 'url' => get_permalink( $action_id ), 'name' => __( 'View', 'woocommerce' ), 'action' => 'view', ); } $actions = apply_filters( 'woocommerce_admin_stock_report_product_actions', $actions, $product ); foreach ( $actions as $action ) { printf( '<a class="button tips %1$s" href="%2$s" data-tip="%3$s">%4$s</a>', esc_attr( $action['action'] ), esc_url( $action['url'] ), sprintf( esc_attr__( '%s product', 'woocommerce' ), $action['name'] ), esc_html( $action['name'] ) ); } ?> </p> <?php break; } }