Version Description
WEDNESDAY, 14th DECEMBER 2022 = * Improvement - Added support for the taxonomy page. * Improvement - Added support to populate swatches on ajax calls. * Fixed - Wrong images were appearing on the swatches selection. * Fixed - Plugin conflict with WP-Persian plugin. * Fixed - Unable to save custom attribute data with the Cyrillic alphabet.
Download this release
Release Info
Developer | brainstormworg |
Plugin | Variation Swatches for WooCommerce by CartFlows |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- admin-core/admin-menu.php +1 -1
- assets/js/swatches.js +24 -20
- changelog.txt +10 -0
- inc/helper.php +4 -1
- inc/swatches.php +1 -1
- languages/variation-swatches-woo.pot +2 -2
- readme.txt +9 -2
- variation-swatches-woo.php +2 -2
admin-core/admin-menu.php
CHANGED
@@ -88,7 +88,7 @@ class Admin_Menu {
|
|
88 |
*/
|
89 |
public function settings_page_scripts( $hook ) {
|
90 |
wp_enqueue_style( 'cfvsw_extra_css', CFVSW_URL . 'admin-core/assets/css/extra.css', [], CFVSW_VER );
|
91 |
-
if (
|
92 |
return;
|
93 |
}
|
94 |
$script_asset_path = CFVSW_DIR . 'admin-core/assets/build/settings.asset.php';
|
88 |
*/
|
89 |
public function settings_page_scripts( $hook ) {
|
90 |
wp_enqueue_style( 'cfvsw_extra_css', CFVSW_URL . 'admin-core/assets/css/extra.css', [], CFVSW_VER );
|
91 |
+
if ( false === strpos( $hook, '_page_cfvsw_settings' ) ) {
|
92 |
return;
|
93 |
}
|
94 |
$script_asset_path = CFVSW_DIR . 'admin-core/assets/build/settings.asset.php';
|
assets/js/swatches.js
CHANGED
@@ -138,8 +138,8 @@
|
|
138 |
const copySelected = { ...getSelectedOptions };
|
139 |
const selectedKeys = Object.keys( getSelectedOptions );
|
140 |
const getCurrentIndex = selectedKeys.indexOf( getAttrName );
|
141 |
-
const
|
142 |
-
|
143 |
if ( getCurrentIndex >= 0 ) {
|
144 |
selectedKeys.splice( getCurrentIndex, 1 );
|
145 |
delete copySelected[ getAttrName ];
|
@@ -147,14 +147,14 @@
|
|
147 |
hasThisSwatch = SW.checkInRawData(
|
148 |
attributes,
|
149 |
copySelected,
|
150 |
-
|
151 |
is_in_stock
|
152 |
);
|
153 |
return hasThisSwatch;
|
154 |
},
|
155 |
-
checkInRawData: ( attribute, selected,
|
156 |
const cloneAttr = { ...attribute };
|
157 |
-
const selectedCurrent = { ...selected, ...
|
158 |
let checkAndAvail = true;
|
159 |
for ( const checkIsAvail in selectedCurrent ) {
|
160 |
const value = selectedCurrent[ checkIsAvail ];
|
@@ -489,31 +489,27 @@
|
|
489 |
} );
|
490 |
|
491 |
function updateThumbnail( swatch, imageData ) {
|
492 |
-
const
|
493 |
-
|
494 |
-
|
495 |
-
swatch.parents( 'li' ).find( '.cfvsw-original-thumbnail' ).length
|
496 |
-
) {
|
497 |
const originalThumbnail = thumbnail.clone();
|
498 |
thumbnail.after( '<span class="cfvsw-original-thumbnail"></span>' );
|
499 |
-
|
|
|
|
|
500 |
}
|
501 |
thumbnail.attr( 'src', imageData.thumb_src );
|
502 |
thumbnail.attr( 'srcset', '' );
|
503 |
}
|
504 |
|
505 |
function resetThumbnail( swatch ) {
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
const thumbnail = swatch.parents( 'li' ).find( 'img:first' );
|
510 |
thumbnail.replaceWith(
|
511 |
-
|
512 |
-
.parents( 'li' )
|
513 |
-
.find( '.cfvsw-original-thumbnail' )
|
514 |
-
.html()
|
515 |
);
|
516 |
-
|
517 |
}
|
518 |
}
|
519 |
|
@@ -577,4 +573,12 @@
|
|
577 |
SW.firstTime();
|
578 |
addVariationFunctionality();
|
579 |
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
} )( jQuery );
|
138 |
const copySelected = { ...getSelectedOptions };
|
139 |
const selectedKeys = Object.keys( getSelectedOptions );
|
140 |
const getCurrentIndex = selectedKeys.indexOf( getAttrName );
|
141 |
+
const currentObj = {};
|
142 |
+
currentObj[ getAttrName ] = currentTermSlug;
|
143 |
if ( getCurrentIndex >= 0 ) {
|
144 |
selectedKeys.splice( getCurrentIndex, 1 );
|
145 |
delete copySelected[ getAttrName ];
|
147 |
hasThisSwatch = SW.checkInRawData(
|
148 |
attributes,
|
149 |
copySelected,
|
150 |
+
currentObj,
|
151 |
is_in_stock
|
152 |
);
|
153 |
return hasThisSwatch;
|
154 |
},
|
155 |
+
checkInRawData: ( attribute, selected, currentObj, is_in_stock ) => {
|
156 |
const cloneAttr = { ...attribute };
|
157 |
+
const selectedCurrent = { ...selected, ...currentObj };
|
158 |
let checkAndAvail = true;
|
159 |
for ( const checkIsAvail in selectedCurrent ) {
|
160 |
const value = selectedCurrent[ checkIsAvail ];
|
489 |
} );
|
490 |
|
491 |
function updateThumbnail( swatch, imageData ) {
|
492 |
+
const listItem = swatch.closest( 'li' );
|
493 |
+
const thumbnail = listItem.find( 'img:first' );
|
494 |
+
if ( 0 === listItem.find( '.cfvsw-original-thumbnail' ).length ) {
|
|
|
|
|
495 |
const originalThumbnail = thumbnail.clone();
|
496 |
thumbnail.after( '<span class="cfvsw-original-thumbnail"></span>' );
|
497 |
+
listItem
|
498 |
+
.find( '.cfvsw-original-thumbnail' )
|
499 |
+
.html( originalThumbnail );
|
500 |
}
|
501 |
thumbnail.attr( 'src', imageData.thumb_src );
|
502 |
thumbnail.attr( 'srcset', '' );
|
503 |
}
|
504 |
|
505 |
function resetThumbnail( swatch ) {
|
506 |
+
const listItem = swatch.closest( 'li' );
|
507 |
+
if ( listItem.find( '.cfvsw-original-thumbnail' ).length ) {
|
508 |
+
const thumbnail = listItem.find( 'img:first' );
|
|
|
509 |
thumbnail.replaceWith(
|
510 |
+
listItem.find( '.cfvsw-original-thumbnail' ).html()
|
|
|
|
|
|
|
511 |
);
|
512 |
+
listItem.find( '.cfvsw-original-thumbnail' ).remove();
|
513 |
}
|
514 |
}
|
515 |
|
573 |
SW.firstTime();
|
574 |
addVariationFunctionality();
|
575 |
} );
|
576 |
+
|
577 |
+
// Add custom trigger to load swatches.
|
578 |
+
|
579 |
+
// document.dispatchEvent( new CustomEvent("cfvswVariationLoad", { detail: {} }) ); To load variation trigger we need to trigger this.
|
580 |
+
document.addEventListener( 'cfvswVariationLoad', function () {
|
581 |
+
SW.firstTime();
|
582 |
+
addVariationFunctionality();
|
583 |
+
} );
|
584 |
} )( jQuery );
|
changelog.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 1.0.5 – TUESDAY, 18th OCTOBER 2022 =
|
2 |
* Fixed - Compatibility issues with WP Sheet Editor – Taxonomy Terms Pro.
|
3 |
* Fixed - Fatal error with Astra theme.
|
1 |
+
= 1.0.6 – WEDNESDAY, 14th DECEMBER 2022 =
|
2 |
+
* Improvement - Added support for the taxonomy page.
|
3 |
+
* Improvement - Added support to populate swatches on ajax calls.
|
4 |
+
* Fixed - Wrong images were appearing on the swatches selection.
|
5 |
+
* Fixed - Plugin conflict with WP-Persian plugin.
|
6 |
+
* Fixed - Unable to save custom attribute data with the Cyrillic alphabet.
|
7 |
+
|
8 |
+
= 1.0.5.1 – TUESDAY, 18th OCTOBER 2022 =
|
9 |
+
* Fixed - Wrong image pick when click on swatches.
|
10 |
+
|
11 |
= 1.0.5 – TUESDAY, 18th OCTOBER 2022 =
|
12 |
* Fixed - Compatibility issues with WP Sheet Editor – Taxonomy Terms Pro.
|
13 |
* Fixed - Fatal error with Astra theme.
|
inc/helper.php
CHANGED
@@ -134,7 +134,10 @@ class Helper {
|
|
134 |
if ( empty( $str ) ) {
|
135 |
return false;
|
136 |
}
|
137 |
-
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
/**
|
134 |
if ( empty( $str ) ) {
|
135 |
return false;
|
136 |
}
|
137 |
+
$remove_special_characters = strtolower( trim( preg_replace( '/[^\w\s]+/u', '', $str ) ) );
|
138 |
+
$replace_white_spaces_to_dash = str_replace( ' ', '-', $remove_special_characters );
|
139 |
+
$replace_multiple_dash_to_dash = preg_replace( '/-+/', '-', $replace_white_spaces_to_dash );
|
140 |
+
return $replace_multiple_dash_to_dash;
|
141 |
}
|
142 |
|
143 |
/**
|
inc/swatches.php
CHANGED
@@ -774,7 +774,7 @@ class Swatches {
|
|
774 |
public function requires_shop_settings() {
|
775 |
return apply_filters(
|
776 |
'cfvsw_requires_shop_settings',
|
777 |
-
is_shop() || is_product_category()
|
778 |
);
|
779 |
}
|
780 |
|
774 |
public function requires_shop_settings() {
|
775 |
return apply_filters(
|
776 |
'cfvsw_requires_shop_settings',
|
777 |
+
is_shop() || is_product_category() || is_product_taxonomy()
|
778 |
);
|
779 |
}
|
780 |
|
languages/variation-swatches-woo.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the GPL v2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Variation Swatches for WooCommerce 1.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/variation-swatches-woo\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: variation-swatches-woo\n"
|
2 |
# This file is distributed under the GPL v2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Variation Swatches for WooCommerce 1.0.6\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/variation-swatches-woo\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-12-13T11:12:18+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.6.0\n"
|
15 |
"X-Domain: variation-swatches-woo\n"
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: brainstormforce
|
3 |
Tags: woocommerce variation swatches, woocommerce attributes, woocommerce variation, product attributes, product color, product size, variable product attributes, variation product swatches, color variation swatch, image variation swatch
|
4 |
Requires at least: 5.4
|
5 |
-
Tested up to: 6.
|
6 |
-
Stable tag: 1.0.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -106,6 +106,13 @@ Yes, this plugin enables variation swatches on shop / archieve page. User can se
|
|
106 |
2. Multiple options for swatches available
|
107 |
|
108 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
= 1.0.5 – TUESDAY, 18th OCTOBER 2022 =
|
110 |
* Fixed - Compatibility issues with WP Sheet Editor – Taxonomy Terms Pro.
|
111 |
* Fixed - Fatal error with Astra theme.
|
2 |
Contributors: brainstormforce
|
3 |
Tags: woocommerce variation swatches, woocommerce attributes, woocommerce variation, product attributes, product color, product size, variable product attributes, variation product swatches, color variation swatch, image variation swatch
|
4 |
Requires at least: 5.4
|
5 |
+
Tested up to: 6.1.1
|
6 |
+
Stable tag: 1.0.6
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
106 |
2. Multiple options for swatches available
|
107 |
|
108 |
== Changelog ==
|
109 |
+
= 1.0.6 – WEDNESDAY, 14th DECEMBER 2022 =
|
110 |
+
* Improvement - Added support for the taxonomy page.
|
111 |
+
* Improvement - Added support to populate swatches on ajax calls.
|
112 |
+
* Fixed - Wrong images were appearing on the swatches selection.
|
113 |
+
* Fixed - Plugin conflict with WP-Persian plugin.
|
114 |
+
* Fixed - Unable to save custom attribute data with the Cyrillic alphabet.
|
115 |
+
|
116 |
= 1.0.5 – TUESDAY, 18th OCTOBER 2022 =
|
117 |
* Fixed - Compatibility issues with WP Sheet Editor – Taxonomy Terms Pro.
|
118 |
* Fixed - Fatal error with Astra theme.
|
variation-swatches-woo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: Provides super easy shopping experience by displaying beautiful variation swatches on WooCommerce shop and product page.
|
5 |
* Author: CartFlows
|
6 |
* Author URI: https://cartflows.com/
|
7 |
-
* Version: 1.0.
|
8 |
* License: GPL v2
|
9 |
* Text Domain: variation-swatches-woo
|
10 |
*
|
@@ -22,7 +22,7 @@ define( 'CFVSW_FILE', __FILE__ );
|
|
22 |
define( 'CFVSW_BASE', plugin_basename( CFVSW_FILE ) );
|
23 |
define( 'CFVSW_DIR', plugin_dir_path( CFVSW_FILE ) );
|
24 |
define( 'CFVSW_URL', plugins_url( '/', CFVSW_FILE ) );
|
25 |
-
define( 'CFVSW_VER', '1.0.
|
26 |
define( 'CFVSW_GLOBAL', 'cfvsw_global' );
|
27 |
define( 'CFVSW_SHOP', 'cfvsw_shop' );
|
28 |
define( 'CFVSW_STYLE', 'cfvsw_style' );
|
4 |
* Description: Provides super easy shopping experience by displaying beautiful variation swatches on WooCommerce shop and product page.
|
5 |
* Author: CartFlows
|
6 |
* Author URI: https://cartflows.com/
|
7 |
+
* Version: 1.0.6
|
8 |
* License: GPL v2
|
9 |
* Text Domain: variation-swatches-woo
|
10 |
*
|
22 |
define( 'CFVSW_BASE', plugin_basename( CFVSW_FILE ) );
|
23 |
define( 'CFVSW_DIR', plugin_dir_path( CFVSW_FILE ) );
|
24 |
define( 'CFVSW_URL', plugins_url( '/', CFVSW_FILE ) );
|
25 |
+
define( 'CFVSW_VER', '1.0.6' );
|
26 |
define( 'CFVSW_GLOBAL', 'cfvsw_global' );
|
27 |
define( 'CFVSW_SHOP', 'cfvsw_shop' );
|
28 |
define( 'CFVSW_STYLE', 'cfvsw_style' );
|