| 1 |
<div class="htcompare-table"> |
| 2 |
<?php |
| 3 |
// do_action( 'ever_compare_before_table' ); |
| 4 |
|
| 5 |
if ( ! empty( $products ) ) { |
| 6 |
array_unshift( $products, array() ); |
| 7 |
foreach ( $fields as $field_id => $field ) { |
| 8 |
if ( ! $evercompare->is_products_have_field( $field_id, $products ) ) { |
| 9 |
continue; |
| 10 |
} |
| 11 |
|
| 12 |
// Generate Filed name |
| 13 |
$name = $evercompare->field_name( $field ); |
| 14 |
if( array_key_exists( $field_id, $heading_txt ) && !empty( $heading_txt[$field_id] ) ){ |
| 15 |
$name = $evercompare->field_name( $heading_txt[$field_id], true ); |
| 16 |
} |
| 17 |
|
| 18 |
?> |
| 19 |
<div class="htcompare-row compare-data-<?php echo esc_attr( $field_id ); ?>"> |
| 20 |
<?php foreach ( $products as $product_id => $product ) : ?> |
| 21 |
<?php if ( ! empty( $product ) ) : ?> |
| 22 |
<div class="htcompare-col htcolumn-value" data-title="<?php echo esc_attr( $name ); ?>"> |
| 23 |
<?php $evercompare->compare_display_field( $field_id, $product ); ?> |
| 24 |
</div> |
| 25 |
<?php else: ?> |
| 26 |
<div class="htcompare-col htcolumn-field-name"> |
| 27 |
<?php echo esc_html( $name ); ?> |
| 28 |
</div> |
| 29 |
<?php endif; ?> |
| 30 |
<?php endforeach ?> |
| 31 |
</div> |
| 32 |
<?php |
| 33 |
} |
| 34 |
echo '<div class="htcompare-table-loader"></div>'; |
| 35 |
} else { |
| 36 |
if ( $empty_compare_text ){ |
| 37 |
echo '<div class="htcompare-empty-page-text">'.wp_kses_post( $empty_compare_text ).'</div>'; |
| 38 |
} |
| 39 |
|
| 40 |
if( $return_shop_button ){ |
| 41 |
echo '<div class="htcompare-return-to-shop"><a href="'.esc_url( wc_get_page_permalink( 'shop' ) ).'" class="button">'.esc_html( $return_shop_button ).'</a></div>'; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
do_action( 'ever_compare_after_table' ); |
| 46 |
?> |
| 47 |
</div> |