Tagged: enfold, single product page, woocommerce
-
AuthorPosts
-
September 14, 2014 at 7:17 pm #318904
Hi Guys,
I have a concern about double upsell output on the single item page. I read in the Propulsion Forum where to update the php script of woocommerce but the solution is for another theme and for an older version of WC. So I will post my question here ;)
What should I add to functions.php or any WC php-file to get only one upsell output. I would like to eliminate the output in the single product div and leave the output in alternate div instead if possible.
Thank you for your reply.
Greetings, TobiasSeptember 15, 2014 at 7:40 am #319044Hi TMM010!
Thank you for using Enfold.
By default there should be a single upsells and related products section. Did you modify anything on the theme files?
Best regards,
IsmaelSeptember 15, 2014 at 11:39 am #319117Yes, I removed the output of the related products in the child´s function.php with the following code:
function wc_remove_related_products( $args ) { return array(); } add_filter('woocommerce_related_products_args','wc_remove_related_products', 10);
September 15, 2014 at 2:57 pm #319219I forgot to tell you that I´m using some more code from Yigit in the functions.php to be able to show the categories on the single product page as well, here is the code from the functions.php as it is now:
<?php # # wrap single product image in an extra div # add_action( 'woocommerce_before_single_product_summary', 'avia_add_image_div', 2); add_action( 'woocommerce_before_single_product_summary', 'avia_close_image_div', 20); function avia_add_image_div() { echo "<div class='four units single-product-main-image alpha'>"; } function avia_close_image_div() { global $avia_config; $avia_config['currently_viewing'] = "shop_single"; echo "</div>"; } # # wrap single product summary in an extra div # add_action( 'woocommerce_before_single_product_summary', 'avia_add_summary_div', 25); add_action( 'woocommerce_after_single_product_summary', 'avia_close_summary_div', 3); function avia_add_summary_div() { echo "<div class='five units single-product-summary'>"; } function avia_close_summary_div() { echo "</div>"; //close out the summary echo "<div class='three units single-product-sidebar'>"; get_sidebar(); echo "</div>"; } # end wrap single product image in an extra div # bring Woocommerce card to bottom on Single Product Pages remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 45 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 60 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 70 ); # remove related products on Single Product Pages function wc_remove_related_products( $args ) { return array(); } add_filter('woocommerce_related_products_args','wc_remove_related_products', 10);
There is a second question now watching my single product page. Is it possible to move the tabs-output in an extra container to show it under the rest of the product (image, name, price…) with alignment at the left border of the page with stretching 100% towards the sidebar. I´m thinking about css but php would be more appropriate regarding that the rest of the product-showing is also written in php ;)
Best regards and thank you for your reply,
TobiasSeptember 16, 2014 at 2:45 pm #319887Okay guys I “solved” the problem but only with directly coding into config.php of parent-enfold, I comment out the folliwing passage with the result I wanted but I think there should be an update-secure opportunity too, maybe somebody can help me ;)
/* add_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_display_output_upsells', 30); //display the related products and upsells function avia_woocommerce_display_output_upsells() { global $avia_config; $products = $avia_config['woo_upsells'].$avia_config['woo_related']; if(!empty($products)) { $output = "</div></div></div>"; $output .= '<div id="av_section_1" class="avia-section alternate_color avia-section-small container_wrap fullsize"><div class="container"><div class="template-page content twelve alpha units">'; $output .= $products; echo $output; } } */
September 19, 2014 at 12:54 pm #321844Hi!
Thank you for the info.
I added the modifications on my own installation and it only change the product layout and remove related products section as expected. It didn’t add another upsells section. Maybe a third party plugin related to WooCommerce is causing the issue. Have you tried to deactivate the plugins?
Cheers!
IsmaelSeptember 20, 2014 at 11:13 pm #322472Hi Ismael,
thank you for the hint which located the double output in James Kosters little plugin WooCommerce Product Details Customiser. The upsell-output was checked and therefore the config.php and the little plugin displayed the upsells. I unchecked the upsells in the plugin and removed the comments in the config.php so everything is fine except that I have to style the alternate div now ;)Do you have a further hint about the extra div for the tabs-content to bring it down under the rest of the single-product output and stretch it 100% under the two (in my case) other product-columns?
Thanks for your help so far!
Cheers,
TobiasSeptember 24, 2014 at 11:50 am #324178Hey!
Edit config-woocommerce > config.php, find this code on line 853:
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 );
Replace it with:
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_output_product_data_tabs', 10 ); add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_output_product_data_tabs', 1 );
Add this on Quick CSS or custom.css:
.related.products .woocommerce-tabs { display: none; }
Best regards,
IsmaelSeptember 24, 2014 at 1:03 pm #324213Hi Ismael,
this code didn´t work because the product tabs div is overlapping the whole page now. I found another solution which is working for me with a data table and custom fields instead. The div is overlapping the whole item-loop div too but it is a solution which I can live with…
The only problem is that the data table div isn´t after the item-loop and the sidebar which will cause problems if the item-div is too high so that the text in the item-loop div and the data-table div might overlap because they both come right after the breadcrumps div… This problems are caused because I´m working with Yigits code which puts the item image, the item-loop and the sidebar in different divs (to show a sidebar on single product pages). I´m thinking about a solution of closing out all divs of the shop-loop and then hook in the data table but the divs are opened in too many files and I would have to comment them out and close them before the function of the data table. Well, I´m going to use my solution now and thank you for your support :)
Regards, Tobias -
AuthorPosts
- The topic ‘Woocommerce Upsells on Product Single Page doubled’ is closed to new replies.