New Landing How can we help? Atelier Sale/featured products page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Posted in: Atelier
  • #287471
    myled
    Member
    Post count: 16

    Hello.

    I need a separate page with sale products. Tried using woocommerce shortcodes, but that of course leaves me with blank page + columns with products. I need normal shop page, but listing only sale or featured products.
    How can I achieve that?

    #287479
    David Martin – Support
    Moderator
    Post count: 20834

    Create page, use the page builder, add the Products asset. Choose Featured or Sale from the Asset type.

    #287486
    myled
    Member
    Post count: 16

    Tank you, it seems to work. However, I’m missing sorting/view bar on the top and the left column. I guess column can be done with widget area?

    #287493
    David Martin – Support
    Moderator
    Post count: 20834

    That is only available on the actual Shop page set in the WooCommerce Options.

    Thanks

    #287497
    myled
    Member
    Post count: 16

    Is it possible to add some parameter to actual shop page, so it shows only sale products?

    #287505
    David Martin – Support
    Moderator
    Post count: 20834

    Not my default, you would need to modify the theme via a child theme. We supply this in the main zip file. Once installed and activated, you can use something like this to modify WooCommerce shop loop: http://stackoverflow.com/a/30561683/4034148

    add_filter( 'pre_get_posts', 'catalog_filters' );
    function catalog_filters( $query ) {
        if ( $query->is_main_query() && $query->post_type = 'product' ) {
            if(isset($_GET['onsale'])) {
                $meta_query = array(
                    'relation' => 'OR',
                    array( // Simple products type
                    'key' => '_sale_price',
                    'value' => 0,
                    'compare' => '>',
                    'type' => 'numeric'
                    ),
                    array( // Variable products type
                    'key' => '_min_variation_sale_price',
                    'value' => 0,
                    'compare' => '>',
                    'type' => 'numeric'
                    )
                ); $query->set('meta_query', $meta_query);
            }
            if(isset($_GET['bestsellers'])) {
                $meta_query     = array(
                array( 
                    'key'           => 'total_sales',
                    'value'         => 0,
                    'compare'       => '>',
                    'type'          => 'numeric'
                    )
                );
            }
        }
    
    return $query;
    }
    #287509
    myled
    Member
    Post count: 16

    $query->set('meta_query', $meta_query); d($query);

    Not sure, what d($query) is, and it was causing error 500.
    However it was just what I needed. Thanks!

    #287511
    David Martin – Support
    Moderator
    Post count: 20834

    Have updated, good spot!

    Thanks.

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register