<?php
/**
 * perfect-ecommerce-store: Customizer
 *
 * @subpackage perfect-ecommerce-store
 * @since 1.0
 */

function perfect_ecommerce_store_customize_register( $wp_customize ) {

	$wp_customize->add_setting('perfect_ecommerce_store_logo_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_logo_size',array(
		'type' => 'range',
		'description' => __('Logo Size (0-100%)','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_logo_padding',array(
		'sanitize_callback'	=> 'esc_html'
	));
	$wp_customize->add_control('perfect_ecommerce_store_logo_padding',array(
		'label' => __('Logo Padding','perfect-ecommerce-store'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_logo_top_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_logo_top_padding',array(
		'type' => 'number',
		'description' => __('Top','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_logo_bottom_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_logo_bottom_padding',array(
		'type' => 'number',
		'description' => __('Bottom','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_logo_left_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_logo_left_padding',array(
		'type' => 'number',
		'description' => __('Left','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_logo_right_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_logo_right_padding',array(
		'type' => 'number',
		'description' => __('Right','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_show_site_title',array(
		'default' => true,
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_checkbox'
	));
	$wp_customize->add_control('perfect_ecommerce_store_show_site_title',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Title','perfect-ecommerce-store'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_site_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_site_title_font_size',array(
		'type' => 'number',
		'label' => __('Site Title Font Size','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_show_tagline',array(
		'default' => true,
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_checkbox'
	));
	$wp_customize->add_control('perfect_ecommerce_store_show_tagline',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Tagline','perfect-ecommerce-store'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_site_tagline_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_site_tagline_font_size',array(
		'type' => 'number',
		'label' => __('Site Tagline Font Size','perfect-ecommerce-store'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_panel( 'perfect_ecommerce_store_panel_id', array(
		'priority' => 10,
		'capability' => 'edit_theme_options',
		'theme_supports' => '',
		'title' => __( 'Theme Settings', 'perfect-ecommerce-store' ),
		'description' => __( 'Description of what this panel does.', 'perfect-ecommerce-store' ),
	) );

	$wp_customize->add_section( 'perfect_ecommerce_store_theme_options_section', array(
    	'title'      => __( 'General Settings', 'perfect-ecommerce-store' ),
		'priority'   => 30,
		'panel' => 'perfect_ecommerce_store_panel_id'
	) );

	// Add Settings and Controls for Layout
	$wp_customize->add_setting('perfect_ecommerce_store_theme_options',array(
      'default' => 'Right Sidebar',
      'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'	        
	));
	$wp_customize->add_control('perfect_ecommerce_store_theme_options', array(
		'type' => 'select',
		'label' => __('Blog Page Sidebar Layout','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','perfect-ecommerce-store'),
		   'Right Sidebar' => __('Right Sidebar','perfect-ecommerce-store'),
		   'One Column' => __('One Column','perfect-ecommerce-store'),
		   'Three Columns' => __('Three Columns','perfect-ecommerce-store'),
		   'Four Columns' => __('Four Columns','perfect-ecommerce-store'),
		   'Grid Layout' => __('Grid Layout','perfect-ecommerce-store')
		),
	));

	$wp_customize->add_setting('perfect_ecommerce_store_archive_page_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'
	));
	$wp_customize->add_control('perfect_ecommerce_store_archive_page_sidebar',array(
		'type' => 'select',
		'label' => __('Archive & Search Page Sidebar Layout','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_theme_options_section',
		'choices' => array(
			'Left Sidebar' => __('Left Sidebar','perfect-ecommerce-store'),
			'Right Sidebar' => __('Right Sidebar','perfect-ecommerce-store'),
			'One Column' => __('One Column','perfect-ecommerce-store'),
		    'Three Columns' => __('Three Columns','perfect-ecommerce-store'),
		    'Four Columns' => __('Four Columns','perfect-ecommerce-store'),
			'Grid Layout' => __('Grid Layout','perfect-ecommerce-store')
		),
	));

	$wp_customize->add_setting('perfect_ecommerce_store_single_post_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'
	));
	$wp_customize->add_control('perfect_ecommerce_store_single_post_sidebar',array(
		'type' => 'select',
		'label' => __('Single Post Sidebar Layout','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','perfect-ecommerce-store'),
		   'Right Sidebar' => __('Right Sidebar','perfect-ecommerce-store'),
		   'One Column' => __('One Column','perfect-ecommerce-store')
		),
	));

	$wp_customize->add_setting('perfect_ecommerce_store_page_sidebar',array(
		'default' => 'One Column',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'
	));
	$wp_customize->add_control('perfect_ecommerce_store_page_sidebar',array(
		'type' => 'select',
		'label' => __('Page Sidebar Layout','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','perfect-ecommerce-store'),
		   'Right Sidebar' => __('Right Sidebar','perfect-ecommerce-store'),
		   'One Column' => __('One Column','perfect-ecommerce-store')
		),
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_dropdown_anim', array(
		'default'           => 'None',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_dropdown_anim', array(
		'label'    => __( 'Menu Dropdown Animations', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInUp'  => __('bounceInUp', 'perfect-ecommerce-store'),
			'fadeInUp' => __('fadeInUp', 'perfect-ecommerce-store'),
			'zoomIn'    => __('zoomIn', 'perfect-ecommerce-store'),
			'None'    => __('None', 'perfect-ecommerce-store')
		),
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_boxfull_width', array(
		'default'           => '',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_boxfull_width', array(
		'label'    => __( 'Section Width', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'container'  => __('Box Width', 'perfect-ecommerce-store'),
			'container-fluid' => __('Full Width', 'perfect-ecommerce-store')
		),
	));

	$wp_customize->add_section( 'perfect_ecommerce_store_header' , array(
    	'title'      => __( 'Header Settings', 'perfect-ecommerce-store' ),
		'priority'   => null,
		'panel' => 'perfect_ecommerce_store_panel_id'
	) );

	$wp_customize->add_setting( 'perfect_ecommerce_store_sale_text', array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_sale_text', array(
		'label' => __('Add Sale Text', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_header',
		'type'     => 'text'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_sale_image',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw',
	));
	$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'perfect_ecommerce_store_sale_image',array(
		'label' => __('Sale Image','perfect-ecommerce-store'),
		'description'=> __('Image size (445px x 75px)','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_header',
		'settings' => 'perfect_ecommerce_store_sale_image'
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_sale_url', array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_sale_url', array(
		'label' => __('Add Sale Image url', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_header',
		'type'     => 'url'
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_sale_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_sale_color', array(
		'label' => 'Background Color',
		'section' => 'perfect_ecommerce_store_header',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_menu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_menu_color', array(
		'label' => 'Menus Color',
		'section' => 'perfect_ecommerce_store_header',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_searchtext_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_searchtext_color', array(
		'label' => 'Search Field Text Color',
		'section' => 'perfect_ecommerce_store_header',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_searchbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_searchbg_color', array(
		'label' => 'Search Field Bg Color',
		'section' => 'perfect_ecommerce_store_header',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_searchiconbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_searchiconbg_color', array(
		'label' => 'Search Icon Bg Color',
		'section' => 'perfect_ecommerce_store_header',
	)));

	//home page slider
	$wp_customize->add_section( 'perfect_ecommerce_store_slider_section' , array(
    	'title'      => __( 'Slider Settings', 'perfect-ecommerce-store' ),
		'priority'   => null,
		'panel' => 'perfect_ecommerce_store_panel_id'
	) );

	$wp_customize->add_setting('perfect_ecommerce_store_slider_hide_show',array(
		'default' => false,
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_checkbox'
	));
	$wp_customize->add_control('perfect_ecommerce_store_slider_hide_show',array(
	   'type' => 'checkbox',
	   'label' => __('Show / Hide slider','perfect-ecommerce-store'),
	   'section' => 'perfect_ecommerce_store_slider_section',
	));

	for ( $count = 1; $count <= 4; $count++ ) {
		$wp_customize->add_setting( 'perfect_ecommerce_store_slider' . $count, array(
			'default'           => '',
			'sanitize_callback' => 'perfect_ecommerce_store_sanitize_dropdown_pages'
		) );
		$wp_customize->add_control( 'perfect_ecommerce_store_slider' . $count, array(
			'label'    => __( 'Select Slide Image Page', 'perfect-ecommerce-store' ),
        	'description'=> __('Image size (825px x 480px)','perfect-ecommerce-store'),
			'section'  => 'perfect_ecommerce_store_slider_section',
			'type'     => 'dropdown-pages'
		) );
	}

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_effect', array(
		'default'           => '',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_choices'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_slider_effect', array(
		'label'    => __( 'Onload Transactions Effects', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_slider_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInLeft'  => __('bounceInLeft', 'perfect-ecommerce-store'),
			'bounceInRight' => __('bounceInRight', 'perfect-ecommerce-store'),
			'bounceInUp'    => __('bounceInUp', 'perfect-ecommerce-store'),
			'bounceInDown'    => __('bounceInDown', 'perfect-ecommerce-store'),
			'zoomIn'  => __('zoomIn', 'perfect-ecommerce-store'),
			'zoomOut' => __('zoomOut', 'perfect-ecommerce-store'),
			'fadeInDown'    => __('fadeInDown', 'perfect-ecommerce-store'),
			'fadeInUp'    => __('fadeInUp', 'perfect-ecommerce-store'),
			'fadeInLeft'  => __('fadeInLeft', 'perfect-ecommerce-store'),
			'fadeInRight' => __('fadeInRight', 'perfect-ecommerce-store'),
			'flip-up'    => __('flip-up', 'perfect-ecommerce-store'),
			'none'    => __('none', 'perfect-ecommerce-store')
		),
	));

	$wp_customize->add_setting('perfect_ecommerce_store_slider_opacity',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_slider_opacity',array(
		'type' => 'range',
		'label' => __('Image Opacity','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_slider_section',
		'input_attrs' => array(
			'step' => '0.1',
			'min' => '0',
			'max' => '1',
		),
	));

	$wp_customize->add_setting('perfect_ecommerce_store_slider_mtitle_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_slider_mtitle_font_size',array(
		'type' => 'number',
		'label' => __('Main Title Font Size','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_slider_section',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_slider_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_slider_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_slider_section',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_slider_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_slider_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_slider_section',
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_color', array(
		'label' => 'Text Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_btn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_btn_color', array(
		'label' => 'Button Text Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_btnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_btnbg_color', array(
		'label' => 'Button Background Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_btnhvr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_btnhvr_color', array(
		'label' => 'Button Hover Text Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_btnhvrbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_btnhvrbg_color', array(
		'label' => 'Button Hover Background Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_np_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_np_color', array(
		'label' => 'Next/Pre Text Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_slider_npbdr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_slider_npbdr_color', array(
		'label' => 'Next/Pre Button Border Color',
		'section' => 'perfect_ecommerce_store_slider_section',
	)));

	//Trending Product
	$wp_customize->add_section('perfect_ecommerce_store_products',array(
		'title'	=> __('Featured Products','perfect-ecommerce-store'),
		'description'=> __('Note : This section will appear below the slider.','perfect-ecommerce-store'),
		'panel' => 'perfect_ecommerce_store_panel_id',
	));	

	$wp_customize->add_setting( 'perfect_ecommerce_store_block1', array(
		'default'           => '',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_dropdown_pages'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_block1', array(
		'label'    => __( 'Select Page For Block 1', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_products',
		'type'     => 'dropdown-pages'
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_block2', array(
		'default'           => '',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_dropdown_pages'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_block2', array(
		'label'    => __( 'Select Page For Block 2', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_products',
		'type'     => 'dropdown-pages'
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_block_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_block_color', array(
		'label' => 'Title Color',
		'section' => 'perfect_ecommerce_store_products',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_block_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_block_text_color', array(
		'label' => 'Text Color',
		'section' => 'perfect_ecommerce_store_products',
	)));
	
	$wp_customize->add_setting('perfect_ecommerce_store_maintitle',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('perfect_ecommerce_store_maintitle',array(
		'label'	=> __('Featured Products Title','perfect-ecommerce-store'),
		'section'=> 'perfect_ecommerce_store_products',
		'setting'=> 'perfect_ecommerce_store_maintitle',
		'type'=> 'text'
	));	

	$wp_customize->add_setting('perfect_ecommerce_store_featured_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_featured_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_products',
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_page', array(
		'default'           => '',
		'sanitize_callback' => 'perfect_ecommerce_store_sanitize_dropdown_pages'
	));
	$wp_customize->add_control( 'perfect_ecommerce_store_page', array(
		'label'    => __( 'Select Product Page', 'perfect-ecommerce-store' ),
		'section'  => 'perfect_ecommerce_store_products',
		'type'     => 'dropdown-pages'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_product_section_padding',array(
      'default' => '',
      'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_product_section_padding',array(
		'type' => 'number',
		'label' => __('Section Top Bottom Padding','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_products',
	));

	$wp_customize->add_setting('perfect_ecommerce_store_product_img_hight',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
	));
	$wp_customize->add_control('perfect_ecommerce_store_product_img_hight',array(
		'type' => 'number',
		'label' => __('Image Hight','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_products',
	));

   $wp_customize->add_setting( 'perfect_ecommerce_store_feature_product_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
   ));
 	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_feature_product_color', array(
	   'label' => 'Text Color',
		'section' => 'perfect_ecommerce_store_products',
   )));

	//Footer
    $wp_customize->add_section( 'perfect_ecommerce_store_footer', array(
    	'title' => __( 'Footer Setting', 'perfect-ecommerce-store' ),
		'priority'   => null,
		'panel' => 'perfect_ecommerce_store_panel_id'
	) );

	$wp_customize->add_setting('perfect_ecommerce_store_show_back_totop',array(
 		'default' => true,
   	'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_checkbox'
	));
	$wp_customize->add_control('perfect_ecommerce_store_show_back_totop',array(
   	'type' => 'checkbox',
   	'label' => __('Show / Hide Back to Top','perfect-ecommerce-store'),
   	'section' => 'perfect_ecommerce_store_footer'
	));

   $wp_customize->add_setting('perfect_ecommerce_store_footer_copylink',array(
		'default'	=> 'https://www.luzuk.com/products/free-ecommerce-wordpress-theme/',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('perfect_ecommerce_store_footer_copylink',array(
		'label'	=> __('Copyright Text Link','perfect-ecommerce-store'),
		'section'	=> 'perfect_ecommerce_store_footer',
		'setting'	=> 'perfect_ecommerce_store_footer_copylink',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_footer_copy',array(
		'default'	=> 'Ecommerce WordPress Theme By Luzuk',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('perfect_ecommerce_store_footer_copy',array(
		'label'	=> __('Copyright Text','perfect-ecommerce-store'),
		'section'	=> 'perfect_ecommerce_store_footer',
		'setting'	=> 'perfect_ecommerce_store_footer_copy',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('perfect_ecommerce_store_copyright_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'perfect_ecommerce_store_sanitize_float'
 	));
 	$wp_customize->add_control('perfect_ecommerce_store_copyright_padding',array(
		'type' => 'number',
		'label' => __('Copyright Top Bottom Padding','perfect-ecommerce-store'),
		'section' => 'perfect_ecommerce_store_footer',
	));

	$wp_customize->add_setting( 'perfect_ecommerce_store_footer_widgets_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_footer_widgets_title_color', array(
		'label' => 'Widgets Title Color',
		'section' => 'perfect_ecommerce_store_footer',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_footer_widgets_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_footer_widgets_text_color', array(
		'label' => 'Widgets Text Color',
		'section' => 'perfect_ecommerce_store_footer',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_copyright_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_copyright_color', array(
		'label' => 'Copyright Text Color',
		'section' => 'perfect_ecommerce_store_footer',
	)));

	$wp_customize->add_setting( 'perfect_ecommerce_store_copyrightbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'perfect_ecommerce_store_copyrightbg_color', array(
		'label' => 'Copyright BG Color',
		'section' => 'perfect_ecommerce_store_footer',
	)));

	$wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport  = 'postMessage';

	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title a',
		'render_callback' => 'perfect_ecommerce_store_customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'perfect_ecommerce_store_customize_partial_blogdescription',
	) );
}
add_action( 'customize_register', 'perfect_ecommerce_store_customize_register' );

function perfect_ecommerce_store_sanitize_colorscheme( $input ) {
	$valid = array( 'light', 'dark', 'custom' );
	if ( in_array( $input, $valid, true ) ) {
		return $input;
	}
	return 'light';
}

function perfect_ecommerce_store_customize_partial_blogname() {
	bloginfo( 'name' );
}

function perfect_ecommerce_store_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

function perfect_ecommerce_store_is_static_front_page() {
	return ( is_front_page() && ! is_home() );
}

function perfect_ecommerce_store_is_view_with_layout_option() {
	// This option is available on all pages. It's also available on archives when there isn't a sidebar.
	return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) );
}

/**
 * Singleton class for handling the theme's customizer integration.
 *
 * @since  1.0.0
 * @access public
 */
final class Perfect_Ecommerce_Store_Customize {

	/**
	 * Returns the instance.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return object
	 */
	public static function get_instance() {

		static $instance = null;

		if ( is_null( $instance ) ) {
			$instance = new self;
			$instance->setup_actions();
		}

		return $instance;
	}

	/**
	 * Constructor method.
	 *
	 * @since  1.0.0
	 * @access private
	 * @return void
	 */
	private function __construct() {}

	/**
	 * Sets up initial actions.
	 *
	 * @since  1.0.0
	 * @access private
	 * @return void
	 */
	private function setup_actions() {

		// Register panels, sections, settings, controls, and partials.
		add_action( 'customize_register', array( $this, 'sections' ) );

		// Register scripts and styles for the controls.
		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 );
	}

	/**
	 * Sets up the customizer sections.
	 *
	 * @since  1.0.0
	 * @access public
	 * @param  object  $manager
	 * @return void
	 */
	public function sections( $manager ) {

		// Load custom sections.
		load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );

		// Register custom section types.
		$manager->register_section_type( 'Perfect_Ecommerce_Store_Customize_Section_Pro' );

		// Register sections.
		$manager->add_section(
			new Perfect_Ecommerce_Store_Customize_Section_Pro(
				$manager,
				'perfect_ecommerce_store_example_1',
				array(
					'priority' => 9,
					'title'    => esc_html__( 'Ecommerce Pro', 'perfect-ecommerce-store' ),
					'pro_text' => esc_html__( 'Upgrade Pro', 'perfect-ecommerce-store' ),
					'pro_url'  => esc_url('https://www.luzuk.com/products/premium-ecommerce-wordpress-theme/')
				)
			)
		);
	}

	/**
	 * Loads theme customizer CSS.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	public function enqueue_control_scripts() {

		wp_enqueue_script( 'perfect-ecommerce-store-customize-controls', trailingslashit( esc_url(get_template_directory_uri()) ) . '/assets/js/customize-controls.js', array( 'customize-controls' ) );

		wp_enqueue_style( 'perfect-ecommerce-store-customize-controls', trailingslashit( esc_url(get_template_directory_uri()) ) . '/assets/css/customize-controls.css' );
	}
}

// Doing this customizer thang!
Perfect_Ecommerce_Store_Customize::get_instance();