Changeset 2240642
- Timestamp:
- 02/07/2020 06:19:41 PM (6 years ago)
- Location:
- variation-image-color-switcher-for-woocommerce/trunk
- Files:
-
- 2 edited
-
init/init.php (modified) (3 diffs)
-
variation-image-color-switcher for woocommerce.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
variation-image-color-switcher-for-woocommerce/trunk/init/init.php
r2240438 r2240642 15 15 function lg_variation_to_image($html, $args) { 16 16 global $ld_switch; 17 $images = array(); 17 18 $args = wp_parse_args(apply_filters('woocommerce_dropdown_variation_attribute_options_args', $args), array( 18 19 'options' => false, … … 55 56 $lg_variations = $lg_product->get_available_variations(); 56 57 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']; 58 60 } 61 $cnt = 0; 59 62 foreach($terms as $term) { 60 63 if(in_array($term->slug, $options, true)) { 61 64 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>'; 65 68 } 66 69 }else{ … … 68 71 } 69 72 } 73 $cnt++; 70 74 } 71 75 } -
variation-image-color-switcher-for-woocommerce/trunk/variation-image-color-switcher for woocommerce.php
r2240438 r2240642 5 5 * Author: lakshman rajput 6 6 * Author URI: https://www.logicdigger.com/ 7 * Version: 1.0. 07 * Version: 1.0.1 8 8 * License: GPL2+ 9 9 * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
Note: See TracChangeset
for help on using the changeset viewer.