Plugin Directory

Changeset 2240642


Ignore:
Timestamp:
02/07/2020 06:19:41 PM (6 years ago)
Author:
logicdigger
Message:

bug fixed for variation

Location:
variation-image-color-switcher-for-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • variation-image-color-switcher-for-woocommerce/trunk/init/init.php

    r2240438 r2240642  
    1515    function lg_variation_to_image($html, $args) {
    1616    global $ld_switch;
     17    $images = array();
    1718        $args = wp_parse_args(apply_filters('woocommerce_dropdown_variation_attribute_options_args', $args), array(
    1819        'options'          => false,
     
    5556                $lg_variations = $lg_product->get_available_variations();
    5657                foreach ( $lg_variations as $lg_variation ) {
    57                     $images[$lg_variation['attributes'][$name]] =  $lg_variation['image']['thumb_src'];
     58               
     59                    $images[] =  $lg_variation['image']['thumb_src'];
    5860                }
     61                $cnt = 0;
    5962                foreach($terms as $term) {
    6063                    if(in_array($term->slug, $options, true)) {
    6164                        if( in_array($name,$ld_switch['ld-attribute-data'])){
    62                             if(!empty($images[$term->slug])){
    63                                 $ld_label = "<img class='ld-switch-img' src=" .$images[$term->slug].">";
    64                                 $radios .= '<input type="checkbox"  name="'.esc_attr($name).'"  id="lg'.esc_attr($term->slug).'" value="'.esc_attr($term->slug).'" '.checked(sanitize_title($args['selected']), $term->slug, false).'><label for="lg'.esc_attr($term->slug).'" class="color_label">'.$ld_label.'</label>';
     65                            if(!empty($images[$cnt])){
     66                                $ld_label = "<img class='ld-switch-img' src=" .$images[$cnt].">";
     67                                $radios .= '<input type="checkbox"  name="'.esc_attr($name).'" id="lg'.esc_attr($term->slug).'" value="'.esc_attr($term->slug).'" '.checked(sanitize_title($args['selected']), $term->slug, false).'><label for="lg'.esc_attr($term->slug).'" class="color_label" title="'.esc_html(apply_filters('woocommerce_variation_option_name', $term->name)).'" >'.$ld_label.'</label>';
    6568                            }
    6669                            }else{
     
    6871                        }     
    6972                    }
     73                    $cnt++;
    7074                }
    7175            }
  • variation-image-color-switcher-for-woocommerce/trunk/variation-image-color-switcher for woocommerce.php

    r2240438 r2240642  
    55 * Author: lakshman rajput
    66 * Author URI: https://www.logicdigger.com/
    7  * Version: 1.0.0
     7 * Version: 1.0.1
    88 * License: GPL2+
    99 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
Note: See TracChangeset for help on using the changeset viewer.