Owl Carousel: Exclude current product - by Royalty

This topic has 8 replies, 2 voices, and was last updated 7 years, 10 months ago ago by Eva Kemp

  • Avatar: Royalty
    Royalty
    Participant
    January 6, 2017 at 15:38

    Hello,
    I am using the following shortcode included in royal theme:
    [etheme_products order=”rand” product_img_hover=”slider” desktop=”5″ notebook=”4″ tablet=”3″ phones=”2″ categories=”90″]
    This shortcode shows the resulting products in owl carousel.
    I am using this shortcode on single product pages and my goal is to exclude the current product from the results like its done with related products. I think that I will have to edit theme-functions.php with something like 'post__not_in' => array($postId) but I dont know exactely where to put this code snippet. I guess its somewhere around line 2610 but I dont get it to work.
    Any help would be really appreciated!
    Many thanks in advance and best wishes!

    7 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    January 6, 2017 at 17:09

    Hello,

    You can use this element in Visual Composer editor http://storage6.static.itmages.com/i/17/0106/h_1483718915_6330632_4f6fe2f642.jpeg and write product IDs in the settings which you want to display.

    Regards,
    Eva Kemp.

    Avatar: Royalty
    Royalty
    Participant
    January 6, 2017 at 17:13

    Hello Eva,
    thank you but that doesnt solve my problem. I want to automatically show all products with a specific tag on single product pages but exclude the current product. An alternative solution would be to reorder the results and always show the current product as first slide, but I think this would be even more complicated…

    Avatar: Eva
    Eva Kemp
    Support staff
    January 6, 2017 at 17:28

    Hello,

    In this case we recommend you to contact our customization service https://www.8theme.com/customization-services/ and our developers will help you to customize the file.

    Regards,
    Eva Kemp.

    Avatar: Royalty
    Royalty
    Participant
    January 6, 2017 at 17:35

    Hm, I really dont think its a big thing, in line 2609 of theme-functions.php there is this code:

    if(!function_exists('etheme_create_slider')) {
        function etheme_create_slider($args, $slider_args = array()){//, $title = false, $shop_link = true, $slider_type = false, $items = '[[0, 1], [479,2], [619,2], [768,4],  [1200, 4], [1600, 4]]', $style = 'default'
            global $wpdb, $woocommerce_loop;
            
            $product_per_row = etheme_get_option('prodcuts_per_row');
            extract(shortcode_atts(array( 
    	        'title' => false,
    	        'shop_link' => false,
    	        'slider_type' => false,
    	        'items' => '[[0, 1], [479,2], [619,2], [768,4],  [1200, 4], [1600, 4]]',
    	        'style' => 'default',
    	        'block_id' => false
    	    ), $slider_args));

    and I just need to know how to add
    'post__not_in' => array($postId) to the query arguments. Dont you think you can help me with this?

    Avatar: Eva
    Eva Kemp
    Support staff
    January 11, 2017 at 10:16

    Hello,

    Sorry for a delay. You need edit the file framework/shortcodes.php and search for the function
    etheme_products_shortcodes, you’ll see this array http://prnt.sc/du5k6j . You’ll need to add your code 'post__not_in' => array($postId) there http://prnt.sc/du5kco .
    Please make all changes in the child theme.

    Regards,
    Eva Kemp.

    Avatar: Royalty
    Royalty
    Participant
    January 13, 2017 at 11:52

    Great, that works, thank you very much!
    Anyway, I am looking for an alternative solution now: Instead of hiding the current product, I would like to have the current product always as first item in the slider. Is this possible?
    Many thanks in advance!

    Avatar: Eva
    Eva Kemp
    Support staff
    January 16, 2017 at 13:02

    Hello,

    Sorry, but such feature isn’t available.

    Regards,
    Eva Kemp.

  • Viewing 8 results - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.