| @@ -49,11 +49,11 @@ | ||
| 49 | 49 | $this->fileManager = $fileManager; |
| 50 | 50 | $this->settings = $settings; |
| 51 | 51 | $this->licence = $licence; |
| 52 | 52 | $this->initManagers(); |
| 53 | - if ( $this->settings->get( 'display' ) == 'yes' ) { | |
| 53 | + if ( $this->settings->get( 'display', 'yes' ) == 'yes' ) { | |
| 54 | 54 | // Render price table |
| 55 | - add_action( $this->settings->get( 'position_hook' ), [ $this, 'displayPricingTable' ], -999 ); | |
| 55 | + add_action( $this->settings->get( 'position_hook', 'woocommerce_before_add_to_cart_button' ), [ $this, 'displayPricingTable' ], -999 ); | |
| 56 | 56 | } |
| 57 | 57 | // Wrap price |
| 58 | 58 | add_action( |
| 59 | 59 | 'woocommerce_get_price_html', |
| @@ -75,9 +75,9 @@ | ||
| 75 | 75 | 10, |
| 76 | 76 | 1 |
| 77 | 77 | ); |
| 78 | 78 | // Render tooltip near product price if selected display type is "tooltip" |
| 79 | - if ( $this->settings->get( 'display' ) === 'yes' && $this->settings->get( 'display_type' ) === 'tooltip' ) { | |
| 79 | + if ( $this->settings->get( 'display', 'yes' ) === 'yes' && $this->settings->get( 'display_type' ) === 'tooltip' ) { | |
| 80 | 80 | add_filter( |
| 81 | 81 | 'woocommerce_get_price_html', |
| 82 | 82 | [ $this, 'renderTooltip' ], |
| 83 | 83 | 10, |
| @@ -148,10 +148,10 @@ | ||
| 148 | 148 | if ( $_product->is_type( 'variation' ) && $_product->get_parent_id() === $page_product_id || is_product() && $_product->is_type( 'simple' ) && $page_product_id === $_product->get_id() ) { |
| 149 | 149 | $rules = PriceManager::getPriceRules( $_product->get_id() ); |
| 150 | 150 | if ( !empty($rules) ) { |
| 151 | 151 | return $price . $this->fileManager->renderTemplate( 'frontend/tooltip.php', [ |
| 152 | - 'color' => $this->settings->get( 'tooltip_color' ), | |
| 153 | - 'size' => $this->settings->get( 'tooltip_size' ) . 'px', | |
| 152 | + 'color' => $this->settings->get( 'tooltip_color', '#cc99c2' ), | |
| 153 | + 'size' => $this->settings->get( 'tooltip_size', 15 ) . 'px', | |
| 154 | 154 | ] ); |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| @@ -187,10 +187,18 @@ | ||
| 187 | 187 | null, |
| 188 | 188 | TierPricingTablePlugin::VERSION |
| 189 | 189 | ); |
| 190 | 190 | wp_localize_script( 'tier-pricing-table-front-js', 'tieredPricingTable', [ |
| 191 | - 'product_type' => $product->get_type(), | |
| 192 | - 'settings' => $this->settings->getAll(), | |
| 191 | + 'product_type' => $product->get_type(), | |
| 192 | + 'settings' => $this->settings->getAll(), | |
| 193 | + 'is_premium' => ( $this->licence->isFree() ? 'no' : 'yes' ), | |
| 194 | + 'currency_options' => [ | |
| 195 | + 'currency_symbol' => get_woocommerce_currency_symbol(), | |
| 196 | + 'decimal_separator' => wc_get_price_decimal_separator(), | |
| 197 | + 'thousand_separator' => wc_get_price_thousand_separator(), | |
| 198 | + 'decimals' => wc_get_price_decimals(), | |
| 199 | + 'price_format' => get_woocommerce_price_format(), | |
| 200 | + ], | |
| 193 | 201 | ] ); |
| 194 | 202 | } |
| 195 | 203 | |
| 196 | 204 | } |