<?php
/**
 * Created by Sublime text 2.
 * User: thanhhiep992
 * Date: 31/08/15
 * Time: 10:00 AM
 */
/************************************Main Slider*************************************/
if(!function_exists('sv_vc_banner_slider'))
{
    function sv_vc_banner_slider($attr, $content = false)
    {
        $html = $css_class = '';
        extract(shortcode_atts(array(
            'style'      => 'slider',
            'image'      => '',
            'title'      => '',
            'title2'     => '',
            'item'          => '1',
            'item_res'      => '',
            'autoplay'      => 'false',
            'loop'          => 'false',
            'margin_item'   => '',
            'custom_css' => '',
        ),$attr));
        if(!empty($custom_css)) $css_class = vc_shortcode_custom_css_class( $custom_css );
        switch ($style) {
            case 'owl-slider-home8':
                $data_res = '';$data_margin = 0;
                if($item > 1) $data_margin = 20;
                if(!empty($margin_item) || $margin_item == '0') $data_margin = $margin_item;
                if(!empty($item_res)){
                    $item_data = explode(',', $item_res);
                    if(is_array($item_data)){
                        $count_data = 1;
                        foreach ($item_data as $data_device) {
                            $data_device = explode(':', $data_device);
                            if(is_array($data_device)){
                                $data_res .= '"'.$data_device[0].'":{"items":'.$data_device[1].'}';
                                if($count_data < count($item_data)) $data_res .= ',';                        
                                $count_data++;
                            }
                        }
                    }
                    $data_res = "'".'{'.$data_res.'}'."'";
                }
                else{
                    if($item == 1) $data_res = "'".'{"0":{"items":1},"600":{"items":1},"1000":{"items":'.$item.'}}'."'";
                    if($item >= 3) $data_res = "'".'{"0":{"items":1},"600":{"items":2},"1000":{"items":'.$item.'}}'."'";
                    if($item >= 5) $data_res = "'".'{"0":{"items":1},"480":{"items":2},"600":{"items":3},"1000":{"items":'.$item.'}}'."'";
                }
                $html .=    '<div class="check-deals">
                                <div class="kt-owl-carousel" data-items="'.$item.'" data-autoplay="'.$autoplay.'" data-margin="'.$data_margin.'" data-loop="'.$loop.'"  data-nav="true" data-responsive='.$data_res.'>';
                $html .=            wpb_js_remove_wpautop($content, false);
                $html .=        '</div>
                            </div>';
                break;

            case 'banner-slider8':
                $html .=    '<div class="banner-slider8">
                                <ul class="bxslider bxslider-home6 '.$css_class.'">
                                    '.wpb_js_remove_wpautop($content, false).'
                                </ul>
                            </div>';

                break;

            case 'block-slider6':
                $html .=    '<div class="banner-slider6 clearfix">
                                <ul class="bxslider bxslider-home6 '.$css_class.'">
                                    '.wpb_js_remove_wpautop($content, false).'
                                </ul>
                            </div>';

                break;

            case 'block-slider5':
                $html .=    '<div class="block-slider5 clearfix">
                                <div class="content-block-slider5 '.$css_class.'">
                                    <ul class="" id="bxslider-home4">
                                        '.wpb_js_remove_wpautop($content, false).'
                                    </ul>
                                </div>
                            </div>';

                break;
                
            case 'slider-home7':
                $html .=    '<div class="option4 white-bg clearfix">
                                <div class="block-slider block-slider4 '.$css_class.'">
                                    <ul class="" id="bxslider-home4">
                                        '.wpb_js_remove_wpautop($content, false).'
                                    </ul>
                                </div>
                            </div>';

                break;

            case 'slider-home4':
                $html .=    '<div class="option4 clearfix">
                                <div class="block-slider block-slider4 '.$css_class.'">
                                    <ul class="" id="bxslider-home4">
                                        '.wpb_js_remove_wpautop($content, false).'
                                    </ul>
                                </div>
                            </div>';

                break;

            case 'owl-slider-home3':
                $data_res = '';$data_margin = 0;
                if($item > 1) $data_margin = 30;
                if(!empty($margin_item) || $margin_item == '0') $data_margin = $margin_item;
                if(!empty($item_res)){
                    $item_data = explode(',', $item_res);
                    if(is_array($item_data)){
                        $count_data = 1;
                        foreach ($item_data as $data_device) {
                            $data_device = explode(':', $data_device);
                            if(is_array($data_device)){
                                $data_res .= '"'.$data_device[0].'":{"items":'.$data_device[1].'}';
                                if($count_data < count($item_data)) $data_res .= ',';                        
                                $count_data++;
                            }
                        }
                    }
                    $data_res = "'".'{'.$data_res.'}'."'";
                }
                else{
                    if($item == 1) $data_res = "'".'{"0":{"items":1},"600":{"items":1},"1000":{"items":'.$item.'}}'."'";
                    if($item >= 3) $data_res = "'".'{"0":{"items":1},"600":{"items":2},"1000":{"items":'.$item.'}}'."'";
                    if($item >= 5) $data_res = "'".'{"0":{"items":1},"480":{"items":2},"600":{"items":3},"1000":{"items":'.$item.'}}'."'";
                }
                $html .=    '<div class="option3 clearfix"><div class="block carousel-slide '.$css_class.'">
                                <div class="block-head">
                                    <h4 class="widget-title">'.esc_html($title).'</h4>
                                </div>
                                <div class="block-inner">
                                    <ul class="list-slide kt-owl-carousel" data-items="'.$item.'" data-autoplay="'.$autoplay.'" data-margin="'.$data_margin.'" data-loop="'.$loop.'"  data-nav="true" data-responsive='.$data_res.'>';
                $html .=                wpb_js_remove_wpautop($content, false);
                $html .=            '</ul>
                                </div>
                            </div></div>';
                break;

            case 'list':
                $html .=    '<div class="block block-shop-features '.$css_class.'">
                                <div class="block-head">
                                    <div class="block-title">
                                        <div class="block-icon">
                                            '.wp_get_attachment_image($image,'full').'
                                        </div>
                                        <div class="block-text">
                                            <div class="block-title-text text-sm">'.esc_html($title).'</div>
                                            <div class="block-title-text text-lg">'.esc_html($title2).'</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="block-inner">
                                    <ul class="list-banner">';
                $html .=                wpb_js_remove_wpautop($content, false);
                $html .=            '</ul>
                                </div>
                            </div>';
                break;

            case 'owl-slider':
                $data_res = '';$data_margin = 0;
                if($item > 1) $data_margin = 30;
                if(!empty($margin_item) || $margin_item == '0') $data_margin = $margin_item;
                if(!empty($item_res)){
                    $item_data = explode(',', $item_res);
                    if(is_array($item_data)){
                        $count_data = 1;
                        foreach ($item_data as $data_device) {
                            $data_device = explode(':', $data_device);
                            if(is_array($data_device)){
                                $data_res .= '"'.$data_device[0].'":{"items":'.$data_device[1].'}';
                                if($count_data < count($item_data)) $data_res .= ',';                        
                                $count_data++;
                            }
                        }
                    }
                    $data_res = "'".'{'.$data_res.'}'."'";
                }
                else{
                    if($item == 1) $data_res = "'".'{"0":{"items":1},"600":{"items":1},"1000":{"items":'.$item.'}}'."'";
                    if($item >= 3) $data_res = "'".'{"0":{"items":1},"600":{"items":2},"1000":{"items":'.$item.'}}'."'";
                    if($item >= 5) $data_res = "'".'{"0":{"items":1},"480":{"items":2},"600":{"items":3},"1000":{"items":'.$item.'}}'."'";
                }
                $html .=    '<div class="block block-banner-owl '.$css_class.'">
                                <div class="block-inner kt-owl-carousel" data-items="'.$item.'" data-autoplay="'.$autoplay.'" data-margin="'.$data_margin.'" data-loop="'.$loop.'"  data-nav="true" data-responsive='.$data_res.'>';
                $html .=            wpb_js_remove_wpautop($content, false);
                $html .=        '</div>
                            </div>';
                break;

            case 'banner-slider9':
                $html .=    '<div class="option9"><div class="block-slider '.$css_class.'">
                                <ul class="home-slider kt-bxslider">';
                $html .=            wpb_js_remove_wpautop($content, false);
                $html .=        '</ul>
                            </div></div>';
                break;

            case 'banner-slider13':
                $html .=    '<div class="'.esc_attr($style).' '.esc_attr($css_class).'">
                                <ul class="home-slider kt-bxslider">';
                $html .=            wpb_js_remove_wpautop($content, false);
                $html .=        '</ul>
                            </div>';
                break;

            case 'banner-slider10':
                $html .=    '<div class=" block-slider '.esc_attr($style).' '.esc_attr($css_class).'">
                                <ul class="home-slider kt-bxslider">';
                $html .=            wpb_js_remove_wpautop($content, false);
                $html .=        '</ul>
                            </div>';
                break;
            
            default:                
                $html .=    '<div class="block block-slider '.$css_class.'">
                                <ul class="home-slider kt-bxslider">';
                $html .=            wpb_js_remove_wpautop($content, false);
                $html .=        '</ul>
                            </div>';
                break;
        }
        return $html;
    }
}
stp_reg_shortcode('sv_banner_slider','sv_vc_banner_slider');
vc_map(
    array(
        'name'     => esc_html__( 'SV banner style', 'megastore' ),
        'base'     => 'sv_banner_slider',
        'category' => esc_html__( '7Up-theme', 'megastore' ),
        'icon'     => 'icon-st',
        'as_parent' => array( 'only' => 'sv_banner_slider_item,sv_banner_slider_item2,sv_banner_slider_item3,sv_banner_slider_item4,sv_brand_slider_item,sv_time_slider_item,sv_banner_slider_item8,sv_deal_slider_item' ),
        'content_element' => true,
        'js_view' => 'VcColumnView',
        'params'   => array(
            array(
                'type'        => 'dropdown',
                'heading'     => esc_html__( 'Style', 'megastore' ),
                'param_name'  => 'style',
                'value'       => array(
                    esc_html__( 'BxSlider', 'megastore' )    => 'slider',
                    esc_html__( 'BxSlider Home 4', 'megastore' )    => 'slider-home4',
                    esc_html__( 'Owl Slider', 'megastore' )    => 'owl-slider',
                    esc_html__( 'Owl Slider Side home 3', 'megastore' )    => 'owl-slider-home3',
                    esc_html__( 'List with title', 'megastore' )    => 'list',
                    esc_html__( 'BxSlider Home 5', 'megastore' )    => 'block-slider5',
                    esc_html__( 'BxSlider Home 6', 'megastore' )    => 'block-slider6',
                    esc_html__( 'BxSlider Home 7', 'megastore' )    => 'slider-home7',
                    esc_html__( 'BxSlider Home 8', 'megastore' )    => 'banner-slider8',
                    esc_html__( 'Owl Slider home 8', 'megastore' )    => 'owl-slider-home8',
                    esc_html__( 'BxSlider Home 9', 'megastore' )    => 'banner-slider9',
                    esc_html__( 'BxSlider Home 10', 'megastore' )    => 'banner-slider10',
                    esc_html__( 'BxSlider Home 13', 'megastore' )    => 'banner-slider13',
                    )
            ),
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image Title', 'megastore' ),
                'param_name'  => 'image',
                'dependency'  => array(
                    'element'   => 'style',
                    'value'     => 'list',
                    )
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Title', 'megastore' ),
                'param_name'  => 'title',
                'dependency'  => array(
                    'element'   => 'style',
                    'value'     => array('list','owl-slider-home3'),
                    )
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Title 2', 'megastore' ),
                'param_name'  => 'title2',
                'dependency'  => array(
                    'element'   => 'style',
                    'value'     => 'list',
                    )
            ),            
            array(
                "type"          => "textfield",
                "heading"       => esc_html__("Item",'megastore'),
                "param_name"    => "item",
                "group"         => esc_html__("Owl Settings",'megastore'),
            ),
            array(
                "type"          => "textfield",
                "heading"       => esc_html__("Item Responsive",'megastore'),
                "param_name"    => "item_res",
                "group"         => esc_html__("Owl Settings",'megastore'),
                'description' => esc_html__( 'Enter item for screen width(px) format is width:value and separate values by ",". Example is 0:2,600:3,1000:4. Default is auto.', 'megastore' ),
            ),
            array(
                "type"          => "dropdown",
                "heading"       => esc_html__("Autoplay",'megastore'),
                "param_name"    => "autoplay",
                "group"         => esc_html__("Owl Settings",'megastore'),
                "value"         => array(
                    esc_html__("False",'megastore') => 'false',
                    esc_html__("True",'megastore') => 'true',
                    )
            ),
            array(
                "type"          => "dropdown",
                "heading"       => esc_html__("Loop",'megastore'),
                "param_name"    => "loop",
                "group"         => esc_html__("Owl Settings",'megastore'),
                "value"         => array(
                    esc_html__("False",'megastore') => 'false',
                    esc_html__("True",'megastore') => 'true',
                    )
            ),
            array(
                "type"          => "textfield",
                "heading"       => esc_html__("Margin Item",'megastore'),
                "param_name"    => "margin_item",
                "group"         => esc_html__("Owl Settings",'megastore'),
            ),           
            array(
                "type"          => "css_editor",
                "heading"       => esc_html__("Custom Block",'megastore'),
                "param_name"    => "custom_css",
                'group'         => esc_html__('Advanced','megastore')
            )
        )
    )
);

/*******************************************END MAIN*****************************************/


/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_banner_slider_item'))
{
    function sv_vc_banner_slider_item($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'image'           => '',
            'link'            => '',
            'hover'           => '',
        ),$attr));        
        $html .=    '<li class="'.$hover.'"><a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a></li>';
        return $html;
    }
}
stp_reg_shortcode('sv_banner_slider_item','sv_vc_banner_slider_item');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Banner Item', 'megastore' ),
        'base'     => 'sv_banner_slider_item',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
            array(
                'type'        => 'dropdown',
                'heading'     => esc_html__( 'Hover Style', 'megastore' ),
                'param_name'  => 'hover',
                'value'       => array(
                    esc_html__( 'None', 'megastore' )    => '',
                    esc_html__( 'Style 1', 'megastore' )    => 'banner-hover',
                    )
            ),
        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_brand_slider_item'))
{
    function sv_vc_brand_slider_item($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'image'           => '',
            'link'            => '',
        ),$attr));        
        $html .=    '<div class="item-brand"><a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a></div>';
        return $html;
    }
}
stp_reg_shortcode('sv_brand_slider_item','sv_vc_brand_slider_item');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Brand Item', 'megastore' ),
        'base'     => 'sv_brand_slider_item',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_time_slider_item'))
{
    function sv_vc_time_slider_item($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'image'           => '',
            'link'            => '',
            'title'           => '',
            'title2'          => '',
            'title3'          => '',
            'ex_text'         => '',
            'ex_text2'        => '',
            'time'            => '',
        ),$attr));        
        $html .=    '<li>
                        <div class="item-banner6">
                            <div class="banner-thumb"><a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a></div>
                            <div class="banner-info">
                                <div class="container">
                                    <div class="banner-intro">
                                        <h3><span>'.esc_html($title).'</span></h3>
                                        <h2><span>'.esc_html($title2).'</span></h2>
                                        <h4><span>'.esc_html($title3).'</span></h4>
                                    </div>
                                    <div class="banner-count-down">
                                        <div class="percent-sale">
                                            <strong>'.esc_html($ex_text).'</strong>
                                            <span>'.esc_html($ex_text2).'</span>
                                        </div>
                                        <div class="count-down-circle" data-date="'.esc_attr($time).'"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </li>';
        return $html;
    }
}
stp_reg_shortcode('sv_time_slider_item','sv_vc_time_slider_item');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Time Item( Home 6)', 'megastore' ),
        'base'     => 'sv_time_slider_item',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
            array(
                'type'        => 'textfield',
                'holder'        => 'h3',
                'heading'     => esc_html__( 'Title', 'megastore' ),
                'param_name'  => 'title',
            ),
            array(
                'type'        => 'textfield',
                'holder'        => 'h2',
                'heading'     => esc_html__( 'Title 2', 'megastore' ),
                'param_name'  => 'title2',
            ),
            array(
                'type'        => 'textfield',
                'holder'        => 'h4',
                'heading'     => esc_html__( 'Title 3', 'megastore' ),
                'param_name'  => 'title3',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Extra Percent', 'megastore' ),
                'param_name'  => 'ex_text',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Extra Text', 'megastore' ),
                'param_name'  => 'ex_text2',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Time', 'megastore' ),
                'param_name'  => 'time',
                'description'   => esc_html__( 'Entert time for countdown. Format is mm/dd/yyyy. Example: 12/15/2016', 'megastore' ),
            ),

        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_banner_slider_item3'))
{
    function sv_vc_banner_slider_item3($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'image'           => '',
            'link'            => '',
            'title'           => '',
        ),$attr));        
        $html .=    '<li>
                        <div class="image">
                            <a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a>
                        </div>
                        <div class="title">
                            <a href="'.esc_url($link).'">'.$title.'</a>
                        </div>
                        <div class="button-action">
                            <a href="'.esc_url($link).'" class="button-radius">'.esc_html__("SHOP NOW","megastore").'<span class="icon"></span></a>
                        </div>
                    </li>';
        return $html;
    }
}
stp_reg_shortcode('sv_banner_slider_item3','sv_vc_banner_slider_item3');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Banner Item 3', 'megastore' ),
        'base'     => 'sv_banner_slider_item3',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),            
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Title', 'megastore' ),
                'param_name'  => 'title',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_banner_slider_item4'))
{
    function sv_vc_banner_slider_item4($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'image'           => '',
            'link'            => '',
        ),$attr));        
        $html .=    '<li>
                        <a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a>
                        <div class="caption-group">
                            '.wpb_js_remove_wpautop($content, true).'
                        </div>
                    </li>';
        return $html;
    }
}
stp_reg_shortcode('sv_banner_slider_item4','sv_vc_banner_slider_item4');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Banner Item 4(Bxslider Home 4)', 'megastore' ),
        'base'     => 'sv_banner_slider_item4',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
            array(
                'type'        => 'textarea_html',
                'holder'      => 'div',
                'heading'     => esc_html__( 'Content', 'megastore' ),
                'param_name'  => 'content',
            ),
        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_banner_slider_item8'))
{
    function sv_vc_banner_slider_item8($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'style'           => 'item-banner8',
            'image'           => '',
            'link'            => '',
        ),$attr));
        switch ($style) {
            case 'item-banner16':
                $html .=    '<li>
                                '.wp_get_attachment_image($image,'full').'
                                <div class="banner-info16 caption-group">';
                $html .=            wpb_js_remove_wpautop($content, true);
                if(!empty($link)) $html .=    '<a class="caption button-radius" href="'.esc_url($link).'"><span class="icon"></span>'.esc_html__("Shop now","megastore").'</a>';
                $html .=        '</div>
                            </li>';
                break;
            
            default:
                $html .=    '<div class="'.esc_attr($style).'">
                                <div class="banner-thumb"><a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a></div>
                                <div class="banner-info">
                                    <div class="container">
                                        <div class="banner-intro">
                                            '.wpb_js_remove_wpautop($content, true).'
                                        </div>
                                    </div>
                                </div>
                            </div>';
                break;
        }        
        return $html;
    }
}
stp_reg_shortcode('sv_banner_slider_item8','sv_vc_banner_slider_item8');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Banner Home Item', 'megastore' ),
        'base'     => 'sv_banner_slider_item8',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'dropdown',
                'heading'     => esc_html__( 'Style', 'megastore' ),
                'param_name'  => 'style',
                'value'       => array(
                    esc_html__( 'Home 8', 'megastore' ) => 'item-banner8',
                    esc_html__( 'Home 13', 'megastore' ) => 'item-banner13',
                    esc_html__( 'Home 16', 'megastore' ) => 'item-banner16',
                    )
            ),
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
            array(
                'type'        => 'textarea_html',
                'holder'      => 'div',
                'heading'     => esc_html__( 'Content', 'megastore' ),
                'param_name'  => 'content',
            ),
        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_deal_slider_item'))
{
    function sv_vc_deal_slider_item($attr, $content = false)
    {
        $html = '';
        extract(shortcode_atts(array(
            'image'           => '',
            'title'            => '',
            'title2'            => '',
            'label'            => '',
            'color'            => '',
            'link'            => '',
        ),$attr));
        if(!empty($color)) $color = SV_Assets::build_css('background:'.$color.';');
        $html .=    '<div class="item-check-deal">
                        <div class="check-deal-thumb">
                            <a href="'.esc_url($link).'">'.wp_get_attachment_image($image,'full').'</a>
                        </div>
                        <div class="check-deal-info '.esc_attr($color).'">
                            <h3>'.esc_html($title).'</h3>
                            <h2>'.esc_html($title2).'</h2>
                            <a href="'.esc_url($link).'" class="button-radius white">'.esc_html($label).'<span class="icon"></span></a>
                        </div>
                    </div>';
        return $html;
    }
}
stp_reg_shortcode('sv_deal_slider_item','sv_vc_deal_slider_item');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Deal Item', 'megastore' ),
        'base'     => 'sv_deal_slider_item',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'attach_image',
                'heading'     => esc_html__( 'Image', 'megastore' ),
                'param_name'  => 'image',
            ),
            array(
                'type'        => 'textfield',
                'holder'      => 'h3',
                'heading'     => esc_html__( 'Title', 'megastore' ),
                'param_name'  => 'title',
            ),
            array(
                'type'        => 'textfield',
                'holder'      => 'h2',
                'heading'     => esc_html__( 'Title 2', 'megastore' ),
                'param_name'  => 'title2',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Label button', 'megastore' ),
                'param_name'  => 'label',
            ),
            array(
                'type'        => 'textfield',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'link',
            ),
            array(
                'type'        => 'colorpicker',
                'heading'     => esc_html__( 'Background Info', 'megastore' ),
                'param_name'  => 'color',
            ),
        )
    )
);

/**************************************END ITEM************************************/

/**************************************BEGIN ITEM************************************/
//Banner item Frontend
if(!function_exists('sv_vc_banner_slider_item2'))
{
    function sv_vc_banner_slider_item2($attr, $content = false)
    {
        $html = $view_html = $c_bg_color = '';
        extract(shortcode_atts(array(
            'bg_color'           => '',
            'view_link'            => '',
        ),$attr));
        if(!empty($bg_color)) $c_bg_color = SV_Assets::build_css('background-color:'.$bg_color);
        $view_link = vc_build_link( $view_link );
        if(!empty($view_link['url']) && !empty($view_link['title'])){
            if(!empty($view_link['target'])) $target_html = 'target="'.$view_link['target'].'"';
            else $target_html = '';
            $view_html = '<a class="button-radius white" href="'.esc_url($view_link['url']).'" '.$target_html.'>'.$view_link['title'].'<span class="icon"></span></a>';
        }
        $html .=    '<div class="banner-text-wrap '.$c_bg_color.'">
                        <div class="banner-text">                        
                            '.wpb_js_remove_wpautop($content, true).'
                            '.$view_html.'
                        </div>
                    </div>';
        return $html;
    }
}
stp_reg_shortcode('sv_banner_slider_item2','sv_vc_banner_slider_item2');

