Home Forums Basel support forum Not showing all Featured Products in Xtemos Products (grid or carousel)

Not showing all Featured Products in Xtemos Products (grid or carousel)

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #12215

    On my homepage I’m using the Xtemos Products (grid or carousel) and using “Featured Products” as my data source. For some reason it is only pulling 3 products that are marked featured when I have at least 7 products that are marked featured. No matter what settings for the grid or carousel, I’m not able to get more than 3 to show.

    I want my featured products to be in a grid with 4 products showing at a time using the arrows to slider to the next set of four featured products.

    Screenshot attached.

    Attachments:
    You must be logged in to view attached files.
    #12228

    Artem Temos
    Keymaster

    Hello,

    Could you please check is it our theme issue trying to add “Featured products” element that comes with Visual Composer? How many products does this element display?

    Regards

    #12233

    I am using the Xtemos Products (grid or carousel) element that is in Visual Composer. I have attached 4 screenshots showing the element and settings selected.

    I had downloaded the Basel Homepage template from the Dummy Content. I changed the Products (grid or carousel) Data Source setting from “All Products” to “Featured Products” and haven’t been able to get all of my featured products to show – only 3 featured products are showing.

    Attachments:
    You must be logged in to view attached files.
    #12239

    Artem Temos
    Keymaster

    But we asked you to check with WooCommerce Featured Products element. Did you try it?

    #12242

    I have confirmed that it is not a Woo issue. I am receiving an error on the backend of wordpress saying “Important notice: You have an outdated version of Visual Composer Design Options. It is required to review and save it.” with a button saying “open design options.” Once I click on it, it doesn’t allow me access.

    I contacted Visual Composer and they said “The design options at your end are disabled by the theme author using vc_set_as_theme. You can get in touch with the theme author and get rid of the above code from the theme to get it back to save them.”

    Attachments:
    You must be logged in to view attached files.
    #12247

    Also since the Woocommerce update, I’m getting a notification that these template files are out of date:
    basel/woocommerce/content-single-product.php version 1.6.4 is out of date. The core version is 3.0.0
    basel/woocommerce/single-product/product-image.php version 3.0.0 is out of date. The core version is 3.0.2
    basel/woocommerce/single-product/product-thumbnails.php version 3.0.0 is out of date. The core version is 3.0.2

    I always dread when Woocommerce has so many updates in a row…

    #12269

    Artem Temos
    Keymaster

    Yes, now we see the problem. It happens because of WooCommerce update. Try to add this code to the functions.php file in the child theme to fix it

    /**
    * ------------------------------------------------------------------------------------------------
    * Shortcode function to display posts as a slider or as a grid
    * ------------------------------------------------------------------------------------------------
    */
    
    if( ! function_exists( 'basel_shortcode_products' ) ) {
    	add_shortcode( 'basel_products', 'basel_shortcode_products' );
    	function basel_shortcode_products($atts, $query = false) {
    		global $woocommerce_loop, $basel_loop;
    	    $parsed_atts = shortcode_atts( basel_get_default_product_shortcode_atts(), $atts );
    		extract( $parsed_atts );
    
    		$basel_loop['img_size'] = $img_size;
    
    		$woocommerce_loop['masonry'] = $products_masonry;
    		$woocommerce_loop['different_sizes'] = $products_different_sizes;
    
    	    $is_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $force_not_ajax != 'yes' );
    
    	    $parsed_atts['force_not_ajax'] = 'no'; // :)
    
    	    $encoded_atts = json_encode( $parsed_atts );
    
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    		if( $ajax_page > 1 ) $paged = $ajax_page;
    
    		$ordering_args = WC()->query->get_catalog_ordering_args( $orderby, $order );
    
    		$meta_query   = WC()->query->get_meta_query();
    
    		$tax_query   = WC()->query->get_tax_query();
    
    		if( $post_type == 'featured' ) {
    			$tax_query[] = array(
    				'taxonomy' => 'product_visibility',
    				'field'    => 'name',
    				'terms'    => 'featured',
    				'operator' => 'IN',
    			);
    		}
    
    		if( $orderby == 'post__in' ) {
    			$ordering_args['orderby'] = $orderby;
    		}
    
    	    $args = array(
    	    	'post_type' 			=> 'product',
    	    	'status' 				=> 'published',
    			'ignore_sticky_posts' 	=> 1,
    	    	'paged' 			  	=> $paged,
    			'orderby'             	=> $ordering_args['orderby'],
    			'order'               	=> $ordering_args['order'],
    	    	'posts_per_page' 		=> $items_per_page,
    	    	'meta_query' 			=> $meta_query,
    	    	'tax_query'           => $tax_query,
    		);
    
    		if( ! empty( $ordering_args['meta_key'] ) ) {
    			$args['meta_key'] = $ordering_args['meta_key'];
    		}
    
    		if( $post_type == 'ids' && $include != '' ) {
    			$args['post__in'] = explode(',', $include);
    		}
    
    		if( ! empty( $exclude ) ) {
    			$args['post__not_in'] = explode(',', $exclude);
    		}
    
    		if( ! empty( $taxonomies ) ) {
    			$taxonomy_names = get_object_taxonomies( 'product' );
    			$terms = get_terms( $taxonomy_names, array(
    				'orderby' => 'name',
    				'include' => $taxonomies
    			));
    
    			if( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
    				$args['tax_query'] = array('relation' => 'OR');
    				foreach ($terms as $key => $term) {
    					$args['tax_query'][] = array(
    				        'taxonomy' => $term->taxonomy,
    				        'field' => 'slug',
    				        'terms' => array( $term->slug ),
    				        'include_children' => true,
    				        'operator' => 'IN'
    					);
    				}
    			}
    		}
    
    		if( ! empty( $order ) ) {
    			$args['order'] = $order;
    		}
    
    		if( ! empty( $offset ) ) {
    			$args['offset'] = $offset;
    		}
    
    		if( $post_type == 'sale' ) {
    			$args['post__in'] = array_merge( array( 0 ), wc_get_product_ids_on_sale() );
    		}
    
    		if( $post_type == 'bestselling' ) {
    			$args['orderby'] = 'meta_value_num';
    			$args['meta_key'] = 'total_sales';
    		}
    
    		$woocommerce_loop['timer']   = $sale_countdown;
    		$woocommerce_loop['product_hover']   = $product_hover;
    
    		$products                    = new WP_Query( $args );
    
    		// Simple products carousel
    		if( $layout == 'carousel' ) return basel_generate_posts_slider( $parsed_atts, $products );
    
    		$woocommerce_loop['columns'] = $columns;
    
    		if ( $pagination == 'more-btn' ) {
    			$woocommerce_loop['masonry'] = 'enable';
    		}
    
    		if ( $pagination != 'arrows' ) {
    			$woocommerce_loop['loop'] = $items_per_page * ( $paged - 1 );
    		}
    
    		$class .= ' pagination-' . $pagination;
    		$class .= ' grid-columns-' . $columns;
    		if( $woocommerce_loop['masonry'] == 'enable') {
    			$class .= ' grid-masonry';
    		}
    
    		ob_start();
    
    		if(!$is_ajax) echo '<div class="basel-products-element">';
    
    	    if(!$is_ajax && $pagination != 'more-btn') echo '<div class="basel-products-loader"></div>';
    
    	    if(!$is_ajax) echo '<div class="products elements-grid row basel-products-holder ' . esc_attr( $class) . '" data-paged="1" data-atts="' . esc_attr( $encoded_atts ) . '">';
    
    		if ( $products->have_posts() ) :
    			while ( $products->have_posts() ) :
    				$products->the_post();
    				wc_get_template_part( 'content', 'product' );
    			endwhile;
    		endif;
    
        	if(!$is_ajax) echo '</div>';
    
    		woocommerce_reset_loop();
    		wp_reset_postdata();
    
    		if ( $products->max_num_pages > 1 && !$is_ajax ) {
    			?>
    		    	<div class="products-footer">
    		    		<?php if ($pagination == 'more-btn'): ?>
    		    			<a href="#" class="btn basel-products-load-more"><?php _e('Load more products', 'basel'); ?></a>
    		    		<?php elseif ($pagination == 'arrows'): ?>
    		    			<a href="#" class="btn basel-products-load-prev disabled"><?php _e('Load previous products', 'basel'); ?></a>
    		    			<a href="#" class="btn basel-products-load-next"><?php _e('Load next products', 'basel'); ?></a>
    		    		<?php endif ?>
    		    	</div>
    		    <?php
    		}
    
        	if(!$is_ajax) echo '</div>';
    
    		$output = ob_get_clean();
    
    	    if( $is_ajax ) {
    	    	$output =  array(
    	    		'items' => $output,
    	    		'status' => ( $products->max_num_pages > $paged ) ? 'have-posts' : 'no-more-posts'
    	    	);
    	    }
    
    	    return $output;
    
    	}
    
    }

    Regard

    #12298

    Perfect! That worked. Thank you tons! <3

    #12304

    Artem Temos
    Keymaster

    Great, you are welcome!

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Not showing all Featured Products in Xtemos Products (grid or carousel)’ is closed to new replies.