Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter BassDL

    (@bassdl)

    Ahhh, i didnt knew that…
    I am new here ??
    I will contact them…

    Thread Starter BassDL

    (@bassdl)

    @esmi. thats correct, i found that. Its the html above.
    But i am looking for the input text Search…
    Its the Maya template, i cant find it in the dbase.

    Is set :
    echo apply_filters( ‘yiw_searchform_label’, __( ‘Search for:’, ‘yiw’ ) ) ?>

    Thread Starter BassDL

    (@bassdl)

    Found solution.
    shortcode:
    [product_category category=”YOURCATEGORYSLUG” attribute=’color’ filter=’red,black’]

    Go to plugin/woocommerce/classes/class-wc-shortcodes.php
    Rreplace the public function product_category for below.

    public function product_category( $atts ){
    		global $woocommerce, $woocommerce_loop;
    
    	  	if ( empty( $atts ) ) return;
    
    		extract( shortcode_atts( array(
    			'per_page' 		=> '12',
    			'columns' 		=> '4',
    		  	'orderby'   	=> 'title',
    		  	'order'     	=> 'desc',
    		  	'category'		=> ''
    			), $atts ) );
    
    		if ( ! $category ) return;
    
    		// Default ordering args
    		$ordering_args = $woocommerce->query->get_catalog_ordering_args( $orderby, $order );
    
                    //color
                    $attributes = explode(',', $atts['attribute'] );
                    $attributes =  implode("" , $attributes);
                    $attributes = 'pa_'.$attributes;
                    //colors
                    $filters = explode(',', $atts['filter']);
    
    	  	$args = array(
    			'post_type'				=> 'product',
    			'post_status' 			=> 'publish',
    			'ignore_sticky_posts'	=> 1,
    			'orderby' 				=> $ordering_args['orderby'],
    			'order' 				=> $ordering_args['order'],
    			'posts_per_page' 		=> $per_page,
    			'meta_query' 			=> array(
    				array(
    					'key' 			=> '_visibility',
    					'value' 		=> array('catalog', 'visible'),
    					'compare' 		=> 'IN'
    				)
    			),
    			'tax_query' 			=> array(
                                'relation' => 'AND',
    		    	array(
                                            'taxonomy' 		=> 'product_cat',
    					'terms' 		=> array( esc_attr($category) ),
    					'field' 		=> 'slug',
    					'operator' 		=> 'IN'
    			),
    		    	array(
                                            'taxonomy' 		=> "$attributes",
    					'field' 		=> 'slug',
    					'terms' 		=> $filters,
    					'operator' 		=> 'IN'
    			)
    		    )
    		);
    
    		if ( isset( $ordering_args['meta_key'] ) ) {
    	 		$args['meta_key'] = $ordering_args['meta_key'];
    	 	}
    
    	  	ob_start();
    
                    $products = new WP_Query( $args );
    
    		$woocommerce_loop['columns'] = $columns;
    
    		if ( $products->have_posts() ) : ?>
    
    			<?php woocommerce_product_loop_start(); ?>
    
    				<?php while ( $products->have_posts() ) : $products->the_post(); ?>
    
    					<?php woocommerce_get_template_part( 'content', 'product' ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			<?php woocommerce_product_loop_end(); ?>
    
    		<?php endif;
    
    		wp_reset_postdata();
    
    		return '<div class="woocommerce">' . ob_get_clean() . '</div>';
    	}

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thread Starter BassDL

    (@bassdl)

    Works fine for me, thanks!!!

Viewing 5 replies - 1 through 5 (of 5 total)