Changeset 1487562
- Timestamp:
- 08/31/2016 08:11:27 PM (10 years ago)
- Location:
- ithemes-exchange
- Files:
-
- 18 edited
- 1 copied
-
tags/1.35.10 (copied) (copied from ithemes-exchange/trunk)
-
tags/1.35.10/api/sales.php (modified) (1 diff)
-
tags/1.35.10/api/theme/product.php (modified) (1 diff)
-
tags/1.35.10/history.txt (modified) (1 diff)
-
tags/1.35.10/init.php (modified) (2 diffs)
-
tags/1.35.10/lang/ithemes-exchange.pot (modified) (7 diffs)
-
tags/1.35.10/lib/admin/js/add-edit-product.js (modified) (1 diff)
-
tags/1.35.10/lib/product-features/class.sale-price.php (modified) (7 diffs)
-
tags/1.35.10/lib/super-widget/class.super-widget.php (modified) (8 diffs)
-
tags/1.35.10/readme.txt (modified) (2 diffs)
-
trunk/api/sales.php (modified) (1 diff)
-
trunk/api/theme/product.php (modified) (1 diff)
-
trunk/history.txt (modified) (1 diff)
-
trunk/init.php (modified) (2 diffs)
-
trunk/lang/ithemes-exchange.pot (modified) (7 diffs)
-
trunk/lib/admin/js/add-edit-product.js (modified) (1 diff)
-
trunk/lib/product-features/class.sale-price.php (modified) (7 diffs)
-
trunk/lib/super-widget/class.super-widget.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ithemes-exchange/tags/1.35.10/api/sales.php
r1337460 r1487562 64 64 65 65 $sale_price = it_exchange_get_product_feature( $product_id, 'sale-price' ); 66 $sale_price = it_exchange_format_price( $sale_price ); 66 67 if ( empty( $sale_price ) || $sale_price === 0.00 ) { 68 $sale_price = __( 'Free', 'it-l10n-ithemes-exchange' ); 69 } else { 70 $sale_price = it_exchange_format_price( $sale_price ); 71 } 67 72 68 73 remove_filter( 'it_exchange_api_theme_product_base_price', 'it_exchange_add_sale_information_to_base_price_theme', 20 ); -
ithemes-exchange/tags/1.35.10/api/theme/product.php
r1460445 r1487562 944 944 function superwidget( $options=array() ) { 945 945 946 $show = true;947 948 global $wp_registered_widgets;949 950 $sidebars = wp_get_sidebars_widgets();951 952 foreach ( $sidebars as $widgets ) {953 foreach ( $widgets as $widget ) {954 955 if ( strpos( $widget, 'it-exchange-super-widget' ) !== false ) {956 $show = false;957 958 break 2;959 }960 }961 }962 963 946 // Return boolean if has flag was set. Just keeping this here since its in all other product.php methods 964 947 if ( $options['supports'] ) { 965 return $show;948 return true; 966 949 } 967 950 968 951 // Return boolean if has flag was set 969 952 if ( $options['has'] ) { 970 return $show; 971 } 972 973 if ( ! $show ) { 974 return ''; 953 return true; 975 954 } 976 955 -
ithemes-exchange/tags/1.35.10/history.txt
r1460445 r1487562 1299 1299 Tweak: Don't autoload transient transactions 1300 1300 Tweak: Update lib/classes 1301 1.35.10 - Elise Alley, Timothy Jacobs 1302 Fix: Issue with the Super Widget not rendering correctly 1303 Tweak: Add support for sale price to make a product free -
ithemes-exchange/tags/1.35.10/init.php
r1460445 r1487562 2 2 /* 3 3 * Plugin Name: iThemes Exchange 4 * Version: 1.35. 94 * Version: 1.35.10 5 5 * Text Domain: it-l10n-ithemes-exchange 6 6 * Description: Easily sell your digital goods with iThemes Exchange, simple ecommerce for WordPress … … 25 25 class IT_Exchange { 26 26 27 var $_version = '1.35. 9';27 var $_version = '1.35.10'; 28 28 var $_wp_minimum = '3.5'; 29 29 var $_slug = 'ithemes-exchange'; -
ithemes-exchange/tags/1.35.10/lang/ithemes-exchange.pot
r1460445 r1487562 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: iThemes Exchange 1.35. 9\n"5 "Project-Id-Version: iThemes Exchange 1.35.10\n" 6 6 "Report-Msgid-Bugs-To: http://ithemes.com/support/\n" 7 "POT-Creation-Date: 2016-0 7-25 19:19:43+00:00\n"7 "POT-Creation-Date: 2016-08-31 15:10:37+00:00\n" 8 8 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" 9 9 "MIME-Version: 1.0\n" … … 2508 2508 #: api/misc.php:367 2509 2509 msgid "Please complete all purchase requirements before checkout out." 2510 msgstr "" 2511 2512 #: api/sales.php:68 api/theme/product.php:211 2513 #: lib/product-features/class.sale-price.php:226 2514 msgid "Free" 2510 2515 msgstr "" 2511 2516 … … 2700 2705 msgstr "" 2701 2706 2702 #: api/theme/product.php:2112703 msgid "Free"2704 msgstr ""2705 2706 2707 #: api/theme/product.php:264 2707 2708 msgid "(more info)" 2708 2709 msgstr "" 2709 2710 2710 #: api/theme/product.php:861 api/theme/product.php: 10142711 #: api/theme/product.php:861 api/theme/product.php:993 2711 2712 #: lib/admin/views/admin-get-more-addons.php:71 2712 2713 msgid "Buy Now" 2713 2714 msgstr "" 2714 2715 2715 #: api/theme/product.php:868 api/theme/product.php:10 842716 #: api/theme/product.php:868 api/theme/product.php:1063 2716 2717 msgid "Add to Cart" 2717 2718 msgstr "" … … 2725 2726 msgstr "" 2726 2727 2727 #: api/theme/product.php: 1017 api/theme/product.php:10872728 #: api/theme/product.php:996 api/theme/product.php:1066 2728 2729 msgid "Out of stock." 2729 2730 msgstr "" 2730 2731 2731 #: api/theme/product.php: 1018 api/theme/product.php:10882732 #: api/theme/product.php:997 api/theme/product.php:1067 2732 2733 msgid "Product not available right now." 2733 2734 msgstr "" 2734 2735 2735 #: api/theme/product.php:10 902736 #: api/theme/product.php:1069 2736 2737 msgid "Max Quantity Reached" 2737 2738 msgstr "" … … 2883 2884 msgstr "" 2884 2885 2885 #. #-#-#-#-# ithemes-exchange.pot (iThemes Exchange 1.35. 9) #-#-#-#-#2886 #. #-#-#-#-# ithemes-exchange.pot (iThemes Exchange 1.35.10) #-#-#-#-# 2886 2887 #. Plugin Name of the plugin/theme 2887 2888 #: core-addons/admin/basic-reporting/init.php:21 … … 7253 7254 msgstr "" 7254 7255 7255 #: lib/super-widget/class.super-widget.php: 487256 #: lib/super-widget/class.super-widget.php:58 7256 7257 msgid "iThemes Exchange Super Widget" 7257 7258 msgstr "" 7258 7259 7259 #: lib/super-widget/class.super-widget.php: 507260 #: lib/super-widget/class.super-widget.php:60 7260 7261 msgid "" 7261 7262 "Handles Buy Now, Add to Cart, Cart Summary, Registration, Log in, and " … … 7263 7264 msgstr "" 7264 7265 7265 #: lib/super-widget/class.super-widget.php: 1897266 #: lib/super-widget/class.super-widget.php:217 7266 7267 msgid "Processing" 7267 7268 msgstr "" 7268 7269 7269 #: lib/super-widget/class.super-widget.php: 1907270 #: lib/super-widget/class.super-widget.php:218 7270 7271 msgid "Processing... " 7271 7272 msgstr "" 7272 7273 7273 #: lib/super-widget/class.super-widget.php:2 427274 #: lib/super-widget/class.super-widget.php:272 7274 7275 msgid "There are no options for this widget." 7275 7276 msgstr "" -
ithemes-exchange/tags/1.35.10/lib/admin/js/add-edit-product.js
r1349143 r1487562 766 766 $( '#sale-price' ).on( 'focusout', function() { 767 767 768 if ( $(this).val() == '0.00' || $(this).val() == '') {768 if ( ! $(this).val().length ) { 769 769 return; 770 770 } -
ithemes-exchange/tags/1.35.10/lib/product-features/class.sale-price.php
r1304261 r1487562 46 46 $sale_price = it_exchange_get_product_feature( $product->ID, $this->slug ); 47 47 48 if ( empty( $sale_price ) || $sale_price == '0.00') {48 if ( ! $product->has_feature( $this->slug ) ) { 49 49 $sale_price = ''; 50 50 } else { … … 63 63 ?> 64 64 <label for="sale-price"><?php esc_html_e( $description ); ?></label> 65 <input type="text" placeholder=" <?php esc_attr_e( it_exchange_format_price( 0 ) ); ?>"65 <input type="text" placeholder="" 66 66 id="sale-price" name="it-exchange-sale-price" value="<?php esc_attr_e( $sale_price ); ?>" tabindex="3" 67 67 data-symbol="<?php esc_attr_e( $currency ); ?>" data-symbol-position="<?php esc_attr_e( $settings['currency-symbol-position'] ); ?>" … … 100 100 } 101 101 102 if ( ! empty( $_POST['it-exchange-sale-price'] ) ) {102 if ( isset( $_POST['it-exchange-sale-price'] ) ) { 103 103 $new_price = $_POST['it-exchange-sale-price']; 104 104 } else { 105 $new_price = 0;105 $new_price = ''; 106 106 } 107 107 … … 128 128 $options = ITUtility::merge_defaults( $options, $defaults ); 129 129 130 if ( $options['setting'] == 'sale-price' ) { 130 if ( $options['setting'] === 'sale-price' ) { 131 132 if ( $new_value === '' ) { 133 return delete_post_meta( $product_id, '_it_exchange_sale_price' ); 134 } 131 135 132 136 $new_value = it_exchange_convert_to_database_number( $new_value ); 133 137 134 if ( empty( $new_value ) ) { 135 return delete_post_meta( $product_id, '_it_exchange_sale_price' ); 136 } else { 137 return update_post_meta( $product_id, '_it_exchange_sale_price', $new_value ); 138 } 138 return update_post_meta( $product_id, '_it_exchange_sale_price', $new_value ); 139 139 } 140 140 … … 162 162 163 163 if ( $options['setting'] == 'sale-price' ) { 164 return it_exchange_convert_from_database_number( get_post_meta( $product_id, '_it_exchange_sale_price', true ) );164 return (float) it_exchange_convert_from_database_number( get_post_meta( $product_id, '_it_exchange_sale_price', true ) ); 165 165 } 166 166 … … 180 180 */ 181 181 public function product_has_feature( $result, $product_id, $options = array() ) { 182 $price = it_exchange_get_product_feature( $product_id, $this->slug ); 183 $db_number = (int) it_exchange_convert_to_database_number( $price ); 184 185 return ! empty( $db_number ); 182 return metadata_exists( 'post', $product_id, '_it_exchange_sale_price' ); 186 183 } 187 184 … … 226 223 227 224 if ( $format ) { 228 $base_price = it_exchange_format_price( $base_price ); 225 if ( empty( $base_price ) ) { 226 $base_price = __( 'Free', 'it-l10n-ithemes-exchange' ); 227 } else { 228 $base_price = it_exchange_format_price( $base_price ); 229 } 229 230 } 230 231 } -
ithemes-exchange/tags/1.35.10/lib/super-widget/class.super-widget.php
r1349143 r1487562 40 40 41 41 /** 42 * @var bool 43 */ 44 private $in_sidebar = false; 45 46 /** 47 * @var bool 48 */ 49 private $rendered = false; 50 51 /** 42 52 * Constructor: Init 43 53 * … … 59 69 add_action( 'template_redirect', array( $this, 'set_state' ), 11 ); 60 70 add_action( 'dynamic_sidebar_before', array( $this, 'maybe_remove_sw_from_sidebar' ) ); 71 add_action( 'dynamic_sidebar_after', array( $this, 'mark_out_of_sidebar' ) ); 61 72 } 62 73 } … … 111 122 */ 112 123 $args = apply_filters( 'it_exchange_super_widget_args', $args, $product_id ); 124 125 if ( $this->rendered ) { 126 127 if ( ! $this->in_sidebar ) { 128 return; 129 } 130 131 $might_remove = false; 132 $remove_others = true; 133 } else { 134 $remove_others = false; 135 $might_remove = true; 136 } 113 137 114 138 // Some JS we're going to need … … 124 148 jQuery(function () { 125 149 150 <?php if ( $remove_others ) : ?> 151 jQuery('.it-exchange-super-widget[data-might-remove="1"]').remove(); 152 <?php endif; ?> 153 126 154 <?php $shipping_addons = it_exchange_get_enabled_addons( array( 'category' => 'shipping' ) ); if ( ! empty( $shipping_addons) ) : ?> 127 155 // Shipping Init country/state fields … … 152 180 echo $args['before_widget']; 153 181 ?> 154 <div class="it-exchange-super-widget it-exchange-super-widget-<?php esc_attr_e( $this->get_state() ); ?>" >182 <div class="it-exchange-super-widget it-exchange-super-widget-<?php esc_attr_e( $this->get_state() ); ?>" data-might-remove="<?php echo $might_remove; ?>"> 155 183 <style type="text/css"> 156 184 .it-exchange-super-widget .spinner { … … 210 238 unset( $GLOBALS['it_exchange']['in_superwidget'] ); 211 239 } 240 241 $this->rendered = true; 212 242 } 213 243 … … 397 427 public function maybe_remove_sw_from_sidebar( $index ) { 398 428 429 $this->in_sidebar = true; 430 399 431 if ( IT_Exchange_SW_Shortcode::has_shortcode() && ! ( is_archive() || is_home() ) ) { 400 432 … … 416 448 } 417 449 } 450 } 451 452 /** 453 * Mark that we are no longer in the sidebar. 454 * 455 * @since 1.36.0 456 */ 457 public function mark_out_of_sidebar() { 458 $this->in_sidebar = false; 418 459 } 419 460 } -
ithemes-exchange/tags/1.35.10/readme.txt
r1460445 r1487562 4 4 Requires at least: 3.7 5 5 Tested up to: 4.6 6 Stable tag: 1.35. 96 Stable tag: 1.35.10 7 7 License: GPLv2 or later 8 8 … … 88 88 89 89 == Changelog == 90 91 = 1.35.10 = 92 * Fix: Issue with the Super Widget not rendering correctly 93 * Tweak: Add support for sale price to make a product free 90 94 91 95 = 1.35.9 = -
ithemes-exchange/trunk/api/sales.php
r1337460 r1487562 64 64 65 65 $sale_price = it_exchange_get_product_feature( $product_id, 'sale-price' ); 66 $sale_price = it_exchange_format_price( $sale_price ); 66 67 if ( empty( $sale_price ) || $sale_price === 0.00 ) { 68 $sale_price = __( 'Free', 'it-l10n-ithemes-exchange' ); 69 } else { 70 $sale_price = it_exchange_format_price( $sale_price ); 71 } 67 72 68 73 remove_filter( 'it_exchange_api_theme_product_base_price', 'it_exchange_add_sale_information_to_base_price_theme', 20 ); -
ithemes-exchange/trunk/api/theme/product.php
r1460445 r1487562 944 944 function superwidget( $options=array() ) { 945 945 946 $show = true;947 948 global $wp_registered_widgets;949 950 $sidebars = wp_get_sidebars_widgets();951 952 foreach ( $sidebars as $widgets ) {953 foreach ( $widgets as $widget ) {954 955 if ( strpos( $widget, 'it-exchange-super-widget' ) !== false ) {956 $show = false;957 958 break 2;959 }960 }961 }962 963 946 // Return boolean if has flag was set. Just keeping this here since its in all other product.php methods 964 947 if ( $options['supports'] ) { 965 return $show;948 return true; 966 949 } 967 950 968 951 // Return boolean if has flag was set 969 952 if ( $options['has'] ) { 970 return $show; 971 } 972 973 if ( ! $show ) { 974 return ''; 953 return true; 975 954 } 976 955 -
ithemes-exchange/trunk/history.txt
r1460445 r1487562 1299 1299 Tweak: Don't autoload transient transactions 1300 1300 Tweak: Update lib/classes 1301 1.35.10 - Elise Alley, Timothy Jacobs 1302 Fix: Issue with the Super Widget not rendering correctly 1303 Tweak: Add support for sale price to make a product free -
ithemes-exchange/trunk/init.php
r1460445 r1487562 2 2 /* 3 3 * Plugin Name: iThemes Exchange 4 * Version: 1.35. 94 * Version: 1.35.10 5 5 * Text Domain: it-l10n-ithemes-exchange 6 6 * Description: Easily sell your digital goods with iThemes Exchange, simple ecommerce for WordPress … … 25 25 class IT_Exchange { 26 26 27 var $_version = '1.35. 9';27 var $_version = '1.35.10'; 28 28 var $_wp_minimum = '3.5'; 29 29 var $_slug = 'ithemes-exchange'; -
ithemes-exchange/trunk/lang/ithemes-exchange.pot
r1460445 r1487562 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: iThemes Exchange 1.35. 9\n"5 "Project-Id-Version: iThemes Exchange 1.35.10\n" 6 6 "Report-Msgid-Bugs-To: http://ithemes.com/support/\n" 7 "POT-Creation-Date: 2016-0 7-25 19:19:43+00:00\n"7 "POT-Creation-Date: 2016-08-31 15:10:37+00:00\n" 8 8 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" 9 9 "MIME-Version: 1.0\n" … … 2508 2508 #: api/misc.php:367 2509 2509 msgid "Please complete all purchase requirements before checkout out." 2510 msgstr "" 2511 2512 #: api/sales.php:68 api/theme/product.php:211 2513 #: lib/product-features/class.sale-price.php:226 2514 msgid "Free" 2510 2515 msgstr "" 2511 2516 … … 2700 2705 msgstr "" 2701 2706 2702 #: api/theme/product.php:2112703 msgid "Free"2704 msgstr ""2705 2706 2707 #: api/theme/product.php:264 2707 2708 msgid "(more info)" 2708 2709 msgstr "" 2709 2710 2710 #: api/theme/product.php:861 api/theme/product.php: 10142711 #: api/theme/product.php:861 api/theme/product.php:993 2711 2712 #: lib/admin/views/admin-get-more-addons.php:71 2712 2713 msgid "Buy Now" 2713 2714 msgstr "" 2714 2715 2715 #: api/theme/product.php:868 api/theme/product.php:10 842716 #: api/theme/product.php:868 api/theme/product.php:1063 2716 2717 msgid "Add to Cart" 2717 2718 msgstr "" … … 2725 2726 msgstr "" 2726 2727 2727 #: api/theme/product.php: 1017 api/theme/product.php:10872728 #: api/theme/product.php:996 api/theme/product.php:1066 2728 2729 msgid "Out of stock." 2729 2730 msgstr "" 2730 2731 2731 #: api/theme/product.php: 1018 api/theme/product.php:10882732 #: api/theme/product.php:997 api/theme/product.php:1067 2732 2733 msgid "Product not available right now." 2733 2734 msgstr "" 2734 2735 2735 #: api/theme/product.php:10 902736 #: api/theme/product.php:1069 2736 2737 msgid "Max Quantity Reached" 2737 2738 msgstr "" … … 2883 2884 msgstr "" 2884 2885 2885 #. #-#-#-#-# ithemes-exchange.pot (iThemes Exchange 1.35. 9) #-#-#-#-#2886 #. #-#-#-#-# ithemes-exchange.pot (iThemes Exchange 1.35.10) #-#-#-#-# 2886 2887 #. Plugin Name of the plugin/theme 2887 2888 #: core-addons/admin/basic-reporting/init.php:21 … … 7253 7254 msgstr "" 7254 7255 7255 #: lib/super-widget/class.super-widget.php: 487256 #: lib/super-widget/class.super-widget.php:58 7256 7257 msgid "iThemes Exchange Super Widget" 7257 7258 msgstr "" 7258 7259 7259 #: lib/super-widget/class.super-widget.php: 507260 #: lib/super-widget/class.super-widget.php:60 7260 7261 msgid "" 7261 7262 "Handles Buy Now, Add to Cart, Cart Summary, Registration, Log in, and " … … 7263 7264 msgstr "" 7264 7265 7265 #: lib/super-widget/class.super-widget.php: 1897266 #: lib/super-widget/class.super-widget.php:217 7266 7267 msgid "Processing" 7267 7268 msgstr "" 7268 7269 7269 #: lib/super-widget/class.super-widget.php: 1907270 #: lib/super-widget/class.super-widget.php:218 7270 7271 msgid "Processing... " 7271 7272 msgstr "" 7272 7273 7273 #: lib/super-widget/class.super-widget.php:2 427274 #: lib/super-widget/class.super-widget.php:272 7274 7275 msgid "There are no options for this widget." 7275 7276 msgstr "" -
ithemes-exchange/trunk/lib/admin/js/add-edit-product.js
r1349143 r1487562 766 766 $( '#sale-price' ).on( 'focusout', function() { 767 767 768 if ( $(this).val() == '0.00' || $(this).val() == '') {768 if ( ! $(this).val().length ) { 769 769 return; 770 770 } -
ithemes-exchange/trunk/lib/product-features/class.sale-price.php
r1304261 r1487562 46 46 $sale_price = it_exchange_get_product_feature( $product->ID, $this->slug ); 47 47 48 if ( empty( $sale_price ) || $sale_price == '0.00') {48 if ( ! $product->has_feature( $this->slug ) ) { 49 49 $sale_price = ''; 50 50 } else { … … 63 63 ?> 64 64 <label for="sale-price"><?php esc_html_e( $description ); ?></label> 65 <input type="text" placeholder=" <?php esc_attr_e( it_exchange_format_price( 0 ) ); ?>"65 <input type="text" placeholder="" 66 66 id="sale-price" name="it-exchange-sale-price" value="<?php esc_attr_e( $sale_price ); ?>" tabindex="3" 67 67 data-symbol="<?php esc_attr_e( $currency ); ?>" data-symbol-position="<?php esc_attr_e( $settings['currency-symbol-position'] ); ?>" … … 100 100 } 101 101 102 if ( ! empty( $_POST['it-exchange-sale-price'] ) ) {102 if ( isset( $_POST['it-exchange-sale-price'] ) ) { 103 103 $new_price = $_POST['it-exchange-sale-price']; 104 104 } else { 105 $new_price = 0;105 $new_price = ''; 106 106 } 107 107 … … 128 128 $options = ITUtility::merge_defaults( $options, $defaults ); 129 129 130 if ( $options['setting'] == 'sale-price' ) { 130 if ( $options['setting'] === 'sale-price' ) { 131 132 if ( $new_value === '' ) { 133 return delete_post_meta( $product_id, '_it_exchange_sale_price' ); 134 } 131 135 132 136 $new_value = it_exchange_convert_to_database_number( $new_value ); 133 137 134 if ( empty( $new_value ) ) { 135 return delete_post_meta( $product_id, '_it_exchange_sale_price' ); 136 } else { 137 return update_post_meta( $product_id, '_it_exchange_sale_price', $new_value ); 138 } 138 return update_post_meta( $product_id, '_it_exchange_sale_price', $new_value ); 139 139 } 140 140 … … 162 162 163 163 if ( $options['setting'] == 'sale-price' ) { 164 return it_exchange_convert_from_database_number( get_post_meta( $product_id, '_it_exchange_sale_price', true ) );164 return (float) it_exchange_convert_from_database_number( get_post_meta( $product_id, '_it_exchange_sale_price', true ) ); 165 165 } 166 166 … … 180 180 */ 181 181 public function product_has_feature( $result, $product_id, $options = array() ) { 182 $price = it_exchange_get_product_feature( $product_id, $this->slug ); 183 $db_number = (int) it_exchange_convert_to_database_number( $price ); 184 185 return ! empty( $db_number ); 182 return metadata_exists( 'post', $product_id, '_it_exchange_sale_price' ); 186 183 } 187 184 … … 226 223 227 224 if ( $format ) { 228 $base_price = it_exchange_format_price( $base_price ); 225 if ( empty( $base_price ) ) { 226 $base_price = __( 'Free', 'it-l10n-ithemes-exchange' ); 227 } else { 228 $base_price = it_exchange_format_price( $base_price ); 229 } 229 230 } 230 231 } -
ithemes-exchange/trunk/lib/super-widget/class.super-widget.php
r1349143 r1487562 40 40 41 41 /** 42 * @var bool 43 */ 44 private $in_sidebar = false; 45 46 /** 47 * @var bool 48 */ 49 private $rendered = false; 50 51 /** 42 52 * Constructor: Init 43 53 * … … 59 69 add_action( 'template_redirect', array( $this, 'set_state' ), 11 ); 60 70 add_action( 'dynamic_sidebar_before', array( $this, 'maybe_remove_sw_from_sidebar' ) ); 71 add_action( 'dynamic_sidebar_after', array( $this, 'mark_out_of_sidebar' ) ); 61 72 } 62 73 } … … 111 122 */ 112 123 $args = apply_filters( 'it_exchange_super_widget_args', $args, $product_id ); 124 125 if ( $this->rendered ) { 126 127 if ( ! $this->in_sidebar ) { 128 return; 129 } 130 131 $might_remove = false; 132 $remove_others = true; 133 } else { 134 $remove_others = false; 135 $might_remove = true; 136 } 113 137 114 138 // Some JS we're going to need … … 124 148 jQuery(function () { 125 149 150 <?php if ( $remove_others ) : ?> 151 jQuery('.it-exchange-super-widget[data-might-remove="1"]').remove(); 152 <?php endif; ?> 153 126 154 <?php $shipping_addons = it_exchange_get_enabled_addons( array( 'category' => 'shipping' ) ); if ( ! empty( $shipping_addons) ) : ?> 127 155 // Shipping Init country/state fields … … 152 180 echo $args['before_widget']; 153 181 ?> 154 <div class="it-exchange-super-widget it-exchange-super-widget-<?php esc_attr_e( $this->get_state() ); ?>" >182 <div class="it-exchange-super-widget it-exchange-super-widget-<?php esc_attr_e( $this->get_state() ); ?>" data-might-remove="<?php echo $might_remove; ?>"> 155 183 <style type="text/css"> 156 184 .it-exchange-super-widget .spinner { … … 210 238 unset( $GLOBALS['it_exchange']['in_superwidget'] ); 211 239 } 240 241 $this->rendered = true; 212 242 } 213 243 … … 397 427 public function maybe_remove_sw_from_sidebar( $index ) { 398 428 429 $this->in_sidebar = true; 430 399 431 if ( IT_Exchange_SW_Shortcode::has_shortcode() && ! ( is_archive() || is_home() ) ) { 400 432 … … 416 448 } 417 449 } 450 } 451 452 /** 453 * Mark that we are no longer in the sidebar. 454 * 455 * @since 1.36.0 456 */ 457 public function mark_out_of_sidebar() { 458 $this->in_sidebar = false; 418 459 } 419 460 } -
ithemes-exchange/trunk/readme.txt
r1460445 r1487562 4 4 Requires at least: 3.7 5 5 Tested up to: 4.6 6 Stable tag: 1.35. 96 Stable tag: 1.35.10 7 7 License: GPLv2 or later 8 8 … … 88 88 89 89 == Changelog == 90 91 = 1.35.10 = 92 * Fix: Issue with the Super Widget not rendering correctly 93 * Tweak: Add support for sale price to make a product free 90 94 91 95 = 1.35.9 =
Note: See TracChangeset
for help on using the changeset viewer.