__( "Advanced Woo Products", "awavcl" ), "description" => __( "Show woocommerce products in style.", 'awavcl' ), "base" => "awavc_woo_products", "icon" => "awavc_woo_item_icon", "category" => __( "Advanced Elements", "awavcl" ), "params" => array( array( "type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Product Layout Style", "awavcl"), "param_name" => "woo_style", "value" => array( "Style 1" => 'product-item-1', "Style 2" => 'product-item-2', "Style 3" => 'product-item-3', "Style 4" => 'product-item-4', "Style 5" => 'product-item-5', "Style 6" => 'product-item-6', "Style 7" => 'product-item-7', "Style 8" => 'product-item-8', "Style 9" => 'product-item-9', "Style 10" => 'product-item-10', "Style 11" => 'product-item-11', "Style 12" => 'product-item-12', "Style 13" => 'product-item-13', ), "description" => __("custom image height for product image", "awavcl"), "group" => __( "Image Size", "awavcl" ), 'admin_label' => true, ), array( "type" => "textfield", "heading" => __( "Number Of Products", "awavcl" ), "param_name" => "products", 'value' => '', 'admin_label' => true, ), array( "type" => "textfield", "heading" => __( "Products Category Slug", "awavcl" ), "param_name" => "categories_id", 'admin_label' => true, 'value' => '', "description" => __("Type products category slug to get specific category products into carousel. Leave empty for all categories products", "awavcl") ), array( "type" => "textfield", "heading" => __( "Product Tag", "awavcl" ), "param_name" => "tag", 'value' => 'New', "description" => __("If you dont want to show any tag mark then leave it blank.", "awavcl") ), array( "type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Show Rating", "awavcl"), "param_name" => "rating_enable", "value" => array( "Yes" => 'yes', "No" => 'no', ), ), array( "type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Custom Image Height", "awavcl"), "param_name" => "image_size", "value" => array( "No" => 'no', "Yes" => 'yes', ), "description" => __("custom image height for product image", "awavcl"), "group" => __( "Image Size", "awavcl" ), ), array( "type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Column", "awavcl"), "param_name" => "col_num", "value" => array( "1 Col" => '12', "2 Col" => '6', "3 Col" => '4', "4 Col" => '3', "6 Col" => '2', ), "description" => __("custom image height for product image", "awavcl"), "group" => __( "Image Size", "awavcl" ), ), array( 'type' => 'prime_slider', 'heading' => __( 'Image Height', 'awavcl' ), 'param_name' => 'image_height', "value" => 260, "min" => 5, "max" => 500, "step" => 1, "unit" => "px", "dependency" => Array('element' => "image_size", 'value' => 'yes'), "group" => __( "Image Size", "awavcl" ), ), array( 'type' => 'prime_slider', 'heading' => __( 'Padding Bottom', 'awavcl' ), 'param_name' => 'pd_btm', "value" => 40, "min" => 5, "max" => 100, "step" => 1, "unit" => "px", "group" => __( "Settings", "awavcl" ), ), array( 'type' => 'prime_slider', 'heading' => __( 'Title Font Size', 'awavcl' ), 'param_name' => 'ttl_size', "value" => 18, "min" => 5, "max" => 100, "step" => 1, "unit" => "px", "group" => __( "Settings", "awavcl" ), ), array( 'type' => 'prime_slider', 'heading' => __( 'Sale Price Font Size', 'awavcl' ), 'param_name' => 'price_size', "value" => 20, "min" => 5, "max" => 100, "step" => 1, "unit" => "px", "group" => __( "Settings", "awavcl" ), ), array( 'type' => 'prime_slider', 'heading' => __( 'Regular Price Font Size', 'awavcl' ), 'param_name' => 'del_price_size', "value" => 15, "min" => 5, "max" => 100, "step" => 1, "unit" => "px", "group" => __( "Settings", "awavcl" ), "description" => __("Make it less then sale price font size", "awavcl") ), array( "type" => "colorpicker", "heading" => __("Title Color", 'awavcl'), "param_name" => "ttl_clr", "value" => "", "group" => __("Colors", 'awavcl'), ), array( "type" => "colorpicker", "heading" => __("Price Color", 'awavcl'), "param_name" => "price_clr", "value" => "", "group" => __("Colors", 'awavcl'), ), array( "type" => "colorpicker", "heading" => __("Tag Text Color", 'awavcl'), "param_name" => "tag_txt_clr", "value" => "", "group" => __("Colors", 'awavcl'), ), array( "type" => "colorpicker", "heading" => __("Tag Background Color", 'awavcl'), "param_name" => "tag_bg", "value" => "", "group" => __("Colors", 'awavcl'), "dependency" => array( 'element' => "woo_style", 'value' => array('product-item-6','product-item-7','product-item-8','product-item-9','product-item-10','product-item-11','product-item-12','product-item-13') ), ), array( "type" => "colorpicker", "heading" => __("Color On Hover", 'awavcl'), "param_name" => "hvr_clr", "value" => "", "group" => __("Colors", 'awavcl'), ), array( "type" => "colorpicker", "heading" => __("Add to Cart Text Color", 'awavcl'), "param_name" => "cart_txt_clr", "value" => "", "group" => __("Colors", 'awavcl'), "dependency" => array( 'element' => "woo_style", 'value' => array('product-item-3','product-item-6','product-item-8','product-item-10','product-item-11','product-item-12','product-item-13') ), ), array( "type" => "colorpicker", "heading" => __("Add to Cart Background", 'awavcl'), "param_name" => "cart_bg", "value" => "", "group" => __("Colors", 'awavcl'), "dependency" => array( 'element' => "woo_style", 'value' => array('product-item-3','product-item-6','product-item-8','product-item-10','product-item-11','product-item-12','product-item-13',) ), ), array( "type" => "textfield", "heading" => __("Extra class name", "awavcl"), "param_name" => "extraclass", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "awavcl") ), ) ) ); function awavc_woo_product_shortcode( $atts, $content = null, $tag ) { extract( shortcode_atts( array( 'woo_style' => 'product-item-1', 'css_animation' => '', 'image_size' => '', 'image_height' => '300', 'products' => '-1', 'pd_btm' => '50', 'tag' => 'Sale', 'col_num' => '4', 'categories_id' => 'all', 'items' => '6', 'ttl_size' => '', 'price_size' => '', 'del_price_size' => '', 'ttl_clr' => '', 'price_clr' => '', 'hvr_clr' => '', 'cart_txt_clr' => '', 'cart_bg' => '', 'tag_txt_clr' => '', 'tag_bg' => '', 'rating_enable' => 'yes', 'extraclass' => '', ), $atts ) ); wp_register_style('awavc_woo_products_css', plugins_url( 'css/woo-products.css' , __FILE__ ) ); wp_enqueue_style('awavc_woo_products_css'); wp_register_script('awavc-woo.xjs', plugins_url('/js/woo-js.js', __FILE__), array('jquery')); wp_enqueue_script('awavc-woo.xjs'); $output = ''; $ratting = ''; global $post; static $product_slider_id = 1; global $wp; $current_url = home_url(add_query_arg(array(),$wp->request)); $query_args = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => $products, 'orderby' => 'date', 'order' => 'DESC', ); if( $categories_id != 'all' ) { $query_args['tax_query'] = array( array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $categories_id ) ); } $latest_product_query = new WP_Query( $query_args ); if( $latest_product_query->have_posts() ) { while($latest_product_query->have_posts()) : $latest_product_query->the_post(); global $product; $woo_product_img = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'theme-mid' ); $attachment_ids = $product->get_gallery_image_ids(); if( sizeof($attachment_ids) > 0 ){ $first_attachment_id = reset($attachment_ids); $link = wp_get_attachment_image_src( $first_attachment_id, 'full' )[0]; } $cat_count = sizeof( get_the_terms( get_the_ID(), 'product_cat' ) ); $id = $product->get_id(); $product_tags = get_terms( 'product_tag', $query_args ); $average = $product->get_average_rating(); $result = do_shortcode('[yith_wcwl_add_to_wishlist]'); $ratting.$esy = ''; if($rating_enable == 'yes' ){ if($average == 0 ){$ratting.$esy .= '
';} if($average == 1 ){$ratting.$esy .= '';} if($average == 2 ){$ratting.$esy .= ''; } if($average == 3 ){$ratting.$esy .= '';} if($average == 4 ){$ratting.$esy .= '';} if($average == 5 ){$ratting.$esy .= '';} } if($woo_style == 'product-item-1' ){ $unq = rand(9,9999); $output .= ''; $output .= '