You appear to be a bot. Output may be restricted
Description
Renders product field
Usage
edd_render_products_field( $post_id );
Parameters
- $post_id
- ( mixed ) required –
Returns
void
Source
File name: easy-digital-downloads/includes/admin/downloads/metabox.php
Lines:
1 to 100 of 151
function edd_render_products_field( $post_id ) { $download = new EDD_Download( $post_id ); $type = $download->get_type(); $display = $type == 'bundle' ? '' : ' style="display:none;"'; $products = $download->get_bundled_downloads(); $variable_pricing = $download->has_variable_prices(); $variable_display = $variable_pricing ? '' : 'display:none;'; $variable_class = $variable_pricing ? ' has-variable-pricing' : ''; $prices = $download->get_prices(); ?> <div id="edd_products"<?php echo $display; ?>> <div id="edd_file_fields" class="edd_meta_table_wrap"> <div class="widefat edd_repeatable_table"> <?php do_action( 'edd_download_products_table_head', $post_id ); ?> <div class="edd-bundled-product-select edd-repeatables-wrap"> <?php if ( $products ) : ?> <div class="edd-bundle-products-header"> <span class="edd-bundle-products-title"><?php printf( __( 'Bundled %s', 'easy-digital-downloads' ), edd_get_label_plural() ); ?></span> </div> <?php $index = 1; ?> <?php foreach ( $products as $key => $product ) : ?> <div class="edd_repeatable_product_wrapper edd_repeatable_row" data-key="<?php echo esc_attr( $index ); ?>"> <div class="edd-bundled-product-row<?php echo $variable_class; ?>"> <div class="edd-bundled-product-item-reorder"> <span class="edd-product-file-reorder edd-draghandle-anchor dashicons dashicons-move" title="<?php printf( __( 'Click and drag to re-order bundled %s', 'easy-digital-downloads' ), edd_get_label_plural() ); ?>"></span> <input type="hidden" name="edd_bundled_products[<?php echo $index; ?>][index]" class="edd_repeatable_index" value="<?php echo $index; ?>"/> </div> <div class="edd-bundled-product-item"> <span class="edd-repeatable-row-setting-label"><?php printf( __( 'Select %s:', 'easy-digital-downloads' ), edd_get_label_singular() ); ?></span> <?php echo EDD()->html->product_dropdown( array( 'name' => '_edd_bundled_products[]', 'id' => 'edd_bundled_products_' . $index, 'selected' => $product, 'multiple' => false, 'chosen' => true, 'bundles' => false, 'variations' => true, ) ); ?> </div> <div class="edd-bundled-product-price-assignment pricing" style="<?php echo $variable_display; ?>"> <span class="edd-repeatable-row-setting-label"><?php _e( 'Price assignment:', 'easy-digital-downloads' ); ?></span> <?php $options = array(); if ( $prices ) { foreach ( $prices as $price_key => $price ) { $options[ $price_key ] = $prices[ $price_key ]['name']; } } $price_assignments = edd_get_bundle_pricing_variations( $post_id ); if ( ! empty( $price_assignments[0] ) ) { $price_assignments = $price_assignments[0]; } $selected = isset( $price_assignments[ $index ] ) ? $price_assignments[ $index ] : null; echo EDD()->html->select( array( 'name' => '_edd_bundled_products_conditions['. $index .']', 'class' => 'edd_repeatable_condition_field', 'options' => $options, 'show_option_none' => false, 'selected' => $selected ) ); ?> </div> <span class="edd-bundled-product-actions"> <a class="edd-remove-row edd-delete" data-type="file"><?php printf( __( 'Remove', 'easy-digital-downloads' ), $index ); ?><span class="screen-reader-text"><?php printf( __( 'Remove bundle option %s', 'easy-digital-downloads' ), $index ); ?></span></a> </span> <?php do_action( 'edd_download_products_table_row', $post_id ); ?> </div> </div> <?php $index++; ?> <?php endforeach; ?> <?php else: ?> <div class="edd-bundle-products-header"> <span class="edd-bundle-products-title"><?php printf( __( 'Bundled %s:', 'easy-digital-downloads' ), edd_get_label_plural() ); ?></span> </div> <div class="edd_repeatable_product_wrapper edd_repeatable_row" data-key="1"> <div class="edd-bundled-product-row<?php echo $variable_class; ?>"> <div class="edd-bundled-product-item-reorder"> <span class="edd-product-file-reorder edd-draghandle-anchor dashicons dashicons-move" title="<?php printf( __( 'Click and drag to re-order bundled %s', 'easy-digital-downloads' ), edd_get_label_plural() ); ?>"></span> <input type="hidden" name="edd_bundled_products[1][index]" class="edd_repeatable_index" value="1"/> </div> <div class="edd-bundled-product-item"> <span class="edd-repeatable-row-setting-label"><?php printf( __( 'Select %s:', 'easy-digital-downloads' ), edd_get_label_singular() ); ?></span> <?php echo EDD()->html->product_dropdown( array( 'name' => '_edd_bundled_products[]', 'id' => 'edd_bundled_products_1',