Changeset 3761221
- Timestamp:
- 10/23/2026 09:00:10 AM (5 weeks ago)
- Location:
- wp-smart-variations
- Files:
-
- 129 added
- 4 deleted
- 7 edited
- 1 copied
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (modified) (1 prop) ( previous)
-
assets/icon-128x128.png (modified) (1 prop) ( previous)
-
assets/icon-256x256.png (modified) (1 prop) ( previous)
-
assets/screenshot-1.png (added)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.png (added)
-
assets/screenshot-5.png (added)
-
assets/screenshot-6.png (added)
-
assets/screenshot-7.png (added)
-
assets/screenshot-8.png (added)
-
tags/3.0.0 (copied) (copied from wp-smart-variations/trunk )
-
tags/3.0.0/assets (added)
-
tags/3.0.0/assets/legacy (added)
-
tags/3.0.0/assets/legacy/wpsc.css (added)
-
tags/3.0.0/assets/legacy/wpsc.js (added)
-
tags/3.0.0/blocks (added)
-
tags/3.0.0/blocks/variations-table (added)
-
tags/3.0.0/blocks/variations-table/block.json (added)
-
tags/3.0.0/build (added)
-
tags/3.0.0/build/admin-rtl.css (added)
-
tags/3.0.0/build/admin.asset.php (added)
-
tags/3.0.0/build/admin.css (added)
-
tags/3.0.0/build/admin.js (added)
-
tags/3.0.0/build/blocks.asset.php (added)
-
tags/3.0.0/build/blocks.js (added)
-
tags/3.0.0/build/frontend-rtl.css (added)
-
tags/3.0.0/build/frontend.asset.php (added)
-
tags/3.0.0/build/frontend.css (added)
-
tags/3.0.0/build/frontend.js (added)
-
tags/3.0.0/build/settings-rtl.css (added)
-
tags/3.0.0/build/settings.asset.php (added)
-
tags/3.0.0/build/settings.css (added)
-
tags/3.0.0/build/settings.js (added)
-
tags/3.0.0/composer.json (added)
-
tags/3.0.0/css (deleted)
-
tags/3.0.0/install.php (modified) (1 diff)
-
tags/3.0.0/readme.txt (modified) (1 diff)
-
tags/3.0.0/screenshot-1.png (deleted)
-
tags/3.0.0/src (added)
-
tags/3.0.0/src/admin (added)
-
tags/3.0.0/src/admin/class-attribute-fields.php (added)
-
tags/3.0.0/src/admin/class-product-tab.php (added)
-
tags/3.0.0/src/admin/class-settings-page.php (added)
-
tags/3.0.0/src/admin/class-term-fields.php (added)
-
tags/3.0.0/src/class-plugin.php (added)
-
tags/3.0.0/src/class-settings.php (added)
-
tags/3.0.0/src/data (added)
-
tags/3.0.0/src/data/class-swatch-data.php (added)
-
tags/3.0.0/src/front (added)
-
tags/3.0.0/src/front/class-assets.php (added)
-
tags/3.0.0/src/front/class-cart.php (added)
-
tags/3.0.0/src/front/class-gallery.php (added)
-
tags/3.0.0/src/front/class-loop-swatches.php (added)
-
tags/3.0.0/src/front/class-swatches.php (added)
-
tags/3.0.0/src/front/class-table.php (added)
-
tags/3.0.0/src/legacy (added)
-
tags/3.0.0/src/legacy/class-wpsc.php (added)
-
tags/3.0.0/src/rest (added)
-
tags/3.0.0/src/rest/class-cart-controller.php (added)
-
tags/3.0.0/src/rest/class-settings-controller.php (added)
-
tags/3.0.0/uninstall.php (added)
-
tags/3.0.0/vendor (added)
-
tags/3.0.0/vendor/autoload.php (added)
-
tags/3.0.0/vendor/composer (added)
-
tags/3.0.0/vendor/composer/ClassLoader.php (added)
-
tags/3.0.0/vendor/composer/InstalledVersions.php (added)
-
tags/3.0.0/vendor/composer/LICENSE (added)
-
tags/3.0.0/vendor/composer/autoload_classmap.php (added)
-
tags/3.0.0/vendor/composer/autoload_namespaces.php (added)
-
tags/3.0.0/vendor/composer/autoload_psr4.php (added)
-
tags/3.0.0/vendor/composer/autoload_real.php (added)
-
tags/3.0.0/vendor/composer/autoload_static.php (added)
-
tags/3.0.0/vendor/composer/installed.json (added)
-
tags/3.0.0/vendor/composer/installed.php (added)
-
tags/3.0.0/vendor/composer/platform_check.php (added)
-
trunk/assets (added)
-
trunk/assets/legacy (added)
-
trunk/assets/legacy/wpsc.css (added)
-
trunk/assets/legacy/wpsc.js (added)
-
trunk/blocks (added)
-
trunk/blocks/variations-table (added)
-
trunk/blocks/variations-table/block.json (added)
-
trunk/build (added)
-
trunk/build/admin-rtl.css (added)
-
trunk/build/admin.asset.php (added)
-
trunk/build/admin.css (added)
-
trunk/build/admin.js (added)
-
trunk/build/blocks.asset.php (added)
-
trunk/build/blocks.js (added)
-
trunk/build/frontend-rtl.css (added)
-
trunk/build/frontend.asset.php (added)
-
trunk/build/frontend.css (added)
-
trunk/build/frontend.js (added)
-
trunk/build/settings-rtl.css (added)
-
trunk/build/settings.asset.php (added)
-
trunk/build/settings.css (added)
-
trunk/build/settings.js (added)
-
trunk/composer.json (added)
-
trunk/css (deleted)
-
trunk/install.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/screenshot-1.png (deleted)
-
trunk/src (added)
-
trunk/src/admin (added)
-
trunk/src/admin/class-attribute-fields.php (added)
-
trunk/src/admin/class-product-tab.php (added)
-
trunk/src/admin/class-settings-page.php (added)
-
trunk/src/admin/class-term-fields.php (added)
-
trunk/src/class-plugin.php (added)
-
trunk/src/class-settings.php (added)
-
trunk/src/data (added)
-
trunk/src/data/class-swatch-data.php (added)
-
trunk/src/front (added)
-
trunk/src/front/class-assets.php (added)
-
trunk/src/front/class-cart.php (added)
-
trunk/src/front/class-gallery.php (added)
-
trunk/src/front/class-loop-swatches.php (added)
-
trunk/src/front/class-swatches.php (added)
-
trunk/src/front/class-table.php (added)
-
trunk/src/legacy (added)
-
trunk/src/legacy/class-wpsc.php (added)
-
trunk/src/rest (added)
-
trunk/src/rest/class-cart-controller.php (added)
-
trunk/src/rest/class-settings-controller.php (added)
-
trunk/uninstall.php (added)
-
trunk/vendor (added)
-
trunk/vendor/autoload.php (added)
-
trunk/vendor/composer (added)
-
trunk/vendor/composer/ClassLoader.php (added)
-
trunk/vendor/composer/InstalledVersions.php (added)
-
trunk/vendor/composer/LICENSE (added)
-
trunk/vendor/composer/autoload_classmap.php (added)
-
trunk/vendor/composer/autoload_namespaces.php (added)
-
trunk/vendor/composer/autoload_psr4.php (added)
-
trunk/vendor/composer/autoload_real.php (added)
-
trunk/vendor/composer/autoload_static.php (added)
-
trunk/vendor/composer/installed.json (added)
-
trunk/vendor/composer/installed.php (added)
-
trunk/vendor/composer/platform_check.php (added)
Legend:
- Unmodified
- Added
- Removed
-
wp-smart-variations/assets/banner-772x250.png
-
Property svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property svn:mime-type
changed from
-
wp-smart-variations/assets/icon-128x128.png
-
Property svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property svn:mime-type
changed from
-
wp-smart-variations/assets/icon-256x256.png
-
Property svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property svn:mime-type
changed from
-
wp-smart-variations/tags/3.0.0/install.php
r1807648 r3761221 1 1 <?php 2 /* 3 Plugin Name: WP Smart Variations 4 Author: <strong>Rajan V</strong> 5 Version: 1.0 6 Description: This is variations plugin for WP-e Commerce Site. 7 */ 2 /** 3 * Plugin Name: SwatchCraft – Variation Swatches for WooCommerce 4 * Plugin URI: https://wordpress.org/plugins/wp-smart-variations/ 5 * Description: Colour, image and button swatches for WooCommerce variations, on product pages and product cards, with variation image galleries and a variations table. 6 * Version: 3.0.0 7 * Requires at least: 6.5 8 * Requires PHP: 7.4 9 * Requires Plugins: woocommerce 10 * Author: Rajan V 11 * Author URI: https://profiles.wordpress.org/rajanit2000/ 12 * License: GPL-2.0-or-later 13 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 14 * Text Domain: wp-smart-variations 15 * WC requires at least: 9.0 16 * WC tested up to: 11.2 17 * 18 * @package SwatchCraft 19 */ 8 20 9 /* Copyright 2007-2018 Rajan V (email: ratanit2000 at gmail.com) 21 defined( 'ABSPATH' ) || exit; 10 22 11 This program is free software; you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation; either version 2 of the License, or 14 (at your option) any later version. 23 define( 'SWATCHCRAFT_VERSION', '3.0.0' ); 24 define( 'SWATCHCRAFT_FILE', __FILE__ ); 25 define( 'SWATCHCRAFT_DIR', plugin_dir_path( __FILE__ ) ); 26 define( 'SWATCHCRAFT_URL', plugin_dir_url( __FILE__ ) ); 15 27 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26 // Hook for adding admin menus 27 add_action('wp_footer', 'variationScript'); 28 add_action('wp_head', 'whshCSS'); 29 30 function whshCSS(){ 31 echo '<link type="text/css" rel="stylesheet" href="'.plugins_url().'/wp-smart-variations/css/custom.css" />'; 28 if ( ! file_exists( SWATCHCRAFT_DIR . 'vendor/autoload.php' ) ) { 29 add_action( 30 'admin_notices', 31 static function () { 32 echo '<div class="notice notice-error"><p>' . esc_html__( 'SwatchCraft is missing its vendor folder. Run composer install, or install the plugin from WordPress.org.', 'wp-smart-variations' ) . '</p></div>'; 33 } 34 ); 35 return; 32 36 } 33 37 34 function variationScript() { 35 ?> 36 <script type="text/javascript" > 37 jQuery(function(){ 38 jQuery('.wpsc_variation_forms').append('<div class="new-variation-div"></div>'); 39 var i = 0; 40 jQuery( ".wpsc_variation_forms" ).each(function() { 41 var output = ''; 42 var variation = ''; 43 jQuery(this).find('.wpsc_select_variation').each(function(){ 44 var name = jQuery(this).attr('name'); 45 jQuery(this).find('option').each(function(){ 46 var val = jQuery(this).text(); 47 var value = jQuery(this).attr('value'); 48 if( value != '0' ){ 49 variation = variation + '<label class="new-variation-radio radio-variation" for="'+name+i+'"><input class="wpsc_select_variation" type="radio" id="'+name+i+'" name="'+name+'" value="'+value+'" rel=' + val +' />'+val+'</label>'; 50 } 51 i++; 52 }); 53 variation = '<div class="variation-variation">'+variation+'</div>'; 54 output = variation; 55 }); 56 jQuery(this).find('.new-variation-div').html( output ); 57 jQuery(this).find('table').hide(); 58 }); 59 }); 60 </script> 61 <?php 62 } 38 require SWATCHCRAFT_DIR . 'vendor/autoload.php'; 63 39 64 ?> 40 register_activation_hook( __FILE__, array( 'SwatchCraft\Plugin', 'activate' ) ); 41 42 SwatchCraft\Plugin::boot(); -
wp-smart-variations/tags/3.0.0/readme.txt
r1807648 r3761221 1 === WP Smart Variations === 1 === SwatchCraft – Variation Swatches for WooCommerce === 2 2 3 Contributors: rajanit2000 3 Tags: WP-Commerce change variations, wp-ecommerce, variations, variations checkbox, variations radio, product variations, ecommerce variations 4 Requires at least: 3.0 5 Tested up to: 4.1 6 Stable tag: 4.1 4 Tags: variation swatches, color swatches, woocommerce variations, image swatches, product variations 5 Requires at least: 6.5 6 Tested up to: 7.1 7 Requires PHP: 7.4 8 Stable tag: 3.0.0 7 9 License: GPLv2 or later 8 License URI: http ://www.gnu.org/licenses/gpl-2.0.html10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 11 10 This is WP eCommerce variations Plugin for WP eCommerce Site. Its use to WP-Commerce change variations from selects to inputs 12 Colour, image and button swatches for WooCommerce variations, on product pages and shop cards. Formerly WP Smart Variations. Free. 11 13 12 14 == Description == 13 15 14 This is WP eCommerce variations Plugin for WP eCommerce Site. Its use to swap select box to radio buttons for Product variations 16 SwatchCraft replaces WooCommerce's variation dropdowns with swatches: colour dots, pattern images, size buttons or radio buttons. Shoppers see every option at once, see which ones are out of stock, and pick a variation in one click. 15 17 16 = Custom Options = 17 18 1. Install Plugin 19 2. No need short code 20 3. No need functions 18 SwatchCraft is the new name and a complete rewrite of **WP Smart Variations**. The plugin slug is still `wp-smart-variations`. Everything is free. 19 20 = Swatches = 21 22 * **Colour** swatches with one colour, or two colours split diagonally ("Navy and white"). 23 * **Image** swatches for patterns, materials and prints, chosen from the media library. 24 * **Button** swatches with the value name or a short label ("XL" for "Extra large"), and **radio** buttons. 25 * **Automatic buttons:** attributes without a swatch type show as buttons, so every product gets swatches without any setup. Switch it off to keep dropdowns for those attributes. 26 * Set the type on each attribute (Products → Attributes), colours and images on its terms, and override both per product in the new **Swatches** tab of the product data box. Custom attributes of a single product can have swatches too. 27 * Already use WooCommerce's colour and image fields on attribute terms? SwatchCraft uses them. 28 29 = Made for shoppers = 30 31 * **Unavailable** combinations are crossed out or hidden; clicking a crossed-out value starts the choice again from it. 32 * **Out-of-stock** values are crossed out, left clickable (for backorders) or hidden. 33 * The chosen value next to the attribute name ("Colour: Navy"), tooltips with the value name, and optionally its **price** and **stock**. 34 * Price, stock, image and add to cart update exactly as with dropdowns: WooCommerce still runs the form, so themes and plugins that work with variations keep working. 35 * **Accessible:** each attribute is a radio group with arrow-key navigation, and screen readers hear the names of colour and image swatches. 36 * **Large products** (hundreds of variations) work too: SwatchCraft follows WooCommerce when it loads variations one at a time. 37 * **Works without JavaScript:** the dropdowns stay until the swatches can work. 38 39 = Extras = 40 41 * **Swatches on product cards** in the shop, categories and related products. Choosing a swatch shows that variation's image on the card and links to the product with the value already chosen. Works with classic shop templates and the Product Collection block. 42 * **Variation image galleries:** add more images to each variation. Choosing it shows them in the product gallery. 43 * **Variations table:** every variation with its image, price, stock and a quantity field, added to the cart in one go. Show it below the add-to-cart form, instead of it, or only on chosen products, or place it anywhere with the **Variations Table** block or the `[swatchcraft_table id="123"]` shortcode. 44 45 = For any theme = 46 47 * Works with block themes and classic themes, on phones and desktops. 48 * Round, rounded or square swatches in three sizes, styled with CSS custom properties so your theme can restyle them. 49 * A settings page with a live preview: WooCommerce → SwatchCraft. 50 * Compatible with WooCommerce order storage (HPOS) and the cart and checkout blocks. 51 * No external services, no tracking. 21 52 22 53 == Installation == 23 54 24 1. Its very simple Install and Active 25 55 1. Install SwatchCraft from **Plugins → Add New** and activate it. WooCommerce must be active. 56 2. Your variable products now show buttons instead of dropdowns. 57 3. For colour or image swatches, go to **Products → Attributes**, edit an attribute (for example "Colour") and choose **Colour** or **Image** as its swatch type. Then open **Configure terms** and pick a colour or image for each term. 58 4. Adjust the look and the extras under **WooCommerce → SwatchCraft**. 59 26 60 == Frequently Asked Questions == 27 61 28 1. Is this plugin working without WP eCommerce Plugin? 62 = I used WP Smart Variations 1.0. What changes? = 29 63 30 No, WP eCommerce Plugin is required for this plugin 64 Version 1.0 turned WP eCommerce variation dropdowns into radio buttons. If WP eCommerce is still active on your site, that behaviour stays. SwatchCraft 3.0 adds swatches for WooCommerce. Version 1.0 stored no data, so there is nothing to move. 65 66 = Do I have to set up every product? = 67 68 No. Attributes without a swatch type show as buttons automatically. Set a colour or image type once on a global attribute and all products using it get those swatches. The product's Swatches tab is only needed for exceptions and for custom attributes of that product. 69 70 = How do I make a two-colour swatch? = 71 72 Edit the term (for example "Navy and white") and fill in both **Colour** and **Second colour**. The swatch is split diagonally between them. 73 74 = Can I keep dropdowns for some attributes? = 75 76 Yes. Choose **Dropdown** as the swatch type of the attribute, or of the attribute on one product. To keep dropdowns everywhere except where you chose a type, switch off "Buttons for attributes without a swatch type" in the settings. 77 78 = Why are out-of-stock values not crossed out on some products? = 79 80 Products with more variations than the "Large products" setting (30 by default) load variations one at a time from the server, as WooCommerce does. Their stock is known only once a variation is chosen. Raise the setting (up to 500) if your server is fast enough to send all variations with the page. 81 82 = Which attribute is shown on product cards? = 83 84 The one you choose under WooCommerce → SwatchCraft → Product cards. Automatic picks an attribute with "Show swatches on product cards" ticked, otherwise the first colour or image attribute. A product can hide its card swatches in its Swatches tab. 85 86 = Can I change how the swatches look? = 87 88 Choose the shape and size in the settings, or override the `--swatchcraft-size`, `--swatchcraft-radius`, `--swatchcraft-gap`, `--swatchcraft-border`, `--swatchcraft-active` and `--swatchcraft-surface` CSS custom properties in your theme. 89 90 = Is there an API for developers? = 91 92 Yes. The `swatchcraft_attribute_type` and `swatchcraft_attribute_options` filters change the swatch type and the values of an attribute, `swatchcraft_loaded` fires when SwatchCraft has loaded with WooCommerce, and the variations table adds to the cart through the `swatchcraft/v1/cart` REST route. 31 93 32 94 == Screenshots == 33 95 34 1. screenshot-1.png 96 1. Colour and size swatches on a product page, with the chosen values next to the attribute names. 97 2. Out-of-stock and unavailable values are crossed out; tooltips show the price and stock. 98 3. Image swatches for patterns, together with colour and size swatches. 99 4. Swatches on product cards in the shop: choosing one shows that variation's image. 100 5. The variations table: choose quantities and add several variations to the cart at once. 101 6. The settings page with a live preview. 102 7. Colours and images on attribute terms, with an optional second colour and short label. 103 8. The Swatches tab of a product: swatch type, colours and images for each attribute, product cards and the variations table. 35 104 36 105 == Changelog == 37 106 107 = 3.0.0 = 108 * New: renamed to SwatchCraft and rewritten from scratch for WooCommerce. 109 * New: colour (one or two colours), image, button and radio swatches for variation attributes, set on attributes and terms, with per-product overrides. 110 * New: automatic buttons for attributes without a swatch type, including custom product attributes. 111 * New: unavailable and out-of-stock values crossed out or hidden, the chosen value next to the attribute name, and tooltips with price and stock. 112 * New: swatches on product cards, with image swap and links to the chosen variation. 113 * New: variation image galleries. 114 * New: variations table with bulk add to cart, as a block, a shortcode or on product pages. 115 * New: settings page with a live preview under WooCommerce → SwatchCraft. 116 * New: keyboard and screen reader support, and dropdowns kept when JavaScript is off. 117 * Improvement: the WP eCommerce radio buttons of version 1.0 load from a script file instead of inline code, only where WP eCommerce runs. 118 * Requires WordPress 6.5, PHP 7.4 and WooCommerce 9.0 or later. 119 38 120 = 1.0 = 39 40 * New: WP eCommerce Variation Plugin 121 * Radio buttons for WP eCommerce variations. 41 122 42 123 == Upgrade Notice == 43 124 44 The current version of WP Smart Wishlist requires WordPress 3.0 or higher. If you use older version of WordPress, you need to upgrade WordPress first. 125 = 3.0.0 = 126 WP Smart Variations is now SwatchCraft: colour, image and button swatches for WooCommerce, with shop card swatches, variation galleries and a variations table. Requires WordPress 6.5, PHP 7.4 and WooCommerce 9.0. -
wp-smart-variations/trunk/install.php
r1807648 r3761221 1 1 <?php 2 /* 3 Plugin Name: WP Smart Variations 4 Author: <strong>Rajan V</strong> 5 Version: 1.0 6 Description: This is variations plugin for WP-e Commerce Site. 7 */ 2 /** 3 * Plugin Name: SwatchCraft – Variation Swatches for WooCommerce 4 * Plugin URI: https://wordpress.org/plugins/wp-smart-variations/ 5 * Description: Colour, image and button swatches for WooCommerce variations, on product pages and product cards, with variation image galleries and a variations table. 6 * Version: 3.0.0 7 * Requires at least: 6.5 8 * Requires PHP: 7.4 9 * Requires Plugins: woocommerce 10 * Author: Rajan V 11 * Author URI: https://profiles.wordpress.org/rajanit2000/ 12 * License: GPL-2.0-or-later 13 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 14 * Text Domain: wp-smart-variations 15 * WC requires at least: 9.0 16 * WC tested up to: 11.2 17 * 18 * @package SwatchCraft 19 */ 8 20 9 /* Copyright 2007-2018 Rajan V (email: ratanit2000 at gmail.com) 21 defined( 'ABSPATH' ) || exit; 10 22 11 This program is free software; you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation; either version 2 of the License, or 14 (at your option) any later version. 23 define( 'SWATCHCRAFT_VERSION', '3.0.0' ); 24 define( 'SWATCHCRAFT_FILE', __FILE__ ); 25 define( 'SWATCHCRAFT_DIR', plugin_dir_path( __FILE__ ) ); 26 define( 'SWATCHCRAFT_URL', plugin_dir_url( __FILE__ ) ); 15 27 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26 // Hook for adding admin menus 27 add_action('wp_footer', 'variationScript'); 28 add_action('wp_head', 'whshCSS'); 29 30 function whshCSS(){ 31 echo '<link type="text/css" rel="stylesheet" href="'.plugins_url().'/wp-smart-variations/css/custom.css" />'; 28 if ( ! file_exists( SWATCHCRAFT_DIR . 'vendor/autoload.php' ) ) { 29 add_action( 30 'admin_notices', 31 static function () { 32 echo '<div class="notice notice-error"><p>' . esc_html__( 'SwatchCraft is missing its vendor folder. Run composer install, or install the plugin from WordPress.org.', 'wp-smart-variations' ) . '</p></div>'; 33 } 34 ); 35 return; 32 36 } 33 37 34 function variationScript() { 35 ?> 36 <script type="text/javascript" > 37 jQuery(function(){ 38 jQuery('.wpsc_variation_forms').append('<div class="new-variation-div"></div>'); 39 var i = 0; 40 jQuery( ".wpsc_variation_forms" ).each(function() { 41 var output = ''; 42 var variation = ''; 43 jQuery(this).find('.wpsc_select_variation').each(function(){ 44 var name = jQuery(this).attr('name'); 45 jQuery(this).find('option').each(function(){ 46 var val = jQuery(this).text(); 47 var value = jQuery(this).attr('value'); 48 if( value != '0' ){ 49 variation = variation + '<label class="new-variation-radio radio-variation" for="'+name+i+'"><input class="wpsc_select_variation" type="radio" id="'+name+i+'" name="'+name+'" value="'+value+'" rel=' + val +' />'+val+'</label>'; 50 } 51 i++; 52 }); 53 variation = '<div class="variation-variation">'+variation+'</div>'; 54 output = variation; 55 }); 56 jQuery(this).find('.new-variation-div').html( output ); 57 jQuery(this).find('table').hide(); 58 }); 59 }); 60 </script> 61 <?php 62 } 38 require SWATCHCRAFT_DIR . 'vendor/autoload.php'; 63 39 64 ?> 40 register_activation_hook( __FILE__, array( 'SwatchCraft\Plugin', 'activate' ) ); 41 42 SwatchCraft\Plugin::boot(); -
wp-smart-variations/trunk/readme.txt
r1807648 r3761221 1 === WP Smart Variations === 1 === SwatchCraft – Variation Swatches for WooCommerce === 2 2 3 Contributors: rajanit2000 3 Tags: WP-Commerce change variations, wp-ecommerce, variations, variations checkbox, variations radio, product variations, ecommerce variations 4 Requires at least: 3.0 5 Tested up to: 4.1 6 Stable tag: 4.1 4 Tags: variation swatches, color swatches, woocommerce variations, image swatches, product variations 5 Requires at least: 6.5 6 Tested up to: 7.1 7 Requires PHP: 7.4 8 Stable tag: 3.0.0 7 9 License: GPLv2 or later 8 License URI: http ://www.gnu.org/licenses/gpl-2.0.html10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 11 10 This is WP eCommerce variations Plugin for WP eCommerce Site. Its use to WP-Commerce change variations from selects to inputs 12 Colour, image and button swatches for WooCommerce variations, on product pages and shop cards. Formerly WP Smart Variations. Free. 11 13 12 14 == Description == 13 15 14 This is WP eCommerce variations Plugin for WP eCommerce Site. Its use to swap select box to radio buttons for Product variations 16 SwatchCraft replaces WooCommerce's variation dropdowns with swatches: colour dots, pattern images, size buttons or radio buttons. Shoppers see every option at once, see which ones are out of stock, and pick a variation in one click. 15 17 16 = Custom Options = 17 18 1. Install Plugin 19 2. No need short code 20 3. No need functions 18 SwatchCraft is the new name and a complete rewrite of **WP Smart Variations**. The plugin slug is still `wp-smart-variations`. Everything is free. 19 20 = Swatches = 21 22 * **Colour** swatches with one colour, or two colours split diagonally ("Navy and white"). 23 * **Image** swatches for patterns, materials and prints, chosen from the media library. 24 * **Button** swatches with the value name or a short label ("XL" for "Extra large"), and **radio** buttons. 25 * **Automatic buttons:** attributes without a swatch type show as buttons, so every product gets swatches without any setup. Switch it off to keep dropdowns for those attributes. 26 * Set the type on each attribute (Products → Attributes), colours and images on its terms, and override both per product in the new **Swatches** tab of the product data box. Custom attributes of a single product can have swatches too. 27 * Already use WooCommerce's colour and image fields on attribute terms? SwatchCraft uses them. 28 29 = Made for shoppers = 30 31 * **Unavailable** combinations are crossed out or hidden; clicking a crossed-out value starts the choice again from it. 32 * **Out-of-stock** values are crossed out, left clickable (for backorders) or hidden. 33 * The chosen value next to the attribute name ("Colour: Navy"), tooltips with the value name, and optionally its **price** and **stock**. 34 * Price, stock, image and add to cart update exactly as with dropdowns: WooCommerce still runs the form, so themes and plugins that work with variations keep working. 35 * **Accessible:** each attribute is a radio group with arrow-key navigation, and screen readers hear the names of colour and image swatches. 36 * **Large products** (hundreds of variations) work too: SwatchCraft follows WooCommerce when it loads variations one at a time. 37 * **Works without JavaScript:** the dropdowns stay until the swatches can work. 38 39 = Extras = 40 41 * **Swatches on product cards** in the shop, categories and related products. Choosing a swatch shows that variation's image on the card and links to the product with the value already chosen. Works with classic shop templates and the Product Collection block. 42 * **Variation image galleries:** add more images to each variation. Choosing it shows them in the product gallery. 43 * **Variations table:** every variation with its image, price, stock and a quantity field, added to the cart in one go. Show it below the add-to-cart form, instead of it, or only on chosen products, or place it anywhere with the **Variations Table** block or the `[swatchcraft_table id="123"]` shortcode. 44 45 = For any theme = 46 47 * Works with block themes and classic themes, on phones and desktops. 48 * Round, rounded or square swatches in three sizes, styled with CSS custom properties so your theme can restyle them. 49 * A settings page with a live preview: WooCommerce → SwatchCraft. 50 * Compatible with WooCommerce order storage (HPOS) and the cart and checkout blocks. 51 * No external services, no tracking. 21 52 22 53 == Installation == 23 54 24 1. Its very simple Install and Active 25 55 1. Install SwatchCraft from **Plugins → Add New** and activate it. WooCommerce must be active. 56 2. Your variable products now show buttons instead of dropdowns. 57 3. For colour or image swatches, go to **Products → Attributes**, edit an attribute (for example "Colour") and choose **Colour** or **Image** as its swatch type. Then open **Configure terms** and pick a colour or image for each term. 58 4. Adjust the look and the extras under **WooCommerce → SwatchCraft**. 59 26 60 == Frequently Asked Questions == 27 61 28 1. Is this plugin working without WP eCommerce Plugin? 62 = I used WP Smart Variations 1.0. What changes? = 29 63 30 No, WP eCommerce Plugin is required for this plugin 64 Version 1.0 turned WP eCommerce variation dropdowns into radio buttons. If WP eCommerce is still active on your site, that behaviour stays. SwatchCraft 3.0 adds swatches for WooCommerce. Version 1.0 stored no data, so there is nothing to move. 65 66 = Do I have to set up every product? = 67 68 No. Attributes without a swatch type show as buttons automatically. Set a colour or image type once on a global attribute and all products using it get those swatches. The product's Swatches tab is only needed for exceptions and for custom attributes of that product. 69 70 = How do I make a two-colour swatch? = 71 72 Edit the term (for example "Navy and white") and fill in both **Colour** and **Second colour**. The swatch is split diagonally between them. 73 74 = Can I keep dropdowns for some attributes? = 75 76 Yes. Choose **Dropdown** as the swatch type of the attribute, or of the attribute on one product. To keep dropdowns everywhere except where you chose a type, switch off "Buttons for attributes without a swatch type" in the settings. 77 78 = Why are out-of-stock values not crossed out on some products? = 79 80 Products with more variations than the "Large products" setting (30 by default) load variations one at a time from the server, as WooCommerce does. Their stock is known only once a variation is chosen. Raise the setting (up to 500) if your server is fast enough to send all variations with the page. 81 82 = Which attribute is shown on product cards? = 83 84 The one you choose under WooCommerce → SwatchCraft → Product cards. Automatic picks an attribute with "Show swatches on product cards" ticked, otherwise the first colour or image attribute. A product can hide its card swatches in its Swatches tab. 85 86 = Can I change how the swatches look? = 87 88 Choose the shape and size in the settings, or override the `--swatchcraft-size`, `--swatchcraft-radius`, `--swatchcraft-gap`, `--swatchcraft-border`, `--swatchcraft-active` and `--swatchcraft-surface` CSS custom properties in your theme. 89 90 = Is there an API for developers? = 91 92 Yes. The `swatchcraft_attribute_type` and `swatchcraft_attribute_options` filters change the swatch type and the values of an attribute, `swatchcraft_loaded` fires when SwatchCraft has loaded with WooCommerce, and the variations table adds to the cart through the `swatchcraft/v1/cart` REST route. 31 93 32 94 == Screenshots == 33 95 34 1. screenshot-1.png 96 1. Colour and size swatches on a product page, with the chosen values next to the attribute names. 97 2. Out-of-stock and unavailable values are crossed out; tooltips show the price and stock. 98 3. Image swatches for patterns, together with colour and size swatches. 99 4. Swatches on product cards in the shop: choosing one shows that variation's image. 100 5. The variations table: choose quantities and add several variations to the cart at once. 101 6. The settings page with a live preview. 102 7. Colours and images on attribute terms, with an optional second colour and short label. 103 8. The Swatches tab of a product: swatch type, colours and images for each attribute, product cards and the variations table. 35 104 36 105 == Changelog == 37 106 107 = 3.0.0 = 108 * New: renamed to SwatchCraft and rewritten from scratch for WooCommerce. 109 * New: colour (one or two colours), image, button and radio swatches for variation attributes, set on attributes and terms, with per-product overrides. 110 * New: automatic buttons for attributes without a swatch type, including custom product attributes. 111 * New: unavailable and out-of-stock values crossed out or hidden, the chosen value next to the attribute name, and tooltips with price and stock. 112 * New: swatches on product cards, with image swap and links to the chosen variation. 113 * New: variation image galleries. 114 * New: variations table with bulk add to cart, as a block, a shortcode or on product pages. 115 * New: settings page with a live preview under WooCommerce → SwatchCraft. 116 * New: keyboard and screen reader support, and dropdowns kept when JavaScript is off. 117 * Improvement: the WP eCommerce radio buttons of version 1.0 load from a script file instead of inline code, only where WP eCommerce runs. 118 * Requires WordPress 6.5, PHP 7.4 and WooCommerce 9.0 or later. 119 38 120 = 1.0 = 39 40 * New: WP eCommerce Variation Plugin 121 * Radio buttons for WP eCommerce variations. 41 122 42 123 == Upgrade Notice == 43 124 44 The current version of WP Smart Wishlist requires WordPress 3.0 or higher. If you use older version of WordPress, you need to upgrade WordPress first. 125 = 3.0.0 = 126 WP Smart Variations is now SwatchCraft: colour, image and button swatches for WooCommerce, with shop card swatches, variation galleries and a variations table. Requires WordPress 6.5, PHP 7.4 and WooCommerce 9.0.
Note:
See TracChangeset
for help on using the changeset viewer.