Version Description
- Replace wp.ajax by normal ajax call, fix media upload
- Removing unused function, reformat code
- Update recommended plugins loaded from server
- Added support for radio button in pro
- Added tooltip image support in pro
- Added custom tooltip text support in pro
Download this release
Release Info
Developer | themealien |
Plugin | Variation Swatches for WooCommerce |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- assets/css/frontend.css +18 -2
- assets/css/frontend.scss +17 -0
- assets/js/admin.js +84 -13
- assets/js/frontend.js +16 -0
- includes/class-admin-product.php +9 -0
- includes/class-admin.php +53 -34
- includes/class-frontend.php +33 -1
- includes/class-menu-page.php +11 -6
- includes/class-setting-fields-manager.php +17 -3
- includes/class-variation-swatches.php +4 -0
- readme.txt +11 -3
- templates/admin/partials/panel-sidebar.php +83 -16
- templates/admin/welcome-popup.php +3 -3
- variation-swatches-for-woocommerce.php +4 -4
assets/css/frontend.css
CHANGED
@@ -301,7 +301,7 @@
|
|
301 |
z-index: 2;
|
302 |
color: #fff;
|
303 |
margin: -15px 0 0 0;
|
304 |
-
padding:
|
305 |
text-indent: initial;
|
306 |
font-size: 14px;
|
307 |
font-weight: 500;
|
@@ -313,6 +313,10 @@
|
|
313 |
white-space: normal;
|
314 |
min-width: max-content;
|
315 |
}
|
|
|
|
|
|
|
|
|
316 |
.woocommerce div.product form.cart.variations_form .tawcvs-swatches .swatch__tooltip:after,
|
317 |
.woocommerce.archive form.cart.variations_form .tawcvs-swatches .swatch__tooltip:after,
|
318 |
.woocommerce.single-product form.cart.variations_form .tawcvs-swatches .swatch__tooltip:after {
|
@@ -335,7 +339,8 @@
|
|
335 |
}
|
336 |
.woocommerce div.product form.cart.variations_form .tawcvs-swatches .swatch:hover + .swatch__tooltip,
|
337 |
.woocommerce.archive form.cart.variations_form .tawcvs-swatches .swatch:hover + .swatch__tooltip,
|
338 |
-
.woocommerce.single-product form.cart.variations_form .tawcvs-swatches .swatch:hover + .swatch__tooltip
|
|
|
339 |
opacity: 1;
|
340 |
visibility: visible;
|
341 |
user-select: auto;
|
@@ -433,4 +438,15 @@
|
|
433 |
height: auto;
|
434 |
}
|
435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
/*# sourceMappingURL=frontend.css.map */
|
301 |
z-index: 2;
|
302 |
color: #fff;
|
303 |
margin: -15px 0 0 0;
|
304 |
+
padding: 10px;
|
305 |
text-indent: initial;
|
306 |
font-size: 14px;
|
307 |
font-weight: 500;
|
313 |
white-space: normal;
|
314 |
min-width: max-content;
|
315 |
}
|
316 |
+
.woocommerce.single-product form.cart.variations_form .tawcvs-swatches .swatch-radio .swatch__tooltip {
|
317 |
+
left:20%!important;
|
318 |
+
top:10px;
|
319 |
+
}
|
320 |
.woocommerce div.product form.cart.variations_form .tawcvs-swatches .swatch__tooltip:after,
|
321 |
.woocommerce.archive form.cart.variations_form .tawcvs-swatches .swatch__tooltip:after,
|
322 |
.woocommerce.single-product form.cart.variations_form .tawcvs-swatches .swatch__tooltip:after {
|
339 |
}
|
340 |
.woocommerce div.product form.cart.variations_form .tawcvs-swatches .swatch:hover + .swatch__tooltip,
|
341 |
.woocommerce.archive form.cart.variations_form .tawcvs-swatches .swatch:hover + .swatch__tooltip,
|
342 |
+
.woocommerce.single-product form.cart.variations_form .tawcvs-swatches .swatch:hover + .swatch__tooltip,
|
343 |
+
.woocommerce.single-product form.cart.variations_form .tawcvs-swatches .swatch-label:hover + .swatch__tooltip {
|
344 |
opacity: 1;
|
345 |
visibility: visible;
|
346 |
user-select: auto;
|
438 |
height: auto;
|
439 |
}
|
440 |
|
441 |
+
table.variations {
|
442 |
+
overflow: visible!important;
|
443 |
+
}
|
444 |
+
|
445 |
+
.swatch-radio {
|
446 |
+
width:100%;
|
447 |
+
}
|
448 |
+
.swatch-radio input[type="radio"] {
|
449 |
+
width:auto!important;
|
450 |
+
height:auto!important;
|
451 |
+
}
|
452 |
/*# sourceMappingURL=frontend.css.map */
|
assets/css/frontend.scss
CHANGED
@@ -224,6 +224,11 @@
|
|
224 |
}
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
227 |
.swatch-item-wrapper {
|
228 |
position: relative;
|
229 |
}
|
@@ -354,4 +359,16 @@
|
|
354 |
text-align: center;
|
355 |
}
|
356 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
}
|
224 |
}
|
225 |
}
|
226 |
|
227 |
+
.swatch-radio .swatch__tooltip {
|
228 |
+
left: 10%!important;
|
229 |
+
top:10px;
|
230 |
+
}
|
231 |
+
|
232 |
.swatch-item-wrapper {
|
233 |
position: relative;
|
234 |
}
|
359 |
text-align: center;
|
360 |
}
|
361 |
}
|
362 |
+
}
|
363 |
+
|
364 |
+
table.variations {
|
365 |
+
overflow: visible!important;
|
366 |
+
}
|
367 |
+
|
368 |
+
.swatch-radio {
|
369 |
+
width:100%;
|
370 |
+
}
|
371 |
+
.swatch-radio input[type="radio"] {
|
372 |
+
width:auto!important;
|
373 |
+
height:auto!important;
|
374 |
}
|
assets/js/admin.js
CHANGED
@@ -8,12 +8,69 @@ jQuery(document).ready(function ($) {
|
|
8 |
|
9 |
$('#term-color,#term-secondary-color').wpColorPicker();
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
// Update attribute image
|
12 |
$body.on('click', '.tawcvs-upload-image-button', function (event) {
|
13 |
event.preventDefault();
|
14 |
|
15 |
var $button = $(this);
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
// If the media frame already exists, reopen it.
|
18 |
if (frame) {
|
19 |
frame.open();
|
@@ -33,20 +90,20 @@ jQuery(document).ready(function ($) {
|
|
33 |
frame.on('select', function () {
|
34 |
var attachment = frame.state().get('selection').first().toJSON();
|
35 |
|
36 |
-
$button.siblings('input.tawcvs-term-image').val(attachment.id);
|
37 |
-
$button.siblings('.tawcvs-remove-image-button').show();
|
38 |
-
$button.parent().prev('.tawcvs-term-image-thumbnail').find('img').attr('src', attachment.sizes.thumbnail.url);
|
39 |
});
|
40 |
|
41 |
// Finally, open the modal.
|
42 |
frame.open();
|
43 |
|
44 |
-
}).on('click', '.tawcvs-remove-image-button', function () {
|
45 |
var $button = $(this);
|
46 |
|
47 |
-
$button.siblings('input.tawcvs-term-image').val('');
|
48 |
-
$button.siblings('.tawcvs-remove-image-button').show();
|
49 |
-
$button.parent().prev('.tawcvs-term-image-thumbnail').find('img').attr('src', tawcvs.placeholder);
|
50 |
|
51 |
return false;
|
52 |
});
|
@@ -112,13 +169,19 @@ jQuery(document).ready(function ($) {
|
|
112 |
// Send ajax request
|
113 |
$spinner.addClass('is-active');
|
114 |
$msg.hide();
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
116 |
data: data,
|
117 |
error: function (res) {
|
118 |
$spinner.removeClass('is-active');
|
119 |
$msg.addClass('error').text(res).show();
|
120 |
},
|
121 |
-
success: function (
|
|
|
122 |
$spinner.removeClass('is-active');
|
123 |
$msg.addClass('success').text(res.msg).show();
|
124 |
|
@@ -162,8 +225,11 @@ jQuery(document).ready(function ($) {
|
|
162 |
|
163 |
$('.wcvs-notice').hide();
|
164 |
savingNoticeEle.fadeIn();
|
|
|
165 |
|
166 |
-
|
|
|
|
|
167 |
data: data,
|
168 |
error: function (res) {
|
169 |
savingNoticeEle.hide();
|
@@ -325,7 +391,10 @@ jQuery(document).ready(function ($) {
|
|
325 |
|
326 |
$(this).closest(".ajax-to-update").toggleClass("saving");
|
327 |
|
328 |
-
|
|
|
|
|
|
|
329 |
data: ajaxData,
|
330 |
success: function (response) {
|
331 |
if (response.success) {
|
@@ -386,9 +455,11 @@ jQuery(document).ready(function ($) {
|
|
386 |
//We need to get the response after update the plugin setting
|
387 |
ajaxData.sendResponse = 1;
|
388 |
ajaxData.__nonce = $('[name="__nonce"]').val();
|
389 |
-
|
390 |
//Run the Ajax to update plugin setting
|
391 |
-
|
|
|
|
|
392 |
data: ajaxData,
|
393 |
success: function (response) {
|
394 |
if (response.success) {
|
8 |
|
9 |
$('#term-color,#term-secondary-color').wpColorPicker();
|
10 |
|
11 |
+
// init tooltip fields
|
12 |
+
function init_tooltip_fields() {
|
13 |
+
$('.tooltip-text-wrapper, .tooltip-image-wrapper').hide();
|
14 |
+
|
15 |
+
if ($('#term-show-tooltip').val() == 1) {
|
16 |
+
$('.tooltip-text-wrapper').show();
|
17 |
+
} else if ($('#term-show-tooltip').val() == 2) {
|
18 |
+
$('.tooltip-image-wrapper').show();
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
init_tooltip_fields();
|
23 |
+
|
24 |
+
$('#term-show-tooltip').on('change', function() {
|
25 |
+
init_tooltip_fields();
|
26 |
+
});
|
27 |
+
|
28 |
// Update attribute image
|
29 |
$body.on('click', '.tawcvs-upload-image-button', function (event) {
|
30 |
event.preventDefault();
|
31 |
|
32 |
var $button = $(this);
|
33 |
|
34 |
+
// If the media frame already exists, reopen it.
|
35 |
+
if (!frame) {
|
36 |
+
// Create the media frame.
|
37 |
+
frame = wp.media.frames.downloadable_file = wp.media({
|
38 |
+
title: tawcvs.i18n.mediaTitle,
|
39 |
+
button: {
|
40 |
+
text: tawcvs.i18n.mediaButton
|
41 |
+
},
|
42 |
+
multiple: false
|
43 |
+
});
|
44 |
+
}
|
45 |
+
|
46 |
+
// When an image is selected, run a callback.
|
47 |
+
frame.on('select', function () {
|
48 |
+
var attachment = frame.state().get('selection').first().toJSON();
|
49 |
+
|
50 |
+
$button.siblings('input.tawcvs-term-image').val(attachment.id);
|
51 |
+
$button.siblings('.tawcvs-remove-image-button').show();
|
52 |
+
$button.parent().prev('.tawcvs-term-image-thumbnail').find('img').attr('src', attachment.sizes.thumbnail.url);
|
53 |
+
});
|
54 |
+
|
55 |
+
// Finally, open the modal.
|
56 |
+
frame.open();
|
57 |
+
|
58 |
+
}).on('click', '.tawcvs-remove-image-button', function () {
|
59 |
+
var $button = $(this);
|
60 |
+
|
61 |
+
$button.siblings('input.tawcvs-term-image').val('');
|
62 |
+
$button.siblings('.tawcvs-remove-image-button').show();
|
63 |
+
$button.parent().prev('.tawcvs-term-image-thumbnail').find('img').attr('src', tawcvs.placeholder);
|
64 |
+
|
65 |
+
return false;
|
66 |
+
});
|
67 |
+
|
68 |
+
// Update attribute image for tooltip
|
69 |
+
$body.on('click', '.tawcvs-upload-image-tooltip-button', function (event) {
|
70 |
+
event.preventDefault();
|
71 |
+
|
72 |
+
var $button = $(this);
|
73 |
+
|
74 |
// If the media frame already exists, reopen it.
|
75 |
if (frame) {
|
76 |
frame.open();
|
90 |
frame.on('select', function () {
|
91 |
var attachment = frame.state().get('selection').first().toJSON();
|
92 |
|
93 |
+
$button.siblings('input.tawcvs-term-image-tooltip').val(attachment.id);
|
94 |
+
$button.siblings('.tawcvs-remove-image-tooltip-button').show();
|
95 |
+
$button.parent().prev('.tawcvs-term-image-tooltip-thumbnail').find('img').attr('src', attachment.sizes.thumbnail.url);
|
96 |
});
|
97 |
|
98 |
// Finally, open the modal.
|
99 |
frame.open();
|
100 |
|
101 |
+
}).on('click', '.tawcvs-remove-image-tooltip-button', function () {
|
102 |
var $button = $(this);
|
103 |
|
104 |
+
$button.siblings('input.tawcvs-term-image-tooltip').val('');
|
105 |
+
$button.siblings('.tawcvs-remove-image-tooltip-button').show();
|
106 |
+
$button.parent().prev('.tawcvs-term-image-tooltip-thumbnail').find('img').attr('src', tawcvs.placeholder);
|
107 |
|
108 |
return false;
|
109 |
});
|
169 |
// Send ajax request
|
170 |
$spinner.addClass('is-active');
|
171 |
$msg.hide();
|
172 |
+
|
173 |
+
data["action"] = "tawcvs_add_new_attribute";
|
174 |
+
|
175 |
+
$.ajax({
|
176 |
+
url: tawcvs.ajaxUrl,
|
177 |
+
type: 'post',
|
178 |
data: data,
|
179 |
error: function (res) {
|
180 |
$spinner.removeClass('is-active');
|
181 |
$msg.addClass('error').text(res).show();
|
182 |
},
|
183 |
+
success: function (response) {
|
184 |
+
var res = response.data;
|
185 |
$spinner.removeClass('is-active');
|
186 |
$msg.addClass('success').text(res.msg).show();
|
187 |
|
225 |
|
226 |
$('.wcvs-notice').hide();
|
227 |
savingNoticeEle.fadeIn();
|
228 |
+
data["action"] = "tawcvs_save_settings";
|
229 |
|
230 |
+
$.ajax({
|
231 |
+
url: tawcvs.ajaxUrl,
|
232 |
+
type: 'post',
|
233 |
data: data,
|
234 |
error: function (res) {
|
235 |
savingNoticeEle.hide();
|
391 |
|
392 |
$(this).closest(".ajax-to-update").toggleClass("saving");
|
393 |
|
394 |
+
ajaxData["action"] = "update_product_attr_type";
|
395 |
+
$.ajax({
|
396 |
+
url: tawcvs.ajaxUrl,
|
397 |
+
type: 'post',
|
398 |
data: ajaxData,
|
399 |
success: function (response) {
|
400 |
if (response.success) {
|
455 |
//We need to get the response after update the plugin setting
|
456 |
ajaxData.sendResponse = 1;
|
457 |
ajaxData.__nonce = $('[name="__nonce"]').val();
|
458 |
+
ajaxData.action = "update_attribute_type_setting";
|
459 |
//Run the Ajax to update plugin setting
|
460 |
+
$.ajax({
|
461 |
+
url: tawcvs.ajaxUrl,
|
462 |
+
type: 'post',
|
463 |
data: ajaxData,
|
464 |
success: function (response) {
|
465 |
if (response.success) {
|
assets/js/frontend.js
CHANGED
@@ -52,9 +52,21 @@
|
|
52 |
if ($el.hasClass('selected')) {
|
53 |
$select.val('');
|
54 |
$el.removeClass('selected');
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
} else {
|
56 |
$el.addClass('selected').siblings('.selected').removeClass('selected');
|
57 |
$select.val(value);
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
$select.change();
|
@@ -62,6 +74,10 @@
|
|
62 |
.on('click', '.reset_variations', function () {
|
63 |
$form.find('.swatch.selected').removeClass('selected');
|
64 |
$form.find('.swatch.disabled').removeClass('disabled');
|
|
|
|
|
|
|
|
|
65 |
})
|
66 |
.on('woocommerce_update_variation_values', function () {
|
67 |
setTimeout(function () {
|
52 |
if ($el.hasClass('selected')) {
|
53 |
$select.val('');
|
54 |
$el.removeClass('selected');
|
55 |
+
|
56 |
+
if ($el.attr('type') == 'radio') {
|
57 |
+
setTimeout(function() {
|
58 |
+
$el.prop('checked', false);
|
59 |
+
}, 100);
|
60 |
+
}
|
61 |
} else {
|
62 |
$el.addClass('selected').siblings('.selected').removeClass('selected');
|
63 |
$select.val(value);
|
64 |
+
|
65 |
+
if ($el.attr('type') == 'radio') {
|
66 |
+
setTimeout(function() {
|
67 |
+
$el.prop('checked', true);
|
68 |
+
}, 100);
|
69 |
+
}
|
70 |
}
|
71 |
|
72 |
$select.change();
|
74 |
.on('click', '.reset_variations', function () {
|
75 |
$form.find('.swatch.selected').removeClass('selected');
|
76 |
$form.find('.swatch.disabled').removeClass('disabled');
|
77 |
+
|
78 |
+
if ($form.find('input[type="radio"]').length > 1) {
|
79 |
+
$form.find('input[type="radio"]').prop('checked', false);
|
80 |
+
}
|
81 |
})
|
82 |
.on('woocommerce_update_variation_values', function () {
|
83 |
setTimeout(function () {
|
includes/class-admin-product.php
CHANGED
@@ -171,6 +171,15 @@ class TA_WC_Variation_Swatches_Admin_Product {
|
|
171 |
|
172 |
</script>
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
<script type="text/template" id="tmpl-tawcvs-input-tax">
|
175 |
|
176 |
<input type="hidden" class="tawcvs-input" name="taxonomy" value="{{data.tax}}">
|
171 |
|
172 |
</script>
|
173 |
|
174 |
+
<script type="text/template" id="tmpl-tawcvs-input-radio">
|
175 |
+
|
176 |
+
<label>
|
177 |
+
<?php esc_html_e( 'Label', 'wcvs' ) ?>
|
178 |
+
<input type="text" class="widefat tawcvs-input tawcvs-input-label" name="swatch">
|
179 |
+
</label>
|
180 |
+
|
181 |
+
</script>
|
182 |
+
|
183 |
<script type="text/template" id="tmpl-tawcvs-input-tax">
|
184 |
|
185 |
<input type="hidden" class="tawcvs-input" name="taxonomy" value="{{data.tax}}">
|
includes/class-admin.php
CHANGED
@@ -33,7 +33,7 @@ class TA_WC_Variation_Swatches_Admin {
|
|
33 |
public function __construct() {
|
34 |
add_action( 'admin_init', array( $this, 'includes' ) );
|
35 |
add_action( 'admin_init', array( $this, 'init_attribute_hooks' ) );
|
36 |
-
add_action( '
|
37 |
|
38 |
add_action( 'woocommerce_product_data_tabs', array( $this, 'add_custom_swatch_variation_tab' ) );
|
39 |
add_action( 'woocommerce_product_data_panels', array( $this, 'product_tab_variation_swatches_panel' ) );
|
@@ -107,13 +107,21 @@ class TA_WC_Variation_Swatches_Admin {
|
|
107 |
case 'image':
|
108 |
$generalSettings[ 'image-swatches-attribute-' . $data['attribute_name'] ] = '1';
|
109 |
$generalSettings[ 'color-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
|
|
110 |
$generalSettings['enable-image-swatches'] = '1';
|
111 |
break;
|
112 |
case 'color':
|
113 |
$generalSettings[ 'image-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
114 |
$generalSettings[ 'color-swatches-attribute-' . $data['attribute_name'] ] = '1';
|
|
|
115 |
$generalSettings['enable-color-swatches'] = '1';
|
116 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
$latest_option['general'] = $generalSettings;
|
@@ -242,12 +250,10 @@ class TA_WC_Variation_Swatches_Admin {
|
|
242 |
wp_enqueue_style( 'tawcvs-admin-addons', plugins_url( '/assets/css/admin-addons-page.css', $dir_name ), array() );
|
243 |
}
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
// Don't let the below styles and css affect other woosuite plugin pages
|
250 |
-
if ( strpos( $screen->id, 'woosuite_page_' ) !== false ) {
|
251 |
return;
|
252 |
}
|
253 |
|
@@ -271,7 +277,8 @@ class TA_WC_Variation_Swatches_Admin {
|
|
271 |
'mediaTitle' => esc_html__( 'Choose an image', 'wcvs' ),
|
272 |
'mediaButton' => esc_html__( 'Use image', 'wcvs' ),
|
273 |
),
|
274 |
-
'placeholder' => WC()->plugin_url() . '/assets/images/placeholder.png'
|
|
|
275 |
)
|
276 |
);
|
277 |
|
@@ -399,18 +406,10 @@ class TA_WC_Variation_Swatches_Admin {
|
|
399 |
} else {
|
400 |
$term_id = false;
|
401 |
}
|
402 |
-
$value
|
403 |
-
|
404 |
-
// Print the open tag of field container
|
405 |
-
printf(
|
406 |
-
'<%s class="form-field">%s<label for="term-%s">%s</label>%s',
|
407 |
-
'edit' == $form ? 'tr' : 'div',
|
408 |
-
'edit' == $form ? '<th>' : '',
|
409 |
-
esc_attr( $type ),
|
410 |
-
TA_WCVS()->types[ $type ],
|
411 |
-
'edit' == $form ? '</th><td>' : ''
|
412 |
-
);
|
413 |
|
|
|
414 |
switch ( $type ) {
|
415 |
case 'image':
|
416 |
$image = $value ? wp_get_attachment_image_src( $value ) : '';
|
@@ -420,25 +419,43 @@ class TA_WC_Variation_Swatches_Admin {
|
|
420 |
<img src="<?php echo esc_url( $image ) ?>" width="60px" height="60px"/>
|
421 |
</div>
|
422 |
<div style="line-height:60px;">
|
423 |
-
<input type="hidden" class="tawcvs-term-image" name="image"
|
424 |
-
|
425 |
-
<button type="button"
|
426 |
-
class="tawcvs-upload-image-button button"><?php esc_html_e( 'Upload/Add image', 'wcvs' ); ?></button>
|
427 |
-
<button type="button"
|
428 |
-
class="tawcvs-remove-image-button button <?php echo $value ? '' : 'hidden' ?>"><?php esc_html_e( 'Remove image', 'wcvs' ); ?></button>
|
429 |
</div>
|
430 |
<?php
|
431 |
break;
|
432 |
-
|
|
|
|
|
|
|
|
|
433 |
default:
|
434 |
?>
|
435 |
-
<input type="text" id="term-<?php echo esc_attr( $type ) ?>" name="<?php echo esc_attr( $type ) ?>"
|
436 |
-
value="<?php echo esc_attr( $value ) ?>"/>
|
437 |
<?php
|
438 |
break;
|
439 |
}
|
440 |
-
|
441 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
}
|
443 |
|
444 |
/**
|
@@ -451,7 +468,6 @@ class TA_WC_Variation_Swatches_Admin {
|
|
451 |
foreach ( TA_WCVS()->types as $type => $label ) {
|
452 |
if ( isset( $_POST[ $type ] ) ) {
|
453 |
update_term_meta( $term_id, $type, sanitize_text_field( $_POST[ $type ] ) );
|
454 |
-
|
455 |
do_action( 'tawcvs_after_save_term_meta', $term_id, $type );
|
456 |
}
|
457 |
}
|
@@ -466,9 +482,11 @@ class TA_WC_Variation_Swatches_Admin {
|
|
466 |
*/
|
467 |
public function add_attribute_columns( array $columns ) {
|
468 |
$new_columns = array();
|
469 |
-
|
470 |
-
|
471 |
-
|
|
|
|
|
472 |
|
473 |
return array_merge( $new_columns, $columns );
|
474 |
}
|
@@ -588,4 +606,5 @@ class TA_WC_Variation_Swatches_Admin {
|
|
588 |
|
589 |
return is_array( $option ) ? $option : array();
|
590 |
}
|
|
|
591 |
}
|
33 |
public function __construct() {
|
34 |
add_action( 'admin_init', array( $this, 'includes' ) );
|
35 |
add_action( 'admin_init', array( $this, 'init_attribute_hooks' ) );
|
36 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
37 |
|
38 |
add_action( 'woocommerce_product_data_tabs', array( $this, 'add_custom_swatch_variation_tab' ) );
|
39 |
add_action( 'woocommerce_product_data_panels', array( $this, 'product_tab_variation_swatches_panel' ) );
|
107 |
case 'image':
|
108 |
$generalSettings[ 'image-swatches-attribute-' . $data['attribute_name'] ] = '1';
|
109 |
$generalSettings[ 'color-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
110 |
+
$generalSettings[ 'radio-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
111 |
$generalSettings['enable-image-swatches'] = '1';
|
112 |
break;
|
113 |
case 'color':
|
114 |
$generalSettings[ 'image-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
115 |
$generalSettings[ 'color-swatches-attribute-' . $data['attribute_name'] ] = '1';
|
116 |
+
$generalSettings[ 'radio-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
117 |
$generalSettings['enable-color-swatches'] = '1';
|
118 |
break;
|
119 |
+
case 'radio':
|
120 |
+
$generalSettings[ 'image-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
121 |
+
$generalSettings[ 'color-swatches-attribute-' . $data['attribute_name'] ] = '0';
|
122 |
+
$generalSettings[ 'radio-swatches-attribute-' . $data['attribute_name'] ] = '1';
|
123 |
+
$generalSettings['enable-radio-swatches'] = '1';
|
124 |
+
break;
|
125 |
}
|
126 |
|
127 |
$latest_option['general'] = $generalSettings;
|
250 |
wp_enqueue_style( 'tawcvs-admin-addons', plugins_url( '/assets/css/admin-addons-page.css', $dir_name ), array() );
|
251 |
}
|
252 |
|
253 |
+
// Don't enqueue unless we are in the edit product attribute or plugin setting page
|
254 |
+
if ( strpos( $screen->id, 'edit-pa_' ) === false &&
|
255 |
+
strpos( $screen->id, 'product' ) === false &&
|
256 |
+
TA_WC_Variation_Swatches::is_in_plugin_settings_page() === false ) {
|
|
|
|
|
257 |
return;
|
258 |
}
|
259 |
|
277 |
'mediaTitle' => esc_html__( 'Choose an image', 'wcvs' ),
|
278 |
'mediaButton' => esc_html__( 'Use image', 'wcvs' ),
|
279 |
),
|
280 |
+
'placeholder' => WC()->plugin_url() . '/assets/images/placeholder.png',
|
281 |
+
'ajaxUrl' => admin_url( 'admin-ajax.php' )
|
282 |
)
|
283 |
);
|
284 |
|
406 |
} else {
|
407 |
$term_id = false;
|
408 |
}
|
409 |
+
$value = get_term_meta( $term_id, $type, true );
|
410 |
+
$html = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
|
412 |
+
ob_start();
|
413 |
switch ( $type ) {
|
414 |
case 'image':
|
415 |
$image = $value ? wp_get_attachment_image_src( $value ) : '';
|
419 |
<img src="<?php echo esc_url( $image ) ?>" width="60px" height="60px"/>
|
420 |
</div>
|
421 |
<div style="line-height:60px;">
|
422 |
+
<input type="hidden" class="tawcvs-term-image" name="image" value="<?php echo esc_attr( $value ) ?>"/>
|
423 |
+
<button type="button" class="tawcvs-upload-image-button button"><?php esc_html_e( 'Upload/Add image', 'wcvs' ); ?></button>
|
424 |
+
<button type="button" class="tawcvs-remove-image-button button <?php echo $value ? '' : 'hidden' ?>"><?php esc_html_e( 'Remove image', 'wcvs' ); ?></button>
|
|
|
|
|
|
|
425 |
</div>
|
426 |
<?php
|
427 |
break;
|
428 |
+
case 'radio':
|
429 |
+
?>
|
430 |
+
<input type="hidden" name="radio" />
|
431 |
+
<?php
|
432 |
+
break;
|
433 |
default:
|
434 |
?>
|
435 |
+
<input type="text" id="term-<?php echo esc_attr( $type ) ?>" name="<?php echo esc_attr( $type ) ?>" value="<?php echo esc_attr( $value ) ?>"/>
|
|
|
436 |
<?php
|
437 |
break;
|
438 |
}
|
439 |
+
$html .= ob_get_clean();
|
440 |
+
$html = apply_filters( 'tawcvs_tooltip_attributes', $html, $type, $term, $taxonomy, $form );
|
441 |
+
|
442 |
+
if ( $type != 'radio' ) {
|
443 |
+
echo sprintf(
|
444 |
+
'<%s class="form-field">%s<label for="term-%s">%s</label>%s',
|
445 |
+
'edit' == $form ? 'tr' : 'div',
|
446 |
+
'edit' == $form ? '<th>' : '',
|
447 |
+
esc_attr( $type ),
|
448 |
+
TA_WCVS()->types[ $type ],
|
449 |
+
'edit' == $form ? '</th><td>' : ''
|
450 |
+
);
|
451 |
+
|
452 |
+
echo $html;
|
453 |
+
|
454 |
+
// Print the close tag of field container
|
455 |
+
echo 'edit' == $form ? '</td></tr>' : '</div>';
|
456 |
+
} else {
|
457 |
+
echo $html;
|
458 |
+
}
|
459 |
}
|
460 |
|
461 |
/**
|
468 |
foreach ( TA_WCVS()->types as $type => $label ) {
|
469 |
if ( isset( $_POST[ $type ] ) ) {
|
470 |
update_term_meta( $term_id, $type, sanitize_text_field( $_POST[ $type ] ) );
|
|
|
471 |
do_action( 'tawcvs_after_save_term_meta', $term_id, $type );
|
472 |
}
|
473 |
}
|
482 |
*/
|
483 |
public function add_attribute_columns( array $columns ) {
|
484 |
$new_columns = array();
|
485 |
+
if ( isset( $columns['cb']) ) {
|
486 |
+
$new_columns['cb'] = $columns['cb'];
|
487 |
+
$new_columns['thumb'] = '';
|
488 |
+
unset( $columns['cb'] );
|
489 |
+
}
|
490 |
|
491 |
return array_merge( $new_columns, $columns );
|
492 |
}
|
606 |
|
607 |
return is_array( $option ) ? $option : array();
|
608 |
}
|
609 |
+
|
610 |
}
|
includes/class-frontend.php
CHANGED
@@ -276,6 +276,10 @@ class TA_WC_Variation_Swatches_Frontend {
|
|
276 |
|
277 |
$swatchShape = isset( $this->generalSettings['swatch-shape'] ) ? $this->generalSettings['swatch-shape'] : 'circle';
|
278 |
|
|
|
|
|
|
|
|
|
279 |
switch ( $type ) {
|
280 |
case 'color':
|
281 |
$main_color = get_term_meta( $term->term_id, 'color', true );
|
@@ -337,6 +341,20 @@ class TA_WC_Variation_Swatches_Frontend {
|
|
337 |
$tooltip
|
338 |
);
|
339 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
|
342 |
return apply_filters( 'tawcvs_swatch_item_html', $html, $term, $type, $selected, $name, $tooltip, $swatchShape );
|
@@ -420,7 +438,21 @@ class TA_WC_Variation_Swatches_Frontend {
|
|
420 |
*/
|
421 |
public function get_tooltip_html( $html, $term, $name, $args ) {
|
422 |
if ( ! empty( $args['tooltip'] ) ) {
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
}
|
425 |
|
426 |
return $html;
|
276 |
|
277 |
$swatchShape = isset( $this->generalSettings['swatch-shape'] ) ? $this->generalSettings['swatch-shape'] : 'circle';
|
278 |
|
279 |
+
if ( $type == 'radio' && ! TA_WC_Variation_Swatches::is_pro_addon_active() ) {
|
280 |
+
$type = 'select';
|
281 |
+
}
|
282 |
+
|
283 |
switch ( $type ) {
|
284 |
case 'color':
|
285 |
$main_color = get_term_meta( $term->term_id, 'color', true );
|
341 |
$tooltip
|
342 |
);
|
343 |
break;
|
344 |
+
case 'radio':
|
345 |
+
$selected = ! empty( $selected ) ? 'checked' : '';
|
346 |
+
$html = sprintf(
|
347 |
+
'<div class="swatch-item-wrapper swatch-radio"><input id="%s" class="swatch" data-value="%s" type="radio" name="%s" value="%s" %s /><label for="%s" class="text swatch-label" style="display:inline">%s</label>%s</div>',
|
348 |
+
esc_attr( $term->slug ),
|
349 |
+
esc_attr( $term->slug ),
|
350 |
+
'attribute_' . $term->taxonomy,
|
351 |
+
esc_attr( $term->slug ),
|
352 |
+
$selected,
|
353 |
+
esc_attr( $term->slug ),
|
354 |
+
esc_html( $term->name ),
|
355 |
+
$tooltip
|
356 |
+
);
|
357 |
+
break;
|
358 |
}
|
359 |
|
360 |
return apply_filters( 'tawcvs_swatch_item_html', $html, $term, $type, $selected, $name, $tooltip, $swatchShape );
|
438 |
*/
|
439 |
public function get_tooltip_html( $html, $term, $name, $args ) {
|
440 |
if ( ! empty( $args['tooltip'] ) ) {
|
441 |
+
|
442 |
+
$show_tooltip = get_term_meta( $term->term_id, 'show-tooltip', true );
|
443 |
+
$show_tooltip = $show_tooltip === '' || ! TA_WC_Variation_Swatches::is_pro_addon_active() ? 1 : $show_tooltip;
|
444 |
+
|
445 |
+
if ( $show_tooltip == 1 ) {
|
446 |
+
// get default tooltip label
|
447 |
+
$label = get_term_meta( $term->term_id, 'tooltip-text', true );
|
448 |
+
$label = ! empty( $label ) && TA_WC_Variation_Swatches::is_pro_addon_active() ? $label : $name;
|
449 |
+
$html = '<span class="swatch__tooltip">' . $label . '</span>';
|
450 |
+
} else if ( $show_tooltip == 2 ) {
|
451 |
+
// image tooltip
|
452 |
+
$image = get_term_meta( $term->term_id, 'tooltip-image', true );
|
453 |
+
$image = wp_get_attachment_image_src( $image, 'thumbnail' );
|
454 |
+
$html = '<span class="swatch__tooltip"><img src="' . $image[0] . '" /></span>';
|
455 |
+
}
|
456 |
}
|
457 |
|
458 |
return $html;
|
includes/class-menu-page.php
CHANGED
@@ -22,12 +22,6 @@ class VSWC_Settings_Page {
|
|
22 |
if ( TA_WC_Variation_Swatches::is_in_plugin_settings_page() ) {
|
23 |
|
24 |
do_action( 'woosuite_core_admin_page_scripts' );
|
25 |
-
|
26 |
-
wp_enqueue_style( 'wp-color-picker' );
|
27 |
-
wp_enqueue_script( 'wp-color-picker' );
|
28 |
-
|
29 |
-
wp_enqueue_script( 'tawcvs-admin', plugins_url( '/assets/js/admin.js', dirname( __FILE__ ) ), array( 'jquery' ), WCVS_PLUGIN_VERSION, true );
|
30 |
-
wp_enqueue_style( 'tawcvs-admin', plugins_url( '/assets/css/admin.css', dirname( __FILE__ ) ), array( 'wp-color-picker' ), WCVS_PLUGIN_VERSION );
|
31 |
}
|
32 |
}
|
33 |
|
@@ -139,6 +133,17 @@ class VSWC_Settings_Page {
|
|
139 |
'image-swatches-attribute-',
|
140 |
'image'
|
141 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
/**
|
22 |
if ( TA_WC_Variation_Swatches::is_in_plugin_settings_page() ) {
|
23 |
|
24 |
do_action( 'woosuite_core_admin_page_scripts' );
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
}
|
27 |
|
133 |
'image-swatches-attribute-',
|
134 |
'image'
|
135 |
);
|
136 |
+
|
137 |
+
if ( TA_WC_Variation_Swatches::is_pro_addon_active() ) {
|
138 |
+
$this->update_attribute_by_type(
|
139 |
+
$general_settings,
|
140 |
+
$all_attrs,
|
141 |
+
'enable-radio-swatches',
|
142 |
+
'radio-swatches-attribute-',
|
143 |
+
'radio'
|
144 |
+
);
|
145 |
+
}
|
146 |
+
|
147 |
}
|
148 |
|
149 |
/**
|
includes/class-setting-fields-manager.php
CHANGED
@@ -127,7 +127,7 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
|
|
127 |
),
|
128 |
'class'=>'main-ajax-trigger',
|
129 |
'desc' => __( 'Enable the Image type for Product Attributes', 'wcvs' ),
|
130 |
-
'priority' => 1.
|
131 |
),
|
132 |
array(
|
133 |
'title' => __( 'Select Attributes', 'wcvs' ),
|
@@ -147,7 +147,21 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
|
|
147 |
'class' => 'indent ajax-to-update',
|
148 |
'field_to_check' => 'wcvs-enable-image-swatches',
|
149 |
'show_if_checked' => true,
|
150 |
-
'priority' => 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
),
|
152 |
array(
|
153 |
'title' => __( 'Auto Convert Dropdowns To Label', 'wcvs' ),
|
@@ -159,7 +173,7 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
|
|
159 |
)
|
160 |
),
|
161 |
'desc' => __( 'Automatically covert dropdowns to "Label Swatch" by default', 'wcvs' ),
|
162 |
-
'priority' => 1.
|
163 |
),
|
164 |
array(
|
165 |
'title' => __( 'Select Attributes', 'wcvs' ),
|
127 |
),
|
128 |
'class'=>'main-ajax-trigger',
|
129 |
'desc' => __( 'Enable the Image type for Product Attributes', 'wcvs' ),
|
130 |
+
'priority' => 1.3
|
131 |
),
|
132 |
array(
|
133 |
'title' => __( 'Select Attributes', 'wcvs' ),
|
147 |
'class' => 'indent ajax-to-update',
|
148 |
'field_to_check' => 'wcvs-enable-image-swatches',
|
149 |
'show_if_checked' => true,
|
150 |
+
'priority' => 1.4
|
151 |
+
),
|
152 |
+
array(
|
153 |
+
'title' => __( 'Enable Radio Button Swatches', 'wcvs' ),
|
154 |
+
'fields' => array(
|
155 |
+
array(
|
156 |
+
'id' => 'wcvs-enable-radio-swatches',
|
157 |
+
'type' => 'checkbox',
|
158 |
+
'name' => 'enable-radio-swatches',
|
159 |
+
)
|
160 |
+
),
|
161 |
+
'class' => 'main-ajax-trigger',
|
162 |
+
'desc' => __( 'Enable the Radio button type for Product Attributes', 'wcvs' ),
|
163 |
+
'priority' => 1.5,
|
164 |
+
'is_pro_feature' => true,
|
165 |
),
|
166 |
array(
|
167 |
'title' => __( 'Auto Convert Dropdowns To Label', 'wcvs' ),
|
173 |
)
|
174 |
),
|
175 |
'desc' => __( 'Automatically covert dropdowns to "Label Swatch" by default', 'wcvs' ),
|
176 |
+
'priority' => 1.8
|
177 |
),
|
178 |
array(
|
179 |
'title' => __( 'Select Attributes', 'wcvs' ),
|
includes/class-variation-swatches.php
CHANGED
@@ -41,6 +41,10 @@ final class TA_WC_Variation_Swatches {
|
|
41 |
'label' => esc_html__( 'Label', 'wcvs' ),
|
42 |
);
|
43 |
|
|
|
|
|
|
|
|
|
44 |
$this->includes();
|
45 |
$this->init_hooks();
|
46 |
}
|
41 |
'label' => esc_html__( 'Label', 'wcvs' ),
|
42 |
);
|
43 |
|
44 |
+
if ( TA_WC_Variation_Swatches::is_pro_addon_active() ) {
|
45 |
+
$this->types['radio'] = esc_html__( 'Radio button', 'wcvs' );
|
46 |
+
}
|
47 |
+
|
48 |
$this->includes();
|
49 |
$this->init_hooks();
|
50 |
}
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: variationswatches, themealien, zgani, mehbubrashid, minhnguyen25
|
3 |
Tags: variation swatches, woocommerce, product attribute, product color, product size, variable products
|
4 |
Requires at least: 4.5
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 2.1.
|
7 |
WC requires at least: 3.2.0
|
8 |
-
WC tested up to: 6.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -103,6 +103,14 @@ Yes, it will work with any theme, but may require some styling to make it match
|
|
103 |
7. Add new attribute color when edit a product
|
104 |
|
105 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 2.1.3 =
|
107 |
* Fixed firefox showing unavailable sizes
|
108 |
* Create option for image position for swatches
|
2 |
Contributors: variationswatches, themealien, zgani, mehbubrashid, minhnguyen25
|
3 |
Tags: variation swatches, woocommerce, product attribute, product color, product size, variable products
|
4 |
Requires at least: 4.5
|
5 |
+
Tested up to: 5.9
|
6 |
+
Stable tag: 2.1.4
|
7 |
WC requires at least: 3.2.0
|
8 |
+
WC tested up to: 6.1.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
103 |
7. Add new attribute color when edit a product
|
104 |
|
105 |
== Changelog ==
|
106 |
+
= 2.1.4 =
|
107 |
+
* Replace wp.ajax by normal ajax call, fix media upload
|
108 |
+
* Removing unused function, reformat code
|
109 |
+
* Update recommended plugins loaded from server
|
110 |
+
* Added support for radio button in pro
|
111 |
+
* Added tooltip image support in pro
|
112 |
+
* Added custom tooltip text support in pro
|
113 |
+
|
114 |
= 2.1.3 =
|
115 |
* Fixed firefox showing unavailable sizes
|
116 |
* Create option for image position for swatches
|
templates/admin/partials/panel-sidebar.php
CHANGED
@@ -14,24 +14,91 @@
|
|
14 |
<!-- widget -->
|
15 |
|
16 |
<!-- widget -->
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
</div>
|
33 |
-
|
34 |
-
|
|
|
35 |
</div>
|
36 |
</div>
|
37 |
<!-- variation sidebar -->
|
14 |
<!-- widget -->
|
15 |
|
16 |
<!-- widget -->
|
17 |
+
<?php
|
18 |
+
ob_start();
|
19 |
+
|
20 |
+
$plugin_slug = 'variation-swatches-for-woocommerce';
|
21 |
+
|
22 |
+
if ( ! $all_plugins = get_transient( 'woosuite-all-plugins' ) ) {
|
23 |
+
$request = wp_remote_request( 'https://dw.woosuite.com/wp-json/woosuite-server/v1/plugins/' );
|
24 |
+
|
25 |
+
if ( ! is_wp_error( $request ) ) {
|
26 |
+
$all_plugins = json_decode( wp_remote_retrieve_body( $request ) );
|
27 |
+
set_transient( 'woosuite-all-plugins', $all_plugins, DAY_IN_SECONDS );
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( $all_plugins ) {
|
32 |
+
$current_plugin = array_filter( $all_plugins, function( $item ) use ( $plugin_slug ) {
|
33 |
+
if ( $item->slug == $plugin_slug ) {
|
34 |
+
return $item;
|
35 |
+
}
|
36 |
+
} );
|
37 |
+
|
38 |
+
if ( $current_plugin ) {
|
39 |
+
sort( $current_plugin );
|
40 |
+
$current_plugin = $current_plugin[0];
|
41 |
+
$recommended_plugins = maybe_unserialize( maybe_unserialize( $current_plugin->recommended_plugins ) );
|
42 |
+
|
43 |
+
if ( $recommended_plugins ) {
|
44 |
+
// add clicks data to array
|
45 |
+
foreach( $all_plugins as $plugin ) {
|
46 |
+
foreach ( $recommended_plugins as $key => $value ) {
|
47 |
+
if ( isset( $value['plugin'] ) && $value['plugin'] == $plugin->slug ) {
|
48 |
+
$recommended_plugins[$key]['clicks'] = $plugin->clicks;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
$keys = array_column( $recommended_plugins, 'clicks' );
|
54 |
+
if ( $keys) {
|
55 |
+
array_multisort( $keys, SORT_DESC, $recommended_plugins );
|
56 |
+
|
57 |
+
foreach( $recommended_plugins as $recommended_plugin ) {
|
58 |
+
if ( ! isset( $recommended_plugin['plugin']) ) {
|
59 |
+
continue;
|
60 |
+
}
|
61 |
+
|
62 |
+
$recommended_plugin_slug = $recommended_plugin['plugin'];
|
63 |
+
$plugin_data = array_filter( $all_plugins, function( $item ) use ( $recommended_plugin_slug ) {
|
64 |
+
if ( $item->slug == $recommended_plugin_slug ) {
|
65 |
+
return $item;
|
66 |
+
}
|
67 |
+
} );
|
68 |
+
|
69 |
+
if ( $plugin_data ) {
|
70 |
+
sort( $plugin_data );
|
71 |
+
$plugin_data = $plugin_data[0];
|
72 |
+
$title = ! empty( $recommended_plugin['plugin']['title'] ) ? $recommended_plugin['plugin']['title'] : $plugin_data->name;
|
73 |
+
$description = ! empty( $recommended_plugin['plugin']['description'] ) ? $recommended_plugin['plugin']['description'] : $plugin_data->short_description;
|
74 |
+
$link = ! empty( $recommended_plugin['plugin']['link'] ) ? $recommended_plugin['plugin']['link'] : $plugin_data->homepage;
|
75 |
+
?>
|
76 |
+
<div class="swatch-var-addon">
|
77 |
+
<a href="<?php echo $link; ?>" class="swatch-addon-link"><h2><?php echo $title; ?></h2></a>
|
78 |
+
<p><?php echo $description; ?></p>
|
79 |
+
<a href="<?php echo $link; ?>" class="swatch-submit-link update-clicks"><?php _e('Get It now','woosuite-core')?></a>
|
80 |
+
</div>
|
81 |
+
<?php
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
$html = ob_get_clean();
|
90 |
+
|
91 |
+
if ( ! empty( $html ) ) {
|
92 |
+
?>
|
93 |
+
<div class="swatch-var-widget">
|
94 |
+
<h2 class="swatch-video-title"> <?php _e('Works well with..','woosuite-core'); ?></h2>
|
95 |
+
<div class="swatch-var-addon-wrap">
|
96 |
+
<?php echo $html; ?>
|
97 |
</div>
|
98 |
</div>
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
?>
|
102 |
</div>
|
103 |
</div>
|
104 |
<!-- variation sidebar -->
|
templates/admin/welcome-popup.php
CHANGED
@@ -6,9 +6,9 @@
|
|
6 |
</div>
|
7 |
<div class="popup-content">
|
8 |
<div class="popup-inner-content">
|
9 |
-
<p><strong>Congratulations on updating to v2.1.
|
10 |
-
<p>
|
11 |
-
<p>Based on your feedback, we have added a bunch of new features and enhancements with a lot more to
|
12 |
<p><a href="https://woosuite.com/news/variation-swatches-updates/" target="_blank" rel="noopener noreferrer nofollow"> Click here to learn more. </a></p>
|
13 |
<p>If you experience any issues, please get in touch with support so we can make it right: <a href="https://woosuite.com/support/" target="_blank" rel="noopener noreferrer nofollow">Support</a></p>
|
14 |
</div>
|
6 |
</div>
|
7 |
<div class="popup-content">
|
8 |
<div class="popup-inner-content">
|
9 |
+
<p><strong>Congratulations on updating to v2.1.4!</strong></p>
|
10 |
+
<p>TThank you to every that reported the swatches setting wasn't saving. We’ve been hard at work to make this update even better for you…</p>
|
11 |
+
<p>Based on your feedback, we have added a bunch of new features and enhancements with a lot more to come.</p>
|
12 |
<p><a href="https://woosuite.com/news/variation-swatches-updates/" target="_blank" rel="noopener noreferrer nofollow"> Click here to learn more. </a></p>
|
13 |
<p>If you experience any issues, please get in touch with support so we can make it right: <a href="https://woosuite.com/support/" target="_blank" rel="noopener noreferrer nofollow">Support</a></p>
|
14 |
</div>
|
variation-swatches-for-woocommerce.php
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
* Plugin Name: Variation Swatches for WooCommerce
|
4 |
* Plugin URI: https://woosuite.com/plugins/woocommerce-variation-swatches/
|
5 |
* Description: Creates variation swatches for WooCommerce, converts your variation dropdown into color, label, or photo swatches with ease, The original Variation Swatches for WooCommerce.
|
6 |
-
* Version: 2.1.
|
7 |
* Author: Woosuite
|
8 |
* Author URI: https://woosuite.com/
|
9 |
* Requires at least: 4.5
|
10 |
-
* Tested up to: 5.
|
11 |
* Text Domain: wcvs
|
12 |
* Domain Path: /languages
|
13 |
* WC requires at least: 3.0.0
|
14 |
-
* WC tested up to: 6.
|
15 |
*
|
16 |
* License: GPLv2 or later
|
17 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -27,7 +27,7 @@ if ( ! defined( 'TAWC_VS_PLUGIN_FILE' ) ) {
|
|
27 |
}
|
28 |
|
29 |
if ( ! defined( 'WCVS_PLUGIN_VERSION' ) ) {
|
30 |
-
define( 'WCVS_PLUGIN_VERSION', '2.1.
|
31 |
}
|
32 |
|
33 |
if ( ! defined( 'WCVS_PLUGIN_URL' ) ) {
|
3 |
* Plugin Name: Variation Swatches for WooCommerce
|
4 |
* Plugin URI: https://woosuite.com/plugins/woocommerce-variation-swatches/
|
5 |
* Description: Creates variation swatches for WooCommerce, converts your variation dropdown into color, label, or photo swatches with ease, The original Variation Swatches for WooCommerce.
|
6 |
+
* Version: 2.1.4
|
7 |
* Author: Woosuite
|
8 |
* Author URI: https://woosuite.com/
|
9 |
* Requires at least: 4.5
|
10 |
+
* Tested up to: 5.9
|
11 |
* Text Domain: wcvs
|
12 |
* Domain Path: /languages
|
13 |
* WC requires at least: 3.0.0
|
14 |
+
* WC tested up to: 6.1.1
|
15 |
*
|
16 |
* License: GPLv2 or later
|
17 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
27 |
}
|
28 |
|
29 |
if ( ! defined( 'WCVS_PLUGIN_VERSION' ) ) {
|
30 |
+
define( 'WCVS_PLUGIN_VERSION', '2.1.4' );
|
31 |
}
|
32 |
|
33 |
if ( ! defined( 'WCVS_PLUGIN_URL' ) ) {
|