<?php
/**
 * woocommerce vc element products.
 *
 * @package tz-interiart/vc_templaza/woo-products
 * @version 1.0.0
 */
//die('templaza');
defined('ABSPATH') || exit;

$woo_products_cat = array();
$woo_products_cate = get_categories(array('taxonomy' => 'product_cat'));

foreach ($woo_products_cate as $cat) {
    $woo_products_cat[$cat->name] = $cat->term_id;
}
// Create Woocommerce Products element for Visual Composer

vc_map(array(
    'name' => esc_html__('Woocommerce Products', 'tz-interiart'),
    "icon" => "icon-element",
    'base' => 'vc-woo-products',
    'class' => 'vc-woo-products',
    'show_settings_on_create' => true,
    'category' => esc_html__('Built for Templaza', 'tz-interiart'),
    'params' => array(
        // General tab setting
        array(
            'type' => 'dropdown',
            'admin_label' => true,
            'heading' => esc_html__('Layout', 'tz-interiart'),
            'param_name' => 'woo_products_layout',
            "value" => array(
                esc_html__("Slider", "tz-interiart") => 'slider',
                esc_html__("Grid", "tz-interiart") => 'grid'
            ),
            'default' => 'slider'
        ),
        array(
            "type"          => "tzpreview",
            "class"         => "",
            "admin_label"   => false,
            "heading"       => esc_html__("Preview Slider", "tz-interiart"),
            "param_name"    => "preview_Slider",
            "value"         => PLUGIN_PATH."assets/images/slideitem.png",
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),
        array(
            "type"          => "tzpreview",
            "class"         => "",
            "admin_label"   => false,
            "heading"       => esc_html__("Preview Grid", "tz-interiart"),
            "param_name"    => "preview_Grid",
            "value"         => PLUGIN_PATH."assets/images/griditem.gif",
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'grid')
        ),
        array(
            'type' => 'dropdown',
            'class' => '',
            'admin_label' => true,
            'heading' => esc_html__('Data', 'tz-interiart'),
            'param_name' => 'woo_products_data',
            "value" => array(
                esc_html__("Recent Products", "tz-interiart") => 'recent',
                esc_html__("Featured Products", "tz-interiart") => 'featured',
                esc_html__("Product Category Products", "tz-interiart") => 'category',
                esc_html__("Sale Products", "tz-interiart") => 'sale',
                esc_html__("Best Selling Products", "tz-interiart") => 'best',
                esc_html__("Top Rated Products", "tz-interiart") => 'rated',
            ),
            'default' => 'recent'
        ),
        array(
            'type' => 'textfield',
            'class' => '',
            'admin_label' => true,
            'heading' => esc_html__('Max Item Display', 'tz-interiart'),
            'param_name' => 'woo_products_maxitem',
            'value' => '20'
        ),
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Order by', 'tz-interiart'),
            'param_name' => 'woo_products_orderby',
            "value" => array(
                esc_html__("ID", "tz-interiart") => 'ID',
                esc_html__("Order by title", "tz-interiart") => 'title',
                esc_html__("Order by post name (post slug)", "tz-interiart") => 'name',
                esc_html__("Order by date", "tz-interiart") => 'date',
                esc_html__("Random order", "tz-interiart") => 'rand',
                esc_html__("Order by Page Order", "tz-interiart") => 'menu_order'
            ),
        ),
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Order', 'tz-interiart'),
            'param_name' => 'woo_products_order',
            "value" => array(
                esc_html__("ASC", "tz-interiart") => 'ASC',
                esc_html__("DESC", "tz-interiart") => 'DESC'
            ),
        ),


        // show/hide title
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide title', 'tz-interiart'),
            'param_name' => 'woo_products_shtitle',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),

        // show/hide rating
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide rating', 'tz-interiart'),
            'param_name' => 'woo_products_shrating',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),

        // show/hide price
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide price', 'tz-interiart'),
            'param_name' => 'woo_products_shprice',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),

        // show/hide image
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide Thumbnail', 'tz-interiart'),
            'param_name' => 'woo_products_shthumbnail',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),


        // show/hide quick view
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide quick view', 'tz-interiart'),
            'param_name' => 'woo_products_quickview',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),
        // show/hide add to cart action
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide Add to cart Icon', 'tz-interiart'),
            'param_name' => 'woo_products_shaddtocart',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),

        // show/hide add to wishlist action
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/hide Add to Wishlist Icon', 'tz-interiart'),
            'param_name' => 'woo_products_shaddtowishlist',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),
        // show/hide link detail
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Show/Hide Details Icon', 'tz-interiart'),
            'param_name' => 'woo_products_shlinkdetail',
            "value" => array(
                esc_html__("Show", "tz-interiart") => 'show',
                esc_html__("Hide", "tz-interiart") => 'hide'
            ),
            "group" => esc_html__("Show/hide component", "tz-interiart")
        ),
        // Slider tab setting
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Item Columns (on screen > 1000)', 'tz-interiart'),
            'param_name' => 'woo_products_items',
            'description' => esc_html__('Select item columns per view (exclude Child items columns).','tz-interiart'),
            "value" => array(
                esc_html__("1", "tz-interiart") => 1,
                esc_html__("2", "tz-interiart") => 2,
                esc_html__("3", "tz-interiart") => 3,
                esc_html__("4", "tz-interiart") => 4,
                esc_html__("5", "tz-interiart") => 5,
                esc_html__("6", "tz-interiart") => 6,
                esc_html__("7", "tz-interiart") => 7,
                esc_html__("8", "tz-interiart") => 8,
                esc_html__("9", "tz-interiart") => 9,
                esc_html__("10", "tz-interiart") => 10,
            ),

            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),

        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Loop', 'tz-interiart'),
            'param_name' => 'woo_products_loop',
            "value" => array(
                esc_html__("Yes", "tz-interiart") => 1,
                esc_html__("No", "tz-interiart") => 0,
            ),
            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),

        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Autoplay', 'tz-interiart'),
            'param_name' => 'woo_products_autoplay',
            "value" => array(
                esc_html__("Yes", "tz-interiart") => 1,
                esc_html__("No", "tz-interiart") => 0,
            ),
            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),

        array(
            'type' => 'textfield',
            'class' => '',
            'heading' => esc_html__('Autoplay speed', 'tz-interiart'),
            'param_name' => 'woo_products_autoplayspeed',
            "value" => "500",
            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),

        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Navigation', 'tz-interiart'),
            'param_name' => 'woo_products_navigation',
            "value" => array(
                esc_html__("Yes", "tz-interiart") => 1,
                esc_html__("No", "tz-interiart") => 0,
            ),
            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),

        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Dots', 'tz-interiart'),
            'param_name' => 'woo_products_dots',
            "value" => array(
                esc_html__("Yes", "tz-interiart") => 1,
                esc_html__("No", "tz-interiart") => 0,
            ),
            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),
        array(
            'type' => 'textfield',
            'class' => '',
            'heading' => esc_html__('Child Items (Unit: px)', 'tz-interiart'),
            'param_name' => 'woo_products_stagepadding',
            'description' => esc_html__('Enter the width of Child Items being visible on 2 sides. Leave it blank to make these child items invisible.','tz-interiart'),
            "value" => "340",
            "group" => esc_html__("Layout Slider Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'slider')
        ),

        // Get all product category
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Select product category', 'tz-interiart'),
            'param_name' => 'woo_products_category',
            "value" => $woo_products_cat,
            "dependency" => Array('element' => "woo_products_data", 'value' => 'category')
        ),


        // Grid tab setting
        array(
            'type' => 'dropdown',
            'class' => '',
            'heading' => esc_html__('Select columns', 'tz-interiart'),
            'param_name' => 'woo_products_columns',
            "value" => array(
                esc_html__("1", "tz-interiart") => 1,
                esc_html__("2", "tz-interiart") => 2,
                esc_html__("3", "tz-interiart") => 3,
                esc_html__("4", "tz-interiart") => 4,
                esc_html__("5", "tz-interiart") => 5,
            ),
            "group" => esc_html__("Layout Grid Setting", "tz-interiart"),
            "dependency" => Array('element' => "woo_products_layout", 'value' => 'grid')
        ),

        // Design option
        array(
            'type' => 'css_editor',
            'heading' => __( 'Css', 'my-text-domain' ),
            'param_name' => 'css',
            'group' => __( 'Design options', 'my-text-domain' ),
        ),

    )
));
