selected_products.php
60 lines
| 1 | <div class="berocket_compare_widget_start<?php if ( ! empty($toolbar) ) echo ' berocket_compare_widget_toolbar_block'; ?>"> |
| 2 | <?php |
| 3 | $BeRocket_Compare_Products = BeRocket_Compare_Products::getInstance(); |
| 4 | $options_global = $BeRocket_Compare_Products->get_option(); |
| 5 | $products = $BeRocket_Compare_Products->get_all_compare_products(); |
| 6 | $options = $options_global['general_settings']; |
| 7 | $text = $options_global['text_settings']; |
| 8 | if ( ! empty($toolbar) ) { |
| 9 | echo '<a class="berocket_show_compare_toolbar" href="#toolbar"'; |
| 10 | if ( ! isset( $products ) || ! is_array( $products ) || count( $products ) == 0 ) { |
| 11 | echo ' style="display:none;"'; |
| 12 | } |
| 13 | echo '>'.(empty($text['toolbar']) ? __( 'Products For Compare', 'products-compare-for-woocommerce' ) : $text['toolbar']).'<i class="fa fa-angle-up"></i></a> |
| 14 | <div class="berocket_compare_widget_toolbar"> |
| 15 | <a class="berocket_hide_compare_toolbar" href="#close-toolbar"><i class="fa fa-angle-down"></i></a>'; |
| 16 | } |
| 17 | ?> |
| 18 | <?php if ( ! empty($title) ) { |
| 19 | echo '<h3>'.$title.'</h3>'; |
| 20 | } ?> |
| 21 | <div class="berocket_compare_widget berocket_compare_widget_<?php echo $type; ?>" data-type="<?php echo $type; ?>" data-fast_compare="<?php echo (empty($fast_compare) ? '' : $fast_compare); ?>"> |
| 22 | <ul> |
| 23 | <?php |
| 24 | if ( isset( $products ) && is_array( $products ) && count( $products ) > 0 ) { |
| 25 | foreach ( $products as $product ) { |
| 26 | $term = array(); |
| 27 | $current_language= apply_filters( 'wpml_current_language', NULL ); |
| 28 | $default_language= apply_filters( 'wpml_default_language', NULL ); |
| 29 | $product = apply_filters( 'wpml_object_id', $product, 'product', true, $current_language ); |
| 30 | $default_product = apply_filters( 'wpml_object_id', $product, 'product', true, $default_language ); |
| 31 | $post_get = wc_get_product($product); |
| 32 | if( empty($post_get) ) continue; |
| 33 | $title = $post_get->get_title(); |
| 34 | $image = $post_get->get_image(); |
| 35 | $link = $post_get->get_permalink(); |
| 36 | echo '<li class="br_widget_compare_product_'.$default_product.'">'; |
| 37 | echo '<a href="#remove" class="br_remove_compare_product" data-id="'.$default_product.'"><i class="fa fa-times"></i></a>'; |
| 38 | echo '<a href="'.$link.'">'; |
| 39 | if ( $type != 'text' ) { |
| 40 | echo $image; |
| 41 | } |
| 42 | echo '<span>'.$title.'</span>'; |
| 43 | echo '</a></li>'; |
| 44 | } |
| 45 | } |
| 46 | ?> |
| 47 | </ul> |
| 48 | <?php |
| 49 | $page_compare = $options['compare_page']; |
| 50 | if ( isset( $products ) && is_array( $products ) && count( $products ) > 0 ) { ?> |
| 51 | <a class="berocket_open_compare<?php if( ! empty($fast_compare) ) echo ' berocket_open_smart_compare'; ?>" href="<?php echo get_page_link($page_compare); ?>"><?php echo (empty($text['compare']) ? __( 'Compare', 'products-compare-for-woocommerce' ) : $text['compare']); ?></a> |
| 52 | <?php } ?> |
| 53 | </div> |
| 54 | </div> |
| 55 | <?php |
| 56 | if ( ! empty($toolbar) ) { |
| 57 | echo '</div>'; |
| 58 | } |
| 59 | ?> |
| 60 |