Before you ask please READ THIS

Problem with displaying products galery bricks in accordion / changing amout of similar Works

tb1tb1
in Rife Posts: 5
I have two problems with my New page created based on your Rife Theme. I hope that you can help me solved that problems.

1) From some reason products galery is not working in „Advanced Tabs” (part of Essential Addons for Elementor plugin). I used shortcodes to put the gallery in tabs. Screenshot attached
In elementor preview mode everything is ok - when I click another tab another gallery is loading without any problem, but when I check saved changes "live" I can see the gallery only in the first active tab. Link to the test page: http://ankotech.tododesign.eu/nasza-oferta/binar/. What can you do to display all galleries in all tabs?

2) Is it possible to change the number of randomly related products displayed on the product description page? On my website, several products are assigned to the product category, in the "related products" section in all products only the first four products assigned to a given category are alternately displayed. Is it possible to include and display alternately all products assigned to a given category in the "related products" section?

I will be grateful for your help.

Thank you.

T.B


Comments

  • AirAir
    Posts: 10,970
    Hey there:-)

    1) It seems to be working fine for me. Please try to refresh the cache in your browser, or check your website in the private mode. Maybe you are using some cache plugin?

    2) For now, you could use this code, and add it to functions.php in the child theme, as explained here https://rifetheme.com/help/docs/modifications-of-theme/changing-theme-functions/
    /**
     * WooCommerce Extra Feature
     * --------------------------
     *
     * Change number of related products on product page
     * Set your own value for 'posts_per_page'
     *
     */
    function woocommerce_output_related_products() {
        global $apollo13framework_a13;
    
        if( $apollo13framework_a13->get_option( 'product_related_products' ) === 'off' ){
            return;
        }
    
        $args = array(
            'posts_per_page' => 6,
            'columns'        => 3,
        );
        woocommerce_related_products( $args );
    }
    Edit part 'posts_per_page' => 6, and 'columns' => 3,

    If you will change number of columns, then styling can be not the best. I believe I will have to add an option for that in the theme, instead of this custom code solution.

    With kind regards.
  • tb1tb1
    Posts: 5
    Hello,
    Thank you for your replay.

    1) Because I had to show progress to my client, I have modified that page using other plugin. This problem still exist. You can find that here: http://ankotech.tododesign.eu/binar-test/ . This time I won't remove that example! Propably jquery loading of the gallery causes this error. I am not sure.

    2) When I was writing about products I was thinking about works :/ I used "works" for displaying products. Sorry! I found some functions in "cpt-works.php" and "scripts.js" but I am not sure which line should be changed.
    What I want to do, is to change amount of related posts but not per page. Three related products per page are fine. I am wondering if it is possible to show alternately / randomly all products from a given sub-category/category.
    For example: at the moment, on the single work page I can see randomly only four works from category/sub-category . Would be good to see randomly all works from related sub-category .
    Also is it possible to show "related works" only from the selected subcategory?


    Thanks.

    Kind Regards,
    Tomasz Banach
  • AirAir
    Posts: 10,970
    Hey :-)
    tb1 said: 1) ... Probably jquery loading of the gallery causes this error. I am not sure.
    It is happening because script for bricks tries to position all bricks however they have "zero" size when they are hidden. If you will switch to different tab for example "
    QLA - podwieszane" and resize the browser window, they will show up.
    I think the best solution would be to either trigger re-layout on bricks on the tab change,
    or the whole window resize.
    However, for that, you will need some kind of event that will trigger on tab change, and I don't know this code of "Advanced Tabs" and cause of that is hard to say if there is anything like that there.
    Anyway, such an issue will happen in any container that is hidden on load with display: none;

    tb1 said: Also is it possible to show "related works" only from the selected subcategory?
    It is how they should work. Could you show me example where it work different for you?
    tb1 said: I am wondering if it is possible to show alternately / randomly all products from a given sub-category/category.
    Go to rife/advance/utilities/cpt-work.php line ~628
    and change: 'posts_per_page' => 3, to 'posts_per_page' => 0,.
    Don't worry that it is named "per_page".

    WIth kind regards.
  • tb1tb1
    Posts: 5
    Hello,
    Thank yopu for your replay
    1) Unfortunately, I had to use another add-on to show individual work / product galleries. I tested your gallery shortcode on other tabs and it's always the same.

    2) Please check that page: http://ankotech.tododesign.eu/produkt/quick-lift-arm-50i/.
    As you suggested I changed file cpt-work.php. On that page, below in “Pokrewne produkty (related works)” section you can see 10 last added works/products not from selected category but from the parent category.
    I would like to show on that section max. three works form selected subcategory – randomly. At the moment on every work page in related works section you can see last 4 added works form given parent category.

    Thanks.

    Kind Regards,
    Tomasz Banach
  • AirAir
    Posts: 10,970
    tb1 said: tested your gallery shortcode on other tabs and it's always the same.
    Yes, I have explained why this happens.
    I can see that this widget that you have used is reacting to some kind of event, otherwise, it would suffer for the exact same reason. I will inspect it, and check if I can improve it.
    tb1 said: I would like to show on that section max. three works form selected subcategory – randomly. At the moment on every work page in related works section you can see last 4 added works form given parent category.
    This happens because this work has two categories added: parent category and sub-category. If you will remove the parent category from its categories list you should see what you want.
    If 2 categories are added to the work, WordPress can not know by which it should search related works and it will use both in unspecfied order.

    With kind regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion