<div class="theme-offer">
	<?php 
    // Check if the demo import has been completed
    $reseller_store_demo_import_completed = get_option('reseller_store_demo_import_completed', false);

    // If the demo import is completed, display the "View Site" button
    if ($reseller_store_demo_import_completed) {
      echo '<p class="notice-text">' . esc_html__('Your demo import has been completed successfully.', 'reseller-store') . '</p>';
      echo '<span><a href="' . esc_url(home_url()) . '" class="button button-primary site-btn" target="_blank">' . esc_html__('VIEW SITE', 'reseller-store') . '</a></span>';
      echo '<span><a href="'. esc_url(admin_url('customize.php') ) .'" class="button button-primary demo-btn" target=_blank>'. esc_html__( 'Customize Your Site', 'reseller-store' ) .'</a></span>';
      echo '<span><a href="'. esc_url( 'https://preview.vwthemesdemo.com/docs/free-reseller-store/' ) .'" class="button button-primary doc-btn" target=_blank>'. esc_html__( 'Free Theme Documentation', 'reseller-store' ) .'</a></span>';
    }

		// POST and update the customizer and other related data 
      if (isset($_POST['submit'])) {

        // Check if woocommerce is installed and activated
        if (!is_plugin_active('woocommerce/woocommerce.php')) {
          // Install the plugin if it doesn't exist
          $reseller_store_plugin_slug = 'woocommerce';
          $reseller_store_plugin_file = 'woocommerce/woocommerce.php';

          // Check if plugin is installed
          $reseller_store_installed_plugins = get_plugins();
          if (!isset($reseller_store_installed_plugins[$reseller_store_plugin_file])) {
              include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
              include_once(ABSPATH . 'wp-admin/includes/file.php');
              include_once(ABSPATH . 'wp-admin/includes/misc.php');
              include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');

              // Install the plugin
              $reseller_store_upgrader = new Plugin_Upgrader();
              $reseller_store_upgrader->install('https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip');
          }
          // Activate the plugin
          activate_plugin($reseller_store_plugin_file);
        }

        // Check if  Currency Switcher for WooCommerce is installed and activated
            if (!is_plugin_active('currency-switcher-woocommerce/currency-switcher-woocommerce.php')) {
              // Install the plugin if it doesn't exist
              $reseller_store_plugin_slug = 'currency-switcher-woocommerce';
              $reseller_store_plugin_file = 'currency-switcher-woocommerce/currency-switcher-woocommerce.php';

              // Check if plugin is installed
              $reseller_store_installed_plugins = get_plugins();
              if (!isset($reseller_store_installed_plugins[$reseller_store_plugin_file])) {
                  include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
                  include_once(ABSPATH . 'wp-admin/includes/file.php');
                  include_once(ABSPATH . 'wp-admin/includes/misc.php');
                  include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');

                  // Install the plugin
                  $reseller_store_upgrader = new Plugin_Upgrader();
                  $reseller_store_upgrader->install('https://downloads.wordpress.org/plugin/currency-switcher-woocommerce.latest-stable.zip');
              }
              // Activate the plugin
              activate_plugin($reseller_store_plugin_file);
            }

        // Check if  GTranslate is installed and activated
        if (!is_plugin_active('gtranslate/gtranslate.php')) {
          // Install the plugin if it doesn't exist
          $reseller_store_plugin_slug = 'gtranslate';
          $reseller_store_plugin_file = 'gtranslate/gtranslate.php';

          // Check if plugin is installed
          $reseller_store_installed_plugins = get_plugins();
          if (!isset($reseller_store_installed_plugins[$reseller_store_plugin_file])) {
              include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
              include_once(ABSPATH . 'wp-admin/includes/file.php');
              include_once(ABSPATH . 'wp-admin/includes/misc.php');
              include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');

              // Install the plugin
              $reseller_store_upgrader = new Plugin_Upgrader();
              $reseller_store_upgrader->install('https://downloads.wordpress.org/plugin/gtranslate.latest-stable.zip');
          }
          // Activate the plugin
          activate_plugin($reseller_store_plugin_file);
        }

        // Check if ibtana visual editor is installed and activated
        if (!is_plugin_active('ibtana-visual-editor/plugin.php')) {
          // Install the plugin if it doesn't exist
          $reseller_store_plugin_slug = 'ibtana-visual-editor';
          $reseller_store_plugin_file = 'ibtana-visual-editor/plugin.php';

          // Check if plugin is installed
          $reseller_store_installed_plugins = get_plugins();
          if (!isset($reseller_store_installed_plugins[$reseller_store_plugin_file])) {
              include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
              include_once(ABSPATH . 'wp-admin/includes/file.php');
              include_once(ABSPATH . 'wp-admin/includes/misc.php');
              include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');

              // Install the plugin
              $reseller_store_upgrader = new Plugin_Upgrader();
              $reseller_store_upgrader->install('https://downloads.wordpress.org/plugin/ibtana-visual-editor.latest-stable.zip');
          }
          // Activate the plugin
          activate_plugin($reseller_store_plugin_file);
        }

        // ------- Create Nav Menu --------
            $reseller_store_menuname = 'Main Menus';
            $reseller_store_bpmenulocation = 'primary';
            $reseller_store_menu_exists = wp_get_nav_menu_object($reseller_store_menuname);

            if (!$reseller_store_menu_exists) {
                $reseller_store_menu_id = wp_create_nav_menu($reseller_store_menuname);

                // Create Home Page
                $reseller_store_home_title = 'Home';
                $reseller_store_home = array(
                    'post_type' => 'page',
                    'post_title' => $reseller_store_home_title,
                    'post_content' => '',
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'home'
                );
                $reseller_store_home_id = wp_insert_post($reseller_store_home);
                // Assign Home Page Template
                add_post_meta($reseller_store_home_id, '_wp_page_template', 'page-template/custom-home-page.php');
                // Update options to set Home Page as the front page
                update_option('page_on_front', $reseller_store_home_id);
                update_option('show_on_front', 'page');
                // Add Home Page to Menu
                wp_update_nav_menu_item($reseller_store_menu_id, 0, array(
                    'menu-item-title' => __('Home', 'reseller-store'),
                    'menu-item-classes' => 'home',
                    'menu-item-url' => home_url('/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $reseller_store_home_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create Pages Page with Dummy Content
                $reseller_store_pages_title = 'Pages';
                $reseller_store_pages_content = '
                Explore all the pages we have on our website. Find information about our services, company, and more.
                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br>
                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $reseller_store_pages = array(
                    'post_type' => 'page',
                    'post_title' => $reseller_store_pages_title,
                    'post_content' => $reseller_store_pages_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'pages'
                );
                $reseller_store_pages_id = wp_insert_post($reseller_store_pages);
                // Add Pages Page to Menu
                wp_update_nav_menu_item($reseller_store_menu_id, 0, array(
                    'menu-item-title' => __('Pages', 'reseller-store'),
                    'menu-item-classes' => 'pages',
                    'menu-item-url' => home_url('/pages/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $reseller_store_pages_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create About Us Page with Dummy Content
                $reseller_store_about_title = 'About Us';
                $reseller_store_about_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam...<br>
                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br>
                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text.<br>
                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $reseller_store_about = array(
                    'post_type' => 'page',
                    'post_title' => $reseller_store_about_title,
                    'post_content' => $reseller_store_about_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'about-us'
                );
                $reseller_store_about_id = wp_insert_post($reseller_store_about);
                // Add About Us Page to Menu
                wp_update_nav_menu_item($reseller_store_menu_id, 0, array(
                    'menu-item-title' => __('About Us', 'reseller-store'),
                    'menu-item-classes' => 'about-us',
                    'menu-item-url' => home_url('/about-us/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $reseller_store_about_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create Product Page with Dummy Content
                $reseller_store_about_title = 'Product';
                $reseller_store_about_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam...<br>
                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br>
                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text.<br>
                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $reseller_store_about = array(
                    'post_type' => 'page',
                    'post_title' => $reseller_store_about_title,
                    'post_content' => $reseller_store_about_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'product'
                );
                $reseller_store_about_id = wp_insert_post($reseller_store_about);
                // Add Product Page to Menu
                wp_update_nav_menu_item($reseller_store_menu_id, 0, array(
                    'menu-item-title' => __('Product', 'reseller-store'),
                    'menu-item-classes' => 'product',
                    'menu-item-url' => home_url('/product/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $reseller_store_about_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create Blog Page 
                $reseller_store_blog_page_title = 'Blog';
                $reseller_store_blog_page_query = new WP_Query(array(
                    'post_type'      => 'page',
                    'name'           => sanitize_title($reseller_store_blog_page_title),
                    'post_status'    => 'publish',
                    'posts_per_page' => 1
                ));
                if (!$reseller_store_blog_page_query->have_posts()) {
                    $reseller_store_blog_page = array(
                    'post_type'   => 'page',
                    'post_title'  => $reseller_store_blog_page_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    );
                    $reseller_store_blog_page_id = wp_insert_post($reseller_store_blog_page);
                    update_option('page_for_posts', $reseller_store_blog_page_id);
                    wp_update_nav_menu_item($reseller_store_menu_id, 0, array(
                    'menu-item-title'      => __('Blog', 'reseller-store'),
                    'menu-item-url'        => get_permalink($reseller_store_blog_page_id),
                    'menu-item-status'     => 'publish',
                    'menu-item-object-id'  => $reseller_store_blog_page_id,
                    'menu-item-object'     => 'page',
                    'menu-item-type'       => 'post_type',
                    ));
                }

                // Set the menu location if it's not already set
                if (!has_nav_menu($reseller_store_bpmenulocation)) {
                    $locations = get_theme_mod('nav_menu_locations'); // Use 'nav_menu_locations' to get locations array
                    if (empty($locations)) {
                        $locations = array();
                    }
                    $locations[$reseller_store_bpmenulocation] = $reseller_store_menu_id;
                    set_theme_mod('nav_menu_locations', $locations);
                }

        }

        // Set the demo import completion flag
        update_option('reseller_store_demo_import_completed', true);

        // Display success message and "View Site" button
        echo '<p class="notice-text">' . esc_html__('Your demo import has been completed successfully.', 'reseller-store') . '</p>';
        echo '<span><a href="' . esc_url(home_url()) . '" class="button button-primary site-btn" target="_blank">' . esc_html__('VIEW SITE', 'reseller-store') . '</a></span>';
        echo '<span><a href="'. esc_url(admin_url('customize.php') ) .'" class="button button-primary demo-btn" target=_blank>'. esc_html__( 'Customize Your Site', 'reseller-store' ) .'</a></span>';
        echo '<span><a href="'. esc_url( 'https://preview.vwthemesdemo.com/docs/free-reseller-store/' ) .'" class="button button-primary doc-btn" target=_blank>'. esc_html__( 'Free Theme Documentation', 'reseller-store' ) .'</a></span>';
        //end     

        // Top Bar start //
        set_theme_mod( 'reseller_store_phone_icon', 'fa-solid fa-phone' ); 
        set_theme_mod( 'reseller_store_phone_number', '+00 123 456 7890' );
        set_theme_mod( 'reseller_store_mail_icon', 'fa-solid fa-envelope' );
        set_theme_mod( 'reseller_store_email_address', 'xyz123@example.com' );
        set_theme_mod( 'reseller_store_topbar_track_text', 'Track Order' );
        set_theme_mod( 'reseller_store_search_open_icon', 'fas fa-search' );
        set_theme_mod( 'reseller_store_search_close_icon', 'fa-solid fa-xmark' );
        set_theme_mod( 'reseller_store_heart_icon', 'fa-solid fa-heart' );

        // slider section start //         
        set_theme_mod( 'reseller_store_slide_number', '3' );
        for($reseller_store_i=1; $reseller_store_i<=3; $reseller_store_i++) {
            set_theme_mod( 'reseller_store_banner_background_image_sec'.$reseller_store_i, get_template_directory_uri().'/assets/images/banner'.$reseller_store_i.'.png' );
            
            set_theme_mod( 'reseller_store_tagline_title'.$reseller_store_i, 'Well-Maintained! MyPhone 14Pro Great Phone at a Great Price' );
            set_theme_mod( 'reseller_store_slider_button_label1'.$reseller_store_i, 'Start Exploring' );  
            set_theme_mod( 'reseller_store_slider_button_url1'.$reseller_store_i, '#' );               
        }

        // product section start //  
        set_theme_mod( 'reseller_store_product_heading_product', 'Recent Product' );   
        set_theme_mod( 'reseller_store_product_title', 'Explore on the worlds best & largest Bidding marketplace' );
        set_theme_mod( 'reseller_store_product_text', 'Selling On:' );
            
        set_theme_mod('reseller_store_product_settings', 'Bikes');
        // Define category names
        $reseller_store_category_array = array(
           "Bikes",
           "Watches" 
        );

        // Define product titles (one for each category)
        $reseller_store_product_titles = array(
            "Yamara R17","iwatches 2nd Generation"
        );

        // Define category images (one for each category)
        $reseller_store_category_images = array(
            get_template_directory_uri() . '/assets/images/category1.png',
            get_template_directory_uri() . '/assets/images/category2.png'
        );

        // Define product content (same for all products in this example)
        $reseller_store_product_content = 'Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.';

        // Loop to create categories and one product per category
        foreach ($reseller_store_category_array as $index => $category_name) {
            // Create or retrieve the category term
            $reseller_store_category = term_exists($category_name, 'product_cat');
            if ($reseller_store_category === 0 || $reseller_store_category === null) {
                $reseller_store_category = wp_insert_term($category_name, 'product_cat');
            }

            if (is_wp_error($reseller_store_category)) {
                error_log('Error creating category: ' . $reseller_store_category->get_error_message());
                continue; // Skip to the next category if creation fails
            }

            // Get the term ID of the category
            $category_id = (int) $reseller_store_category['term_id'];

            // Add the category image (if applicable)
            if (!empty($reseller_store_category_images[$index])) {
                $image_url = $reseller_store_category_images[$index];
                $image_id = media_sideload_image($image_url, 0, null, 'id');

                if (!is_wp_error($image_id)) {
                    // Assign the image as category thumbnail
                    update_term_meta($category_id, 'thumbnail_id', $image_id);
                } else {
                    error_log('Error downloading category image: ' . $image_id->get_error_message());
                }
            }

            // Create the product associated with this category
            $product_title = $reseller_store_product_titles[$index];
            $reseller_store_my_post = array(
                'post_title'    => wp_strip_all_tags($product_title),
                'post_content'  => $reseller_store_product_content,
                'post_status'   => 'publish',
                'post_type'     => 'product',
            );

            // Insert the product into the database
            $reseller_store_post_id = wp_insert_post($reseller_store_my_post);

            if (is_wp_error($reseller_store_post_id)) {
                error_log('Error creating product: ' . $reseller_store_post_id->get_error_message());
                continue; // Skip to the next product if creation fails
            }

            // Set product as simple product and assign a price
            update_post_meta($reseller_store_post_id, '_price', '10,00,000'); // Set price
            update_post_meta($reseller_store_post_id, '_regular_price', '99.00'); // Set regular price
           

            // Assuming $reseller_store_post_id is already defined
            $sale_start_date = '2025-01-09'; // Example start date
            $sale_end_date = '2025-01-26'; // Example end date

            // Convert the dates to Unix timestamps
            $sale_start_timestamp = strtotime($sale_start_date);
            $sale_end_timestamp = strtotime($sale_end_date);

            // Update the sale price dates using Unix timestamps
            update_post_meta($reseller_store_post_id, '_sale_price_dates_from', $sale_start_timestamp);
            update_post_meta($reseller_store_post_id, '_sale_price_dates_to', $sale_end_timestamp);

    
            // Assign the product to the category
            wp_set_object_terms($reseller_store_post_id, $category_id, 'product_cat');

            // Add a featured image to the product
            $product_image_url = get_template_directory_uri() . '/assets/images/product-img' . ($index + 1) . '.png';
            $product_image_id = media_sideload_image($product_image_url, $reseller_store_post_id, null, 'id');

            if (!is_wp_error($product_image_id)) {
                set_post_thumbnail($reseller_store_post_id, $product_image_id);
            } else {
                error_log('Error downloading product image: ' . $product_image_id->get_error_message());
            }
        }  

        // product Category Section start //  
            
        // Define category names
        $reseller_store_productcategory_array = array(
            "Technology",
            "Pc's",
            "Cameras",
            "Luxury Cars",           
            "Phones and Tablets"        
        );


        // Define product titles (one for each category)
        $reseller_store_productcategory_titles = array(
            "Yamara R17",
            "Apple 13 Pro",
            "iWatch 2nd Generation",
            "Dell UltraSharp 27",
            "Samsung Galaxy S20"
        );



        // Define category images (one for each category)
        $reseller_store_productcategory_images = array(
            get_template_directory_uri() . '/assets/images/cat1.png',
            get_template_directory_uri() . '/assets/images/cat2.png',
            get_template_directory_uri() . '/assets/images/cat3.png',
            get_template_directory_uri() . '/assets/images/cat4.png',
            get_template_directory_uri() . '/assets/images/cat5.png'
        );

        // Define product content (same for all products in this example)
        $reseller_store_product_content = 'Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.';

        // Loop to create categories and one product per category
        for ($reseller_store_i = 0; $reseller_store_i < count($reseller_store_productcategory_array); $reseller_store_i++) {

            if (isset($reseller_store_productcategory_array[$reseller_store_i])) {
                $category_name = $reseller_store_productcategory_array[$reseller_store_i];
            } else {
                error_log("Undefined array key: $reseller_store_i");
                continue; // Skip to the next iteration
            }

            // Create or retrieve the category term
            $reseller_store_category = term_exists($category_name, 'product_cat');
            if ($reseller_store_category === 0 || $reseller_store_category === null) {
                $reseller_store_category = wp_insert_term($category_name, 'product_cat');
            }

            if (is_wp_error($reseller_store_category)) {
                error_log('Error creating category: ' . $reseller_store_category->get_error_message());
                continue; // Skip to the next category if creation fails
            }

            // Get the term ID of the category
            $category_id = (int)$reseller_store_category['term_id'];

            // Select product category by default (5 categories)
            $reseller_store_theme_mod_key = 'reseller_store_product_category_' . ( $reseller_store_i + 1 );

            if ( ! get_theme_mod( $reseller_store_theme_mod_key ) ) {
                set_theme_mod( $reseller_store_theme_mod_key, $category_id );
            }

            // Add the category image (if applicable)
            if (!empty($reseller_store_productcategory_images[$reseller_store_i])) {
                $image_url = $reseller_store_productcategory_images[$reseller_store_i];
                $image_id = media_sideload_image($image_url, 0, null, 'id');

                if (!is_wp_error($image_id)) {
                    // Assign the image as category thumbnail
                    update_term_meta($category_id, 'thumbnail_id', $image_id);
                } else {
                    error_log('Error downloading category image: ' . $image_id->get_error_message());
                }
            }

            // Create the product associated with this category
            $product_title = $reseller_store_productcategory_titles[$reseller_store_i];
            $reseller_store_my_post = array(
                'post_title'    => wp_strip_all_tags($product_title),
                'post_content'  => $reseller_store_product_content,
                'post_status'   => 'publish',
                'post_type'     => 'product',
            );

            // Insert the product into the database
            $reseller_store_post_id = wp_insert_post($reseller_store_my_post);

            if (is_wp_error($reseller_store_post_id)) {
                error_log('Error creating product: ' . $reseller_store_post_id->get_error_message());
                continue; // Skip to the next product if creation fails
            }

            // Assign the product to the category
            wp_set_object_terms($reseller_store_post_id, $category_id, 'product_cat');

            // Add a featured image to the product
            if (!empty($reseller_store_productcategory_images[$reseller_store_i])) {
                $product_image_url = get_template_directory_uri() . '/assets/images/pro-img' . ($reseller_store_i + 1) . '.png';
                $product_image_id = media_sideload_image($product_image_url, $reseller_store_post_id, null, 'id');

                if (!is_wp_error($product_image_id)) {
                    set_post_thumbnail($reseller_store_post_id, $product_image_id);
                } else {
                    error_log('Error downloading product image: ' . $product_image_id->get_error_message());
                }
            }
                // Set a default view more text for the categories
                set_theme_mod('reseller_store_category_view_more_text', 'View More');
        }
               //Copyright Text
                set_theme_mod( 'reseller_store_footer_text', 'By VWThemes' ); 
                echo "<script>window.location.href='" . admin_url('themes.php?page=reseller_store_guide') . "';</script>";
    }
  ?>
  
    <form action="<?php echo esc_url(home_url()); ?>/wp-admin/themes.php?page=reseller_store_guide" method="POST" onsubmit="return validate(this);">
        <?php if (!get_option('reseller_store_demo_import_completed')) : ?>
         <form method="post">
                <p class="run-import-text"><?php esc_html_e('Click On The Below Run Importer Button To Import Demo Content Of Reseller Store', 'reseller-store'); ?></p>
                <p><?php esc_html_e('Please back up your website if it’s already live with data. This importer will overwrite your existing settings with the new customizer values for Reseller Store', 'reseller-store'); ?></p>
                <input class="run-import" type="submit" name="submit" value="<?php esc_attr_e('Run Importer', 'reseller-store'); ?>" class="button button-primary button-large">
        </form> 
        <?php endif; ?>
        <div id="spinner" style="display:none;">         
            <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/spinner.png" alt="" />
        </div>
    </form>
    <script type="text/javascript">
        function validate(form) {
            if (confirm("Do you really want to import the theme demo content?")) {
                document.getElementById('spinner').style.display = 'block';
                return true;
            } 
            else {
                return false;
            }
        }
    </script>
</div>