// Banner item
vc_map(
    array(
        'name'     => esc_html__( 'Banner Item 2', 'megastore' ),
        'base'     => 'sv_banner_slider_item2',
        'icon'     => 'icon-st',
        'content_element' => true,
        'as_child' => array('only' => 'sv_banner_slider'),
        'params'   => array(
            array(
                'type'        => 'colorpicker',
                'heading'     => esc_html__( 'Background Color', 'megastore' ),
                'param_name'  => 'bg_color',
            ),
            array(
                'type'        => 'vc_link',
                'heading'     => esc_html__( 'Link', 'megastore' ),
                'param_name'  => 'view_link',
            ),
            array(
                'type'        => 'textarea_html',
                'holder'      => 'div',
                'heading'     => esc_html__( 'Content', 'megastore' ),
                'param_name'  => 'content',
            ),
        )
    )
);

/**************************************END ITEM************************************/

//Your "container" content element should extend WPBakeryShortCodesContainer class to inherit all required functionality
if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
    class WPBakeryShortCode_Sv_Banner_Slider extends WPBakeryShortCodesContainer {}
}
if ( class_exists( 'WPBakeryShortCode' ) ) {
    class WPBakeryShortCode_Sv_Banner_Slider_Item extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Brand_Slider_Item extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Time_Slider_Item extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Banner_Slider_Item2 extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Banner_Slider_Item3 extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Banner_Slider_Item4 extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Banner_Slider_Item8 extends WPBakeryShortCode {}
    class WPBakeryShortCode_Sv_Deal_Slider_Item extends WPBakeryShortCode {}
}