<?php
    $crt_builder_with_elementor_enable_product = get_theme_mod('crt_manage_enable_product_section');
    $crt_builder_with_elementor_heading = get_theme_mod('crt_manage_product_headline', __( 'Weekly bestsellers', 'crt-builder-with-elementor' ));
    $crt_builder_with_elementor_product_list = get_theme_mod('crt_manage_product_list');
    $crt_builder_with_elementor_button_text = get_theme_mod('crt_manage_product_button_text', __( 'View All', 'crt-builder-with-elementor' ));
    $crt_builder_with_elementor_button_url = get_theme_mod('crt_manage_product_button_url', '#');

    $crt_builder_with_elementor_layout = get_theme_mod('crt_manage_product_layout', 'product-1');
    $crt_builder_with_elementor_post_on_row = get_theme_mod('crt_manage_product_on_row', 4);

    if(!$crt_builder_with_elementor_enable_product) {
        return;
    }
    wp_enqueue_style( 'crt-builder-with-elementor-' . $crt_builder_with_elementor_layout );
?>

<section id="product" class="product-1 padding-y-1">
    <div class="container position-relative">
        <?php crt_manage_section_link( 'Product' ); ?>
        <div class="col-12">
            <div class="heading-default d-flex justify-content-between align-items-center">
                <h2 class="heading-char-animation"><?php echo esc_html($crt_builder_with_elementor_heading); ?></h2>
                <span class="ms-auto"><a href="<?php echo esc_url($crt_builder_with_elementor_button_url); ?>"><?php echo esc_html($crt_builder_with_elementor_button_text); ?></a></span>
            </div>
            <?php get_template_part( 'woocommerce/' . $crt_builder_with_elementor_layout, '', array('list' => $crt_builder_with_elementor_product_list, 'post_on_row' => $crt_builder_with_elementor_post_on_row) ); ?>
        </div>
    </div>
</section>