Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • @rajat-dutt of you follow the link I provided, you can see the file that is intended to fix this. Save the original file in the Woocommerce directory (the full path is shown in fit), and replace it with the one at the link. You’ll need ftp or shell access to your back end.

    Worse case, this issue really isn’t that serious and it seems Woocommerce will be fixing it shortly.

    There is no plugin that I know of that fixes this.

    Woocommerce has a fix for this coming out (I think they intend to release it) that is available here.

    https://github.com/woocommerce/woocommerce/pull/22925/files

    I have no idea if it has been tested or not, but hopefully this helps you reduce your warnings and errors. I have deployed it on my site and I am awaiting a re-validation from google search console.

    • This reply was modified 5 years, 1 month ago by philrushworth. Reason: Formatting and clarity
    Thread Starter philrushworth

    (@philrushworth)

    I think I have found the code that controls this category display loop. Here it is:

    <?php
    
    global $mk_options;
    $path = pathinfo(__FILE__) ['dirname'];
    
    include ($path . '/config.php');
    
    $html = file_get_contents($path . '/template.php');
    $html = phpQuery::newDocument($html);
    $id = Mk_Static_Files::shortcode_id();
    
    $container = pq('.mk-category-loop');
    $container->attr('id', 'mk-category-loop-' . $id);
    $container->addClass($title_hover.'-title-effect');
    $container->addClass($image_hover.'-image-effect');
    $container->addClass($layout_style.'-layout');
    $container->addClass('mk--row');
    $container->addClass($el_class);
    $container->addClass( $visibility );
    
    // Classes for js traversing
    if($layout_style == 'masonry') {
        $container->addClass('js-masonry');
        $container->find('.mk-loop-item')->addClass('js-masonry-item');
    }
    
    $item = $container->find('.mk-loop-item')->remove();
    $grid_width = $mk_options['grid_width'];
    
    /*
    * Converts slugs to term Ids
    *
    */
    if(!function_exists('get_terms_by_slug')) {
        function get_terms_by_slug($slugs, $taxonomy)
        {
            $terms = explode(',', $slugs);
            $term_ids = array();
            foreach ($terms as $term) {
                $term = get_term_by('slug', $term, $taxonomy );
                if ( ! empty( $term->term_id ) ) {
                    $term_ids[] = $term->term_id;
                }
            }
            return $term_ids;
        }
    }
    
    switch ($feed) {
        case 'post':
            $categories = get_categories(array(
                'include' => $specific_categories_post
            ));
    
            break;
    
        case 'portfolio':
            $categories = get_terms('portfolio_category', array(
                'include' => get_terms_by_slug($specific_categories_other, 'portfolio_category')
            ));
            break;
    
        case 'news':
            $categories = get_terms('news_category', array(
                'include' => get_terms_by_slug($specific_categories_other, 'news_category')
            ));
            break;
    
        case 'product':
            $categories = get_terms('product_cat', array(
                'include' => get_terms_by_slug($specific_categories_other, 'product_cat')
            ));
            break;
    }
    
    switch ($columns) {
        case 4:
                $column_class = 'mk--col mk--col--3-12';
                $image_width = round($grid_width/4) - 28;
            break;
        case 3:
                $column_class = 'mk--col mk--col--4-12';
                $image_width = round($grid_width/3) - 33;
            break;
        case 2:
                $column_class = 'mk--col mk--col--1-2';
                $image_width = round($grid_width/2) - 38;
            break;
    
        default:
                $column_class = 'mk--col mk--col--1-2';
                $image_width = round($grid_width/2) - 38;
            break;
    }
    
    foreach ($categories as $category) {
        $each_item = $item->clone();
        $item_holder = $each_item->find('.item-holder');
        $item_caption = $item_holder->find('figcaption');
        if ( empty( $category->term_id ) ) {
            continue;
        }
        $category_link = get_category_link( $category->term_id );
        //$each_item->find('.view-more')->attr('href', '#!'); //TODO : add links once styling is finished
    
        $each_item->addClass($column_class);
    
    	$image_id = false;
        if($feed == 'product') {
            if ( class_exists( 'WooCommerce' ) ) {
                $image_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true );
            }
        } else {
        	$image_id = is_array(get_tax_meta($category->term_id, 'mk_image_field_id')) ? get_tax_meta($category->term_id, 'mk_image_field_id') ['id'] : false;
        }
    
        $image_src = Mk_Image_Resize::resize_by_id($image_id, $image_size, $image_width, $row_height, $crop = true, $dummy = true);
    
        $each_item->find('.item-thumbnail')->attr('src', $image_src);
    
        //Adding html elements according to style
        if($title_hover == 'none' || $title_hover == 'simple' || $title_hover == 'framed') {
            $item_caption->append('<div class="caption"></div>')
                         ->find('.caption')
                         ->append('<div class="centered"></div>')
                         ->find('.centered')
                         ->append('<span class="item-title"></span>')
                         ->find('.item-title')
                         ->html($category->name);
    
            if($description == 'true') {
                if ($category->description) {
                    //$each_item->find('.item-desc')->html($category->description);
                    $item_caption->find('.centered')
                                 ->append('<span class="item-desc"></span>')
                                 ->find('.item-desc')
                                 ->html($category->description);
                }
            }
    
            $item_caption->append('<a class="view-more"></a>')
                        ->find('.view-more')
                        ->attr('href', esc_url( $category_link ) );
    
        }else if ($title_hover == 'modern' || $title_hover == 'editorial') {
            $item_caption->append('<span class="item-title"></span>')
                         ->find('.item-title')
                         ->html($category->name);
    
            if($description == 'true') {
                if ($category->description) {
                    $item_caption->append('<span class="item-desc"></span>')
                                 ->find('.item-desc')
                                 ->html($category->description);
                }
            }
    
            $item_caption->append('<a class="view-more"></a>')
                         ->find('.view-more')
                         ->attr('href', esc_url( $category_link ) );
        }
        $item_caption->append('<div class="item-overlay"></div>');
        $each_item->appendTo($container);
    }
    /**
     * Custom CSS Output
     * ==================================================================================
     */
    
    Mk_Static_Files::addCSS('
        #mk-category-loop-'.$id.' .mk-loop-item {
            padding-left: '.($gutter / 2).'px;
            padding-right: '.($gutter / 2).'px;
            padding-bottom: '.$gutter.'px;
        }
        #mk-category-loop-'.$id.' .mk-loop-item .item-holder .item-title,
        #mk-category-loop-'.$id.' .mk-loop-item .item-holder .item-desc{
            color: '.$text_color.';
        }
        #mk-category-loop-'.$id.' .mk-loop-item .item-holder figcaption .item-overlay {
            background-color: '.$overlay_color.';
        }
    ', $id);
    if ($title_hover == 'editorial' ) {
        Mk_Static_Files::addCSS('
            #mk-category-loop-'.$id.' .mk-loop-item .item-holder .item-title::after{
                background-color: '.$text_color.';
            }
        ', $id);
    }else if ($title_hover == 'framed' ) {
        Mk_Static_Files::addCSS('
            #mk-category-loop-'.$id.' .mk-loop-item .item-holder figcaption::before{
                border-color: '.$text_color.';
            }
        ', $id);
    }
    
    // if($image_hover == 'gradient' || $image_hover == 'zoom' || $image_hover == 'slide' || $image_hover == 'blur' ) {
    //     Mk_Static_Files::addCSS('
    //         #mk-category-loop-'.$id.' .mk-loop-item .item-holder {
    //             background-color: '.$overlay_color.';
    //         }
    //     ');
    // }
    
    Thread Starter philrushworth

    (@philrushworth)

    Hi Thanks for the reply! Truly appreciated. I swapped the code as requested and the situation has improved.

    The badge still shows up as expected on the single product page.
    It now shows up on the tea category page (which we don’t actually use)
    http://dev.zhentea.ca/chinese-tea-category/supreme-chinese-tea/

    and it still doesn’t show up on our product page:
    http://dev.zhentea.ca/tea

    That page uses visual composer product loops.

    Thanks for the help!

    Cheers,
    Phil

    I’m experiencing the same issue.

    Wordpress Version 4.7.4
    WooCommerce Version: 3.0.5
    Theme: Jupiter (child theme with minor aethetic changes)
    A tonne of plugins. 🙂

    Here are some screen caps of the config and the cart with no gift.
    https://goo.gl/photos/tH4iivErwZVPVSpt5

    I am getting the following errors from wp_debug:

    https://drive.google.com/open?id=0B8NGMEilSw38M3pxazYxU0lUb1k

    If you could get me pointed in the right direction, I would appreciate it. I’m hoping to hack this into shape. Sounds like an

    Cheers,
    Phil

    Same issue here. Would love if a solution came up. I installed the plugin and tested it with some small files in Chrome. Worked like a charm. My friend tried it and told me of an error he was getting:

    “Internet Explorer cannot display the webpage”

    (IE… grrr).

    Any info on how to coerce this plugin to work in IE would be swell…

Viewing 6 replies - 1 through 6 (of 6 total)