Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #450596

    How do I access the Single Product Page for woocommerce? I think this is created automatically, but for some reason, the sidebar is pushed under the product instead of being to the right.

    See this example product.

    Thanks.

    #450752

    Hey jenki!

    The product sidebar will display on the left beneath the product images. If you want a right sidebar then try this out, http://kriesi.at/documentation/enfold/product-page-left-or-right-sidebar/.

    Regards,
    Elliott

    #451716

    Thank you for pointing the post out.

    However, I get an error when I add the functions suggested in the post:

    Fatal error: Cannot redeclare avia_add_image_div() (previously declared in /home4/bellussi/public_html/wp-content/themes/enfold/config-woocommerce/config.php:1046)

    #451940

    Hey!

    Unfortunately, that modification is no longer working. It presents too much layout complications. Try to add this to the functions.php:

    #
    # wrap single product image in an extra div
    #
    
    function avia_add_image_div() {
     echo "<div class='single-product-main-image alpha'>";
    }
    
    function avia_close_image_div() {
     echo "</div>";
    }
    
    #
    # wrap single product summary in an extra div
    #
    
    function avia_add_summary_div() {
     echo "<div class='single-product-summary'>";
    }
    
    function avia_close_summary_div() {
     echo "</div>"; //close out the summary
     get_sidebar();
    }
    
    function avf_product_sidebar_layout_mod($layout){
     if( is_single() )$layout = "sidebar_left";
     return $layout;
    }
    
    add_action('init', 'ava_product_sidebar_mod');
    function ava_product_sidebar_mod() {
     add_action( 'woocommerce_before_single_product_summary', 'avia_add_image_div', 2 );
     add_action( 'woocommerce_before_single_product_summary', 'avia_close_image_div', 20 );
     add_action( 'woocommerce_before_single_product_summary', 'avia_add_summary_div', 25 );
     add_action( 'woocommerce_after_single_product_summary', 'avia_close_summary_div', 3 );
     add_filter( 'avf_product_sidebar_layout', 'avf_product_sidebar_layout_mod', 5);
    }

    Edit config-woocommerce > config.php file, look for this code:

    $sidebar_setting = avia_layout_class( 'main' , false );
    

    Replace it with:

    $sidebar_setting = apply_filters( 'avf_product_sidebar_layout', avia_layout_class( 'main' , false ) );
    

    After that, add this in the Quick CSS field.

    .single-product .product {
    width: 68%;
    margin-left: 4%;
    clear: none;
    float: right;
    }

    The sidebar should switch to the left.

    Cheers!
    Ismael

    #451980

    hi Ismael,

    thanks for the reply. Unfortunately, I get the exact same error. The error of course refers to the avia_add_image_div() function in config.php of config-woocommerce. I don’t see how the changes to $sidebar_settings as you suggested modifies this declaration.

    Let me know.

    PS. I actually want to put the sidebar on the right side of the single product page. However, right now I just want the sidebar issue to work without errors first. :-)

    #452197

    Hey!

    Did you copy the code right from your email? Please compare it to the code above, see the difference. If I am not mistaken, you’ll see the single quote and quotes symbols converted to something else. The code works fine on our installation. If you want a right sidebar, just change this line:

    .single-product .product {
    width: 68%;
    margin-left: 4%;
    clear: none;
    float: right;
    }

    to this:

    .single-product .product {
    width: 68%;
    margin-right: 4%;
    clear: none;
    float: left;
    }

    And this code:

    function avf_product_sidebar_layout_mod($layout){
     if( is_single() )$layout = "sidebar_left";
     return $layout;
    }

    to this:

    function avf_product_sidebar_layout_mod($layout){
     if( is_single() )$layout = "sidebar_right";
     return $layout;
    }

    Regards,
    Ismael

    #452240
    This reply has been marked as private.
    #452507

    Solved. Works.

    Let me explain if someone wants to do the same:

    I was using pluginception to create a custom plugin so I can manage my custom code. I’m not sure if this was the right way or not, but I prefer this to editing functions.php.

    So I switched to Code Snippets which is really good actually. I added the code snippet to that and set it for fronted only. Solved everything.

    Thanks.

    #452516

    Last question which may interest some people:

    I see the sidebar added is the widget called “Sidebar Pages” but this a sidebar I already use for non-commerce pages specifically.

    I see there is already a sidebar called “Single Product Pages” and I prefer to use that one so I can personalise the sidebar elements I use for single products only.

    Thanks.

    #453604

    Hey!

    Hello,

    if you want to chnge the sidebar that will be displayed, you can use a sidebar conditional plugin, to select which sidebar will be visible to which page.

    Is that solving your issue?

    Best regards,
    Basilis

    #453705

    Not at all Basilis.

    If you follow the thread, you will see that the sidebar was move to the right of the single product page fro under it.

    Before when it was under the product image (I think a bug as there are many posts about it) the sidebar was defined as Single Product Page widget, correct? And it worked fine.

    the code by Ismael above fixes the sidebar and moves it right but it also changes the sidebar from Single Product Page to Sidebar Page.

    The question is: how can the code by Ismael be changed so that the correct default sidebar is used, Single Product Page?

    Thanks

    • This reply was modified 9 years, 5 months ago by jenki. Reason: Fixed bold css
    #455444

    Hey!

    The sidebar.php file checks what page is currently being viewed then serve the sidebar accordingly. Look for this line:

    function avia_close_summary_div() {
     echo "</div>"; //close out the summary
     get_sidebar();
    }

    Replace it with:

    function avia_close_summary_div() {
            global $avia_config;
            echo "</div>"; //close out the summary	
            $avia_config['currently_viewing'] = "shop_single";
    	get_sidebar();	
    }

    Cheers!
    Ismael

    • This reply was modified 9 years, 5 months ago by Ismael.
    #458730

    Perfect! Solved.

    Thanks

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Single Product Page is strange: sidebar appears UNDER product’ is closed to new replies.