Exacetly the same bug here. I disabled all plugins except woocommerce and made a fresh and untouched install of royal version 2.9. the cart widget always shows the opened cart popup.
Exacetly the same bug here. I disabled all plugins except woocommerce and made a fresh and untouched install of royal version 2.9. the cart widget always shows the opened cart popup.
Ah ok I didnt see the second part! Thank you very much! Could you please delete the link to my testpage and the screenshot? Thank you and have a nice weekend!
Ok, please find them in private content. Thank you.
Even if I add
$first_slide_class = ( $_i === 1 ) ? 'your-first-slide-class' : '';
directly to theme-functions, it has no effect.
Thank you, I did what you said, but the change has no effect, it doesnt add the class.
Here is the code that I added to my childtheme’s functions.php
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));
$box_id = rand(1000,10000);
$multislides = new WP_Query( $args );
$shop_url = get_permalink(woocommerce_get_page_id('shop'));
$class = $container_class = $title_output = '';
if(!$slider_type) {
$woocommerce_loop['lazy-load'] = true;
$woocommerce_loop['style'] = $style;
}
if(!$slider_type) {
$container_class = '';
$class .= 'owl-carousel';
} elseif($slider_type == 'swiper') {
$container_class = 'et-swiper-container';
$class .= 'swiper-wrapper';
}
if ( $multislides->have_posts() ) :
if ($title) {
$title_output = '<h2 class="title"><span>'.$title.'</span></h2>';
}
echo '<div class="carousel-area '.$container_class.' slider-'.$box_id.'">';
echo $title_output;
echo '<div class="'.$class.' productCarousel">';
$_i=0;
if($block_id && $block_id != '' && et_get_block($block_id) != '') {
echo '<div class="slide-item '.$slider_type.'-slide">';
echo et_get_block($block_id);
echo '</div><!-- slide-item -->';
}
while ($multislides->have_posts()) : $multislides->the_post();
$_i++;
$first_slide_class = ( $_i === 1 ) ? 'your-first-slide-class' : '';
if(class_exists('Woocommerce')) {
global $product;
if (!$product->is_visible()) continue;
echo '<div class="slide-item product-slide '.$slider_type.'-slide">';
woocommerce_get_template_part( 'content', 'product-slider' );
echo '</div><!-- slide-item -->';
}
endwhile;
echo '</div><!-- products-slider -->';
echo '</div><!-- slider-container -->';
endif;
wp_reset_query();
unset($woocommerce_loop['lazy-load']);
unset($woocommerce_loop['style']);
if($items != '[[0, 1], [479,2], [619,2], [768,4], [1200, 4], [1600, 4]]') {
$items = '[[0, '.$items['phones'].'], [479,'.$items['tablet'].'], [619,'.$items['tablet'].'], [768,'.$items['tablet'].'], [1200, '.$items['notebook'].'], [1600, '.$items['desktop'].']]';
}
if(!$slider_type) {
echo '
<script type="text/javascript">
jQuery(".slider-'.$box_id.' .productCarousel").owlCarousel({
items:4,
lazyLoad : true,
navigation: true,
navigationText:false,
rewindNav: false,
itemsCustom: '.$items.'
});
</script>
';
} elseif($slider_type == 'swiper') {
echo '
<script type="text/javascript">
if(jQuery(window).width() > 767) {
jQuery(".slider-'.$box_id.'").etFullWidth();
var mySwiper'.$box_id.' = new Swiper(".slider-'.$box_id.'",{
keyboardControl: true,
centeredSlides: true,
calculateHeight : true,
slidesPerView: "auto",
mode: "horizontal"
})
} else {
var mySwiper'.$box_id.' = new Swiper(".slider-'.$box_id.'",{
calculateHeight : true
})
}
jQuery(function($){
$(".slider-'.$box_id.' .slide-item").click(function(){
mySwiper'.$box_id.'.swipeTo($(this).index());
$(".lookbook-index").removeClass("active");
$(this).addClass("active");
});
$(".slider-'.$box_id.' .slide-item a").click(function(e){
if($(this).parents(".swiper-slide-active").length < 1) {
e.preventDefault();
}
});
}, jQuery);
</script>
';
}
}
I just need to understand why this part results in these weird classes
// Store loop count we're currently on
if ( empty( $woocommerce_loop['loop'] ) )
$woocommerce_loop['loop'] = 0;
// Store column count for displaying the grid
if ( empty( $woocommerce_loop['columns'] ) )
$woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );
// Ensure visibility
if ( ! $product || ! $product->is_visible() )
return;
// Increase loop count
$woocommerce_loop['loop']++;
// Extra post classes
$classes = '';
if ( 0 == ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns'] )
$classes .= 'first ';
if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] )
$classes .= 'last ';
I just want the first item in the slider to be marked with “first” or something else, thats all.
Or do you mean that I should use the ids that are automatically generated like slider-8637?
Thats no solution as I need these sliders on every product page…
Where can I set the slider id? I dont find this option in the slider-settings…
No, it’s very confusing.
If I add the shortcode [etheme_products] to a page, classes are set like this:
1. Item class FIRST
2. Item
3. Item
4. Item class LAST
5. Item class FIRST
[…]
But if I add the same shortcode on product description field of a product, the classes are set like this:
1. Item
2. Item
3. Item class LAST
4. Item class FIRST
5. Item
[…]
When I add two shortcodes like [etheme_products][etheme_products], the first slider has the classes set like my second example and the second slider has the classes set like the first example.
I really don’t get it, its totally confusing. I would like to ignore all of these confusing classes and just find a way to style the first item of the slider, but I dont know how. :first-child doesnt work here…
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!
Thank you, but I don’t want to use grid, I want to use slider…
Ok sorry its me again,
also in content-product-slider.php there is this part that says that there should be 4 columns:
// Store column count for displaying the grid
if ( empty( $woocommerce_loop['columns'] ) )
$woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );
What is this code for and how can I edit it in order to set the colums dynamically?
I think I found the part that causes the problem:
In content-product-slider.php there is this part:
// Extra post classes
$classes = '';
if ( 0 == ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 == $woocommerce_loop['columns'] )
$classes .= 'first ';
if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] )
$classes .= 'last ';
When I edit it to the following, it seems to work but I dont know if this is a proper solution or if this will cause any problems…?
// Extra post classes
$classes = '';
if ( 0 == ( $woocommerce_loop['loop'] - 1 ) )
$classes .= 'first ';
if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] )
$classes .= 'last ';
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?
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…
Works perfect, thank you very much!
Yes I know but I dont want to add to many template files into my childtheme. I always prefer to use functions.php of my childtheme for modifications. So, isn’t there a way to achieve this via functions.php?
Thank you very much for your soon reply! Is it possible to modify this code to use it in functions.php instead?
Ok I could solve it. It’s too complicated to explain in detail but it had something to do with YOAST seo plugin and breadcrumbs (your modification in etheme grabs the product title from a part in breadcrumbs and not just from the product-title, that makes it a bit complicated when using custom breadcrumbs). Sorry that I thought it was not fixed!
Ok, I have an idea what could cause the problem. I will check and let you know.
Hello Eva,
the screenshot Jack posted (and now deleted – thank you) was taken from my official page, where I still have version 2.7.3 enabled. I uploaded the new version 2.8. to a test environment. Before I give you FTP credentials, let me tell you what I changed to make it work:
In etheme.js line 1470, there is:
if ($('.product_title').first().text()) {
productName = $('.product_title').first().text();
} else {
productName = $('h1.title').first().text();
}
and I changed the code to:
if ($('.meta-title span').first().text()) {
productName = $('.meta-title span').first().text();
} else {
productName = $('h1.title').first().text();
}
Is it possible that the problem was only fixed for simple products? I have only variable products so I can not check it but maybe you can..
Its definetly not fixed, it only works because I edited etheme.js! Please delete the screenshot of my page!
It’s still not fixed in version 2.8. Why??
Ok thank you!
Thanks. I know that I can customize the theme using my childtheme. I just wanted to know if the specific change I made (adding the “products” class to the string in loop-start.php) could cause any problems?
Forget it, I made a little mistake – it works 🙂
The changelog of verison 2.7.3 says that this is fixed, but I just updated and the bug is still there :/
Hello,
just found your answer now. I dont get any notification emails although i’ve checked to get noticed…anyway – I really dont get it. Now I deactivated all plugins, cleared the cache, reactivated them and now it works. I did this at least 5 times before without luck. Strange. I will keep an eye on this and will come back to you as if this problem happens again..
Ok thank you! Looking forward for the fix!
I use latest version of everything. All plugins and theme. I reuploaded the whole themefolder. Maybe the problem only exists for variable products. Woocommerce came up with the greyed out add to cart button just recently. Could you please check with a variable product?
Many thanks!