Home › Forums › Basel support forum › Problem with sold label on product
Problem with sold label on product
- This topic has 17 replies, 2 voices, and was last updated 6 years, 10 months ago by Artem Temos.
-
AuthorPosts
-
February 19, 2018 at 10:00 am #40824
coris8ParticipantHi there,
Since the new update I’m having issues with the sold label on product pages as it doesn’t appear anymore on the product image.
can you help?
I have the following code snippets in the custom css, but even if i delete it, it still doesn’t work:
.onsale, .out-of-stock-label {
border-radius:0;
width:auto;
height: auto;
line-height: 1;
padding: 10px 10px;
}.product-images .out-of-stock-label {
z-index: 10;
right:15px;
left:auto;
}I attach you a link of a sold out item.
Many thanks in advance
BestFebruary 19, 2018 at 10:59 am #40835
Artem TemosKeymasterHi,
Seems that something overrides this functionality. Maybe it is caused by some of the installed plugins or by some custom coding in the child theme.
Regards
February 19, 2018 at 11:16 am #40842
coris8ParticipantHi, it’s not related to the child theme, since when I activate the parent theme, the problem is even worse… on the child theme I have the word “sold out” showing above the product image, on the parent theme there is nothing.
Can you help?February 19, 2018 at 12:27 pm #40853
Artem TemosKeymasterIn this case, please, deactivate all plugins that are not related to our theme and the child theme and provide us your admin access so we can check it.
February 19, 2018 at 1:11 pm #40897
coris8ParticipantHi,
Here what i did:
– I did deactivate one by one all the non theme related plugin – and clear the cache – to check if it would fix the bug, but nothing works… I suspect a bug with woocommerce
– I did some customization on single-product woocommerce files on my child theme. So I’v tried to remove the files, but the bug is still there and by doing so I loose the text “sold out” above the product image.
Many thanks in advance for your helpFebruary 19, 2018 at 2:09 pm #40925
Artem TemosKeymasterSo could you disable plugins now so we can check what is wrong?
February 19, 2018 at 2:21 pm #40934
coris8Participantok done. let me know once you’v check that I can reactivate them
February 19, 2018 at 2:30 pm #40947
Artem TemosKeymasterCould you please send us your FTP access as well?
February 19, 2018 at 2:40 pm #40956
coris8Participantok!
can I reactivate the plugins?February 19, 2018 at 2:46 pm #40958
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to do this
function basel_product_label() { global $product; $output = array(); $product_attributes = basel_get_product_attributes_label(); if ( $product->is_on_sale() ) { $percentage = ''; if ( $product->get_type() == 'variable' ) { $available_variations = $product->get_variation_prices(); $max_percentage = 0; foreach( $available_variations['regular_price'] as $key => $regular_price ) { $sale_price = $available_variations['sale_price'][$key]; if ( $sale_price < $regular_price ) { $percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 ); if ( $percentage > $max_percentage ) { $max_percentage = $percentage; } } } $percentage = $max_percentage; } elseif ( $product->get_type() == 'simple' || $product->get_type() == 'external' ) { $percentage = round( ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100 ); } if ( $percentage && basel_get_opt( 'percentage_label' ) ) { $output[] = '<span class="onsale product-label">-' . $percentage . '%' . '</span>'; }else{ $output[] = '<span class="onsale product-label">' . esc_html__( 'Sale', 'basel' ) . '</span>'; } } if( !$product->is_in_stock() ){ $output[] = '<span class="out-of-stock product-label">' . esc_html__( 'Sold out', 'basel' ) . '</span>'; } if ( $product->is_featured() && basel_get_opt( 'hot_label' ) ) { $output[] = '<span class="featured product-label">' . esc_html__( 'Hot', 'basel' ) . '</span>'; } if ( get_post_meta( get_the_ID(), '_basel_new_label', true ) && basel_get_opt( 'new_label' ) ) { $output[] = '<span class="new product-label">' . esc_html__( 'New', 'basel' ) . '</span>'; } if ( $product_attributes ) { foreach ( $product_attributes as $attribute ) { $output[] = $attribute; } } if ( $output ) { echo '<div class="product-labels labels-' . basel_get_opt( 'label_shape' ) . '">' . implode( '', $output ) . '</div>'; } }
and deactivate the child theme as well.
February 19, 2018 at 2:56 pm #40964
coris8ParticipantOk I did paste the code snippet into my child theme function.php, then deactivate the child theme and activate the parent theme. Still doesn’t work and the plugins are still deactivated…
February 19, 2018 at 3:03 pm #40965
Artem TemosKeymasterSorry, you need to continue using the child theme but remove the file
basel-child/woocommerce/single-product/sale-flash.php
.February 19, 2018 at 3:03 pm #40967
coris8ParticipantI must say that this theme update was quite catastrophic, it modified my menu and deleted my footer… Maybe the downloaded file was corrupted?
February 19, 2018 at 3:05 pm #40970
Artem TemosKeymasterTheme updates can’t change any content like menu or footer. Such problems may appear when you switch between themes in Appearance -> Themes.
February 19, 2018 at 3:08 pm #40972
coris8ParticipantYeah it works now, but it’s weird looking.
https://www.kissthedesign.ch/en/product/jean-prouve-grand-repos-tecta/
how can we do it look like the normal label (white text on black tag)?February 19, 2018 at 3:15 pm #40975
Artem TemosKeymasterTry to add the following code snippet to the Custom CSS area in Theme Settings to fix this issue.
body .single-product-content .out-of-stock { border: none; color: white; }
February 19, 2018 at 3:25 pm #40978
coris8ParticipantAwesome it works!!!
Thank you for the perfect support šFebruary 19, 2018 at 3:42 pm #40982
Artem TemosKeymasterYou are welcome!
-
AuthorPosts
Tagged: out of stock label
The topic ‘Problem with sold label on product’ is closed to new replies.
- You must be logged in to create new topics. Login / Register