Skip to content

Commit

Permalink
fix: Long tags and category listing issue fix on add new product, edi…
Browse files Browse the repository at this point in the history
…t page and quick edit (#895)
  • Loading branch information
alamgircsebd authored Aug 25, 2020
1 parent e0af043 commit b67c6fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion templates/products/new-product-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class="vendor-earning simple-product"

$my_tax_terms = get_terms( 'product_tag', $drop_down_tags );
?>
<select multiple="multiple" name="product_tag[]" id="product_tag_search" class="product_tags dokan-form-control dokan-select2">';
<select multiple="multiple" name="product_tag[]" id="product_tag_search" class="product_tags dokan-form-control dokan-select2">
<?php foreach ( $my_tax_terms as $tax_term ) : ?>
<?php if ( ! empty( $term ) && in_array( $tax_term->term_id, $term ) ) : ?>
<option value="<?php echo $tax_term->term_id; ?>" selected="selected" ><?php echo $tax_term->name; ?></option>
Expand Down
27 changes: 8 additions & 19 deletions templates/products/new-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,29 +246,18 @@
<?php endif; ?>

<div class="dokan-form-group">
<label for="product_tag" class="form-label"><?php esc_html_e( 'Tags', 'dokan-lite' ); ?></label>
<?php
require_once DOKAN_LIB_DIR.'/class.taxonomy-walker.php';

$drop_down_tags = array(
'hide_empty' => 0,
);

$selected_tag = dokan_posted_input( 'product_tag', true );
$selected_tag = empty( $selected_tag ) ? array() : $selected_tag;

$drop_down_tags = wp_dropdown_categories( array(
'show_option_none' => __( '', 'dokan-lite' ),
'hierarchical' => 1,
'hide_empty' => 0,
'name' => 'product_tag[]',
'id' => 'product_tag',
'taxonomy' => 'product_tag',
'title_li' => '',
'class' => 'product_tags dokan-form-control',
'exclude' => '',
'selected' => $selected_tag,
'echo' => 0,
'walker' => new TaxonomyDropdown()
) );

echo str_replace( '<select', '<select data-placeholder="'.esc_attr__( 'Select product tags', 'dokan-lite' ).'" multiple="multiple" ', $drop_down_tags ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
$my_tax_terms = get_terms( 'product_tag', $drop_down_tags );
?>
<select multiple="multiple" placeholder="<?php esc_attr_e( 'Select product tags', 'dokan-lite' ); ?>" name="product_tag[]" id="product_tag_search" class="product_tags dokan-form-control dokan-select2">
</select>
</div>

<?php do_action( 'dokan_new_product_after_product_tags' ); ?>
Expand Down

0 comments on commit b67c6fa

Please sign in to comment.