Changeset 3090318
- Timestamp:
- 05/21/2024 04:52:48 PM (14 months ago)
- Location:
- woo-price-per-unit/trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
woo-price-per-unit/trunk/includes/database-upgrade.php
r2599970 r3090318 1 1 <?php 2 2 /** 3 * Upgrades plugin database to the latest version4 *5 * @package PricePerUnit/Admin6 */3 * Upgrades plugin database to the latest version 4 * 5 * @package PricePerUnit/Admin 6 */ 7 7 8 $used_db_version = get_option('_mcmp_ppu_free_db_version', '1.0.0'); 9 if (version_compare($used_db_version, '2.0.8', '<')) { 10 add_option('_mcmp_ppu_cart_show_sale_price', 'no'); 8 $used_db_version = get_option( '_mcmp_ppu_free_db_version', '1.0.0' ); 9 $require_approval = false; 10 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 11 $update_approved = isset( $_REQUEST['mcmp-ppu-free-upgrade-db'] ); 12 // General query posts quantity setting. 13 $posts_per_page = 200; 14 if ( version_compare( $used_db_version, '1.6', '<' ) ) { 15 $old_opt = get_option( '_mcmp_ppu_general_behaviour' ); 16 if ( false !== $old_opt ) { 17 $old_opt = ( empty( $old_opt ) ) ? 'not' : $old_opt; 18 update_option( '_mcmp_ppu_general', $old_opt ); 19 delete_option( '_mcmp_ppu_general_behaviour' ); 20 } 21 $old_opt = get_option( '_mcmp_ppu_single_page_behaviour' ); 22 if ( false !== $old_opt ) { 23 $old_opt = ( empty( $old_opt ) ) ? 'not' : $old_opt; 24 update_option( '_mcmp_ppu_single_page', $old_opt ); 25 delete_option( '_mcmp_ppu_single_page_behaviour' ); 26 } 11 27 } 12 update_option('_mcmp_ppu_free_db_version', MCMP_PPU_FREE_PLUGIN_VERSION); 28 if ( version_compare( $used_db_version, '2.0.8', '<' ) ) { 29 add_option( '_mcmp_ppu_cart_show_sale_price', 'no' ); 30 } 31 /** 32 * General update manipulation 33 */ 34 35 // Approval required - create a message with link to approve on it. 36 if ( true == $require_approval ) { 37 if ( false == $update_approved ) { 38 $message = esc_html__( 'WooCommerce Price per Unit - database needs an update. Please back up your database first!', 'woo-price-per-unit' ) . 39 '<p><a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=products§ion=mcmp_price_pu&mcmp-ppu-free-upgrade-db' ) ) . '">' . esc_html__( 'Upgrade database', 'woo-price-per-unit' ) . '</a></p>'; 40 $this->mcmp_add_message( $message, 'warning', 'ppu-free-notice' ); 41 } else { 42 $message = esc_html__( 'WooCommerce Price per Unit - database updated successfully.', 'woo-price-per-unit' ); 43 $this->mcmp_add_message( $message, 'success', 'ppu-free-notice' ); 44 } 45 } 46 47 // When approval not required or update already approved. 48 if ( false == $require_approval || true == $update_approved ) { 49 update_option( '_mcmp_ppu_free_db_version', MCMP_PPU_FREE_PLUGIN_VERSION ); 50 } 51 52 // Remove the approval after update. 53 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 54 if ( isset( $_REQUEST['mcmp-ppu-free-upgrade-db'] ) ) { 55 $url = home_url( remove_query_arg( 'mcmp-ppu-free-upgrade-db', false ) ); 56 wp_safe_redirect( $url ); 57 exit; 58 } -
woo-price-per-unit/trunk/includes/general-setting-defaults.php
r2599970 r3090318 1 1 <?php 2 2 /** 3 * Adds default settings for general settings - Price per Unit4 *5 * @package PricePerUnit/Admin6 */3 * Adds default settings for general settings - Price per Unit 4 * 5 * @package PricePerUnit/Admin 6 */ 7 7 8 if ( !defined('ABSPATH')):9 exit; // Exit if accessed directly 8 if ( ! defined( 'ABSPATH' ) ) : 9 exit; // Exit if accessed directly. 10 10 endif; 11 11 // Is it new installation? 12 12 if ( false === get_option( '_mcmp_ppu_delete_meta' ) ) { 13 // Do not process database upgrade for new installation.13 // Do not process database upgrade for new installation. 14 14 update_option( '_mcmp_ppu_free_db_version', MCMP_PPU_FREE_PLUGIN_VERSION ); 15 15 } 16 16 17 $this->legacy_options_fix(); 18 add_option('_mcmp_ppu_general', 'add'); 19 add_option('_mcmp_ppu_single_page', 'add'); 20 add_option('_mcmp_ppu_cart_page', 'single'); 21 add_option('_mcmp_ppu_add_row_css', 'yes'); 22 add_option('_mcmp_ppu_recalc_text', '-automatic-'); 23 add_option('_mcmp_ppu_recalc_text_options', '/kg|/oz|/g|/lbs'); 24 add_option('_mcmp_ppu_var_display_option_recalc', 'yes'); 25 add_option('_mcmp_ppu_recalc_per_units', ''); 26 add_option('_mcmp_ppu_delete_meta',false); 27 add_option('_mcmp_ppu_recalc_text_automatic_preposition','/'); 28 add_option('_mcmp_ppu_recalc_text_separate','yes'); 29 add_option('_mcmp_ppu_disable_price_rounding','no'); 30 add_option('_mcmp_ppu_var_prefix_text',''); 31 add_option('_mcmp_ppu_recalc_text_prefix',''); 32 add_option('_mcmp_ppu_cart_show_sale_price', 'no'); 17 add_option( '_mcmp_ppu_additional_text', '' ); 18 add_option( '_mcmp_ppu_hide_sale_price', 'no' ); 19 add_option( '_mcmp_ppu_var_prefix_text', '' ); 20 add_option( '_mcmp_ppu_var_hide_max_price', 'no' ); 21 add_option( '_mcmp_ppu_var_show_sale_price', 'no' ); 22 add_option( '_mcmp_ppu_add_row_css', 'yes' ); 23 add_option( '_mcmp_ppu_general', 'add' ); 24 add_option( '_mcmp_ppu_single_page', 'add' ); 25 add_option( '_mcmp_ppu_cart_page', 'single' ); 26 add_option( '_mcmp_ppu_cart_show_sale_price', 'no' ); 27 add_option( '_mcmp_ppu_recalc_text', '-automatic-' ); 28 add_option( '_mcmp_ppu_recalc_text_automatic_preposition', '/' ); 29 add_option( '_mcmp_ppu_recalc_text_options', '/kg|/oz|/g|/lbs' ); 30 add_option( '_mcmp_ppu_recalc_text_separate', 'yes' ); 31 add_option( '_mcmp_ppu_recalc_text_prefix', '' ); 32 add_option( '_mcmp_ppu_disable_price_rounding', 'no' ); 33 add_option( '_mcmp_ppu_delete_meta', false ); -
woo-price-per-unit/trunk/includes/general-settings.php
r2599970 r3090318 1 1 <?php 2 2 /** 3 * Displays custom settings in WooCommerce general settings under product - Price per unit4 *5 * @package PricePerUnit/Admin6 * @return array Settings for new tab in WooCommerce settings7 */8 9 if ( !defined('ABSPATH')):10 exit; // Exit if accessed directly 3 * Displays custom settings in WooCommerce general settings under product - Price per unit 4 * 5 * @package PricePerUnit/Admin 6 * @return array Settings for new tab in WooCommerce settings 7 */ 8 9 if ( ! defined( 'ABSPATH' ) ) : 10 exit; // Exit if accessed directly. 11 11 endif; 12 12 13 $add_text_opts=get_option('_mcmp_ppu_recalc_text_options'); 14 if(!empty($add_text_opts)){ 15 $add_text_opts_array=explode('|',$add_text_opts); 16 foreach($add_text_opts_array as $key => $value) 17 { 18 $add_text_opts_array[$key] = esc_attr($value); 19 } 20 //adding texts as keys 21 $add_text_opts_array=array_combine($add_text_opts_array,$add_text_opts_array); 13 $add_text_opts = get_option( '_mcmp_ppu_recalc_text_options' ); 14 if ( ! empty( $add_text_opts ) ) { 15 $add_text_opts_array = explode( '|', $add_text_opts ); 16 foreach ( $add_text_opts_array as $key => $value ) { 17 $add_text_opts_array[ $key ] = esc_attr( $value ); 18 } 19 // Adding texts as keys. 20 $add_text_opts_array = array_combine( $add_text_opts_array, $add_text_opts_array ); 22 21 } 23 $add_text_opts_array[' '] = esc_attr__('No additional text', 'woo-price-per-unit');24 $add_text_opts_array['-automatic-'] = esc_attr__( 'Automatic text - takes unit settings from product', 'woo-price-per-unit');25 $add_text_curr =get_option('_mcmp_ppu_recalc_text');26 $add_text_curr =(empty($add_text_curr)) ? ' ' : $add_text_curr;27 if (array_key_exists($add_text_curr,$add_text_opts_array)==false){28 $add_text_opts_array[$add_text_curr] = esc_attr($add_text_curr);22 $add_text_opts_array[' '] = esc_attr__( 'No additional text', 'woo-price-per-unit' ); 23 $add_text_opts_array['-automatic-'] = esc_attr__( 'Automatic text - takes unit settings from product', 'woo-price-per-unit' ); 24 $add_text_curr = get_option( '_mcmp_ppu_recalc_text' ); 25 $add_text_curr = ( empty( $add_text_curr ) ) ? ' ' : $add_text_curr; 26 if ( array_key_exists( $add_text_curr, $add_text_opts_array ) == false ) { 27 $add_text_opts_array[ $add_text_curr ] = esc_attr( $add_text_curr ); 29 28 } 30 29 31 ksort( $add_text_opts_array);30 ksort( $add_text_opts_array ); 32 31 $custom_settings = array( 33 array( 34 'id' => 'mcmp_notice', 35 'name' => esc_html__('Important notice about new version', 'woo-price-per-unit'), 36 'desc' => esc_html__('It is no loger possible to change behaviour on single product - please check your product settings to get more info.', 'woo-price-per-unit'), 37 'type' => 'title', 38 ), 39 array( 40 'id' => 'mcmp_general_options', 41 'name' => esc_html__('General price options', 'woo-price-per-unit'), 42 'desc' => esc_html__('Settings which affects all products', 'woo-price-per-unit'), 43 'type' => 'title', 44 ), 45 array( 46 'id' => '_mcmp_ppu_additional_text', 47 'name' => esc_html__('General price additional text', 'woo-price-per-unit'), 48 'desc' => esc_html__("This text will be shown after every price text. You can modify it's appearance through CSS class mcmp-general-price-suffix.", 'woo-price-per-unit'), 49 'placeholder' => esc_html__('Example "Without Vat"', 'woo-price-per-unit'), 50 'type' => 'text', 51 'default' => '', 52 ), 53 array( 54 'id' => '_mcmp_ppu_hide_sale_price', 55 'name' => esc_html__('Sale price - hide regular price', 'woo-price-per-unit'), 56 'desc' => esc_html__('When product is on sale it shows regular price and sale price. This will hide the regular price for all products.', 'woo-price-per-unit'), 57 'type' => 'checkbox', 58 'default' => 'no', 59 'desc_tip' => false, 60 ), 61 array('type' => 'sectionend', 'id' => 'mcmp_general_options'), 62 array( 63 'id' => 'mcmp_variable_options', 64 'name' => esc_html__('Options for variable products', 'woo-price-per-unit'), 65 'desc' => esc_html__('These settings affect only variable products', 'woo-price-per-unit'), 66 'type' => 'title', 67 ), 68 array( 69 'id' => '_mcmp_ppu_var_prefix_text', 70 'name' => esc_html__('Variations - prefix for variable price', 'woo-price-per-unit'), 71 'desc' => esc_html__("If the product is variable this text will be shown before the price. You can modify it's appearance through CSS class mcmp-variable-price-prefix.", 'woo-price-per-unit'), 72 'placeholder' => esc_html__('Example "From:"', 'woo-price-per-unit'), 73 'type' => 'text', 74 'default' => '', 75 'disabled' => true, 76 ), 77 array( 78 'id' => '_mcmp_ppu_var_hide_max_price', 79 'name' => esc_html__('Variations - Display only lower price', 'woo-price-per-unit'), 80 'desc' => esc_html__('When displaying variation the price is displayed as "$10-$25". With this setting you will get just "$10"', 'woo-price-per-unit'), 81 'type' => 'checkbox', 82 'default' => 'no', 83 'desc_tip' => false, 84 ), 85 array( 86 'id' => '_mcmp_ppu_var_show_sale_price', 87 'name' => esc_html__('Variations - Show regular price', 'woo-price-per-unit'), 88 'desc' => esc_html__('Mimics pre WooCommerce 3 variable product price display - Shows how much was the cost before sale', 'woo-price-per-unit'), 89 'type' => 'checkbox', 90 'default' => 'no', 91 'desc_tip' => false, 92 ), 93 array('type' => 'sectionend', 'id' => 'mcmp_variable_options'), 94 array( 95 'id' => 'mcmp_recalculation_options', 96 'name' => esc_html__('Price recalculation', 'woo-price-per-unit'), 97 'desc' => esc_html__('General settings for price recalculation', 'woo-price-per-unit'), 98 'type' => 'title', 99 ), 100 array( 101 'id' => '_mcmp_ppu_add_row_css', 102 'name' => esc_html__('New row different styling', 'woo-price-per-unit'), 103 'desc' => esc_html__('When displaying price as new row, the new row will be displayed in italics with slightly smaller font size. For more styling you can use CSS class mcmp_recalc_price_row.', 'woo-price-per-unit'), 104 'type' => 'checkbox', 105 'default' => 'no', 106 'desc_tip' => false, 107 ), 108 array( 109 'id' => '_mcmp_ppu_general', 110 'name' => esc_html__('Shop page price behavior', 'woo-price-per-unit'), 111 'desc' => esc_html__('Behaviour of recalculated price on shop page', 'woo-price-per-unit'), 112 'css' => '', 113 'class' => 'wc-enhanced-select', 114 'type' => 'select', 115 'default' => 'not', 116 'options' => array( 117 'not' => esc_attr__('Do not show recalculated price', 'woo-price-per-unit'), 118 'add' => esc_attr__('Show recalculated price as new row', 'woo-price-per-unit'), 119 'replace' => esc_attr__('Replace price view with recalculated', 'woo-price-per-unit'), 120 ), 121 'desc_tip' => false, 122 ), 123 array( 124 'id' => '_mcmp_ppu_single_page', 125 'name' => esc_html__('Single product page behavior', 'woo-price-per-unit'), 126 'desc' => esc_html__('Behaviour of recalculated price on single product page', 'woo-price-per-unit'), 127 'css' => '', 128 'class' => 'wc-enhanced-select', 129 'type' => 'select', 130 'default' => 'not', 131 'options' => array( 132 'not' => esc_attr__('Do not show recalculated price', 'woo-price-per-unit'), 133 'add' => esc_attr__('Show recalculated price as new row', 'woo-price-per-unit'), 134 'replace' => esc_attr__('Replace price view with recalculated', 'woo-price-per-unit'), 135 ), 136 'desc_tip' => false, 137 ), 138 array( 139 'id' => '_mcmp_ppu_cart_page', 140 'name' => esc_html__('Cart page behavior', 'woo-price-per-unit'), 141 'desc' => esc_html__('Behaviour of recalculated price on cart page. Always displayed as new row.', 'woo-price-per-unit'), 142 'css' => '', 143 'class' => 'wc-enhanced-select', 144 'type' => 'select', 145 'default' => 'single', 146 'options' => array( 147 'not' => esc_attr__('Do not show recalculated price', 'woo-price-per-unit'), 148 'add' => esc_attr__('Show recalculated price always', 'woo-price-per-unit'), 149 'single' => esc_attr__('Show if displayed on Single product page', 'woo-price-per-unit'), 150 'shop' => esc_attr__('Show if displayed on Shop page', 'woo-price-per-unit'), 151 152 ), 153 'desc_tip' => false, 154 ), 155 array( 156 'id' => '_mcmp_ppu_cart_show_sale_price', 157 'name' => esc_html__('Cart - Sale products - show regular price', 'woo-price-per-unit-pro'), 158 'desc' => esc_html__('Show recalculated regular price in Cart. Up to version 2.0.7 it was displayed by default, but WooCommerce stopped displaying regular price, so do we.', 'woo-price-per-unit-pro'), 159 'type' => 'checkbox', 160 'default' => 'no', 161 'desc_tip' => false, 162 ), 163 array( 164 'id' => '_mcmp_ppu_recalc_text', 165 'name' => esc_html__('Recalculated price additional text', 'woo-price-per-unit'), 166 'desc' => esc_html__("Will be shown immediatelly after recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-suffix.", 'woo-price-per-unit'), 167 'css' => '', 168 'class' => 'wc-enhanced-select', 169 'type' => 'select', 170 'default' => '', 171 'options' => $add_text_opts_array, 172 'desc_tip' => false, 173 ), 174 array( 175 'id' => '_mcmp_ppu_recalc_text_automatic_preposition', 176 'name' => esc_html__('Prepostion for weight unit when using automatic text', 'woo-price-per-unit'), 177 'desc' => esc_html__("Automatic text will create text like this '$10/kg' with this option you can replace '/' sign with what you want.", 'woo-price-per-unit').' '.esc_html__('To add space replace it with "%" sign.', 'woo-price-per-unit'), 178 'type' => 'text', 179 'placeholder' => esc_html__('Example "/" or "per%".', 'woo-price-per-unit').' '.esc_html__('To add space replace it with "%" sign.', 'woo-price-per-unit'), 180 'default' => '/', 181 ), 182 array( 183 'id' => '_mcmp_ppu_recalc_text_options', 184 'name' => esc_html__('Predefined additional text values', 'woo-price-per-unit'), 185 'desc' => esc_html__("Set of additional texts from which you will be able to choose on product page. Multiple values can be separated with '|' sign.", 'woo-price-per-unit'), 186 'type' => 'text', 187 'default' => '/kg|/oz|/g|/lbs', 188 ), 189 array( 190 'id' => '_mcmp_ppu_recalc_text_separate', 191 'name' => esc_html__('Separate text from price with space', 'woo-price-per-unit'), 192 'desc' => esc_html__("The additional text is normally separated from the recalculated price with unbreakable space. If you don't want it uncheck this option.", 'woo-price-per-unit'), 193 'type' => 'checkbox', 194 'default' => 'yes', 195 'desc_tip' => false, 196 ), 197 array( 198 'id' => '_mcmp_ppu_recalc_text_prefix', 199 'name' => esc_html__('Recalculated price prefix text', 'woo-price-per-unit'), 200 'desc' => esc_html__("Will be shown before the recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-prefix.", 'woo-price-per-unit'), 201 'type' => 'text', 202 'placeholder' => esc_html__('Example "Price per kilogram:"', 'woo-price-per-unit'), 203 'default' => '', 204 ), 205 array( 206 'id' => '_mcmp_ppu_disable_price_rounding', 207 'name' => __('Disable price rounding', 'woo-price-per-unit'), 208 'desc' => __('Normally WooCommerce rounds displayed prices - if you want recalculated prices trimmed instead check this field.', 'woo-price-per-unit'), 209 'type' => 'checkbox', 210 'default' => 'no', 211 'desc_tip' => false, 212 ), 213 array('type' => 'sectionend', 'id' => 'mcmp_recalculation_options'), 214 array( 215 'id' => 'mcmp_plugin_options', 216 'name' => esc_html__('Maintenance', 'woo-price-per-unit'), 217 'desc' => esc_html__('These settings are related just to the plugin itself.', 'woo-price-per-unit'), 218 'type' => 'title', 219 ), 220 array( 221 'id' => '_mcmp_ppu_delete_meta', 222 'name' => esc_html__('Delete settings on uninstall', 'woo-price-per-unit'), 223 'desc' => esc_html__('With this setting you will delete all plugin settings on uninstallation.', 'woo-price-per-unit'), 224 'type' => 'checkbox', 225 'default' => 'no', 226 'desc_tip' => false 227 ), 228 array('type' => 'sectionend', 'id' => 'mcmp_plugin_options'), 32 array( 33 'id' => 'mcmp_general_options', 34 'name' => esc_html__( 'General price options', 'woo-price-per-unit' ), 35 'desc' => esc_html__( 'Settings which affects all products', 'woo-price-per-unit' ), 36 'type' => 'title', 37 ), 38 array( 39 'id' => '_mcmp_ppu_additional_text', 40 'name' => esc_html__( 'General price additional text', 'woo-price-per-unit' ), 41 'desc' => esc_html__( "This text will be shown after every price text. You can modify it's appearance through CSS class mcmp-general-price-suffix.", 'woo-price-per-unit' ), 42 'placeholder' => esc_html__( 'Example "Without Vat"', 'woo-price-per-unit' ), 43 'type' => 'text', 44 'default' => '', 45 ), 46 array( 47 'id' => '_mcmp_ppu_hide_sale_price', 48 'name' => esc_html__( 'Sale price - hide regular price', 'woo-price-per-unit' ), 49 'desc' => esc_html__( 'When product is on sale it shows regular price and sale price. This will hide the regular price for all products.', 'woo-price-per-unit' ), 50 'type' => 'checkbox', 51 'default' => 'no', 52 'desc_tip' => false, 53 ), 54 array( 55 'type' => 'sectionend', 56 'id' => 'mcmp_general_options', 57 ), 58 array( 59 'id' => 'mcmp_variable_options', 60 'name' => esc_html__( 'Options for variable products', 'woo-price-per-unit' ), 61 'desc' => esc_html__( 'These settings affect only variable products', 'woo-price-per-unit' ), 62 'type' => 'title', 63 ), 64 array( 65 'id' => '_mcmp_ppu_var_prefix_text', 66 'name' => esc_html__( 'Variations - prefix for variable price', 'woo-price-per-unit' ), 67 'desc' => esc_html__( "If the product is variable this text will be shown before the price. You can modify it's appearance through CSS class mcmp-variable-price-prefix.", 'woo-price-per-unit' ), 68 'placeholder' => esc_html__( 'Example "From:"', 'woo-price-per-unit' ), 69 'type' => 'text', 70 'default' => '', 71 'disabled' => true, 72 ), 73 array( 74 'id' => '_mcmp_ppu_var_hide_max_price', 75 'name' => esc_html__( 'Variations - Display only lower price', 'woo-price-per-unit' ), 76 'desc' => esc_html__( 'When displaying variation the price is displayed as "$10-$25". With this setting you will get just "$10"', 'woo-price-per-unit' ), 77 'type' => 'checkbox', 78 'default' => 'no', 79 'desc_tip' => false, 80 ), 81 array( 82 'id' => '_mcmp_ppu_var_show_sale_price', 83 'name' => esc_html__( 'Variations - Show regular price', 'woo-price-per-unit' ), 84 'desc' => esc_html__( 'Mimics pre WooCommerce 3 variable product price display - Shows how much was the cost before sale', 'woo-price-per-unit' ), 85 'type' => 'checkbox', 86 'default' => 'no', 87 'desc_tip' => false, 88 ), 89 array( 90 'type' => 'sectionend', 91 'id' => 'mcmp_variable_options', 92 ), 93 array( 94 'id' => 'mcmp_recalculation_options', 95 'name' => esc_html__( 'Price recalculation', 'woo-price-per-unit' ), 96 'desc' => esc_html__( 'General settings for price recalculation', 'woo-price-per-unit' ), 97 'type' => 'title', 98 ), 99 array( 100 'id' => '_mcmp_ppu_add_row_css', 101 'name' => esc_html__( 'New row different styling', 'woo-price-per-unit' ), 102 'desc' => esc_html__( 'When displaying price as new row, the new row will be displayed in italics with slightly smaller font size. For more styling you can use CSS class mcmp_recalc_price_row.', 'woo-price-per-unit' ), 103 'type' => 'checkbox', 104 'default' => 'no', 105 'desc_tip' => false, 106 ), 107 array( 108 'id' => '_mcmp_ppu_general', 109 'name' => esc_html__( 'Shop page price behavior', 'woo-price-per-unit' ), 110 'desc' => esc_html__( 'Behaviour of recalculated price on shop page', 'woo-price-per-unit' ), 111 'css' => '', 112 'class' => 'wc-enhanced-select', 113 'type' => 'select', 114 'default' => 'not', 115 'options' => array( 116 'not' => esc_attr__( 'Do not show recalculated price', 'woo-price-per-unit' ), 117 'add' => esc_attr__( 'Show recalculated price as new row', 'woo-price-per-unit' ), 118 'replace' => esc_attr__( 'Replace price view with recalculated', 'woo-price-per-unit' ), 119 ), 120 'desc_tip' => false, 121 ), 122 array( 123 'id' => '_mcmp_ppu_single_page', 124 'name' => esc_html__( 'Single product page behavior', 'woo-price-per-unit' ), 125 'desc' => esc_html__( 'Behaviour of recalculated price on single product page', 'woo-price-per-unit' ), 126 'css' => '', 127 'class' => 'wc-enhanced-select', 128 'type' => 'select', 129 'default' => 'not', 130 'options' => array( 131 'not' => esc_attr__( 'Do not show recalculated price', 'woo-price-per-unit' ), 132 'add' => esc_attr__( 'Show recalculated price as new row', 'woo-price-per-unit' ), 133 'replace' => esc_attr__( 'Replace price view with recalculated', 'woo-price-per-unit' ), 134 ), 135 'desc_tip' => false, 136 ), 137 array( 138 'id' => '_mcmp_ppu_cart_page', 139 'name' => esc_html__( 'Cart page behavior', 'woo-price-per-unit' ), 140 'desc' => esc_html__( 'Behaviour of recalculated price on cart page. Always displayed as new row.', 'woo-price-per-unit' ), 141 'css' => '', 142 'class' => 'wc-enhanced-select', 143 'type' => 'select', 144 'default' => 'single', 145 'options' => array( 146 'not' => esc_attr__( 'Do not show recalculated price', 'woo-price-per-unit' ), 147 'add' => esc_attr__( 'Show recalculated price always', 'woo-price-per-unit' ), 148 'single' => esc_attr__( 'Show if displayed on Single product page', 'woo-price-per-unit' ), 149 'shop' => esc_attr__( 'Show if displayed on Shop page', 'woo-price-per-unit' ), 150 151 ), 152 'desc_tip' => false, 153 ), 154 array( 155 'id' => '_mcmp_ppu_cart_show_sale_price', 156 'name' => esc_html__( 'Cart - Sale products - show regular price', 'woo-price-per-unit' ), 157 'desc' => esc_html__( 'Show recalculated regular price in Cart. Up to version 2.0.7 it was displayed by default, but WooCommerce stopped displaying regular price, so do we.', 'woo-price-per-unit' ), 158 'type' => 'checkbox', 159 'default' => 'no', 160 'desc_tip' => false, 161 ), 162 array( 163 'id' => '_mcmp_ppu_recalc_text', 164 'name' => esc_html__( 'Recalculated price additional text', 'woo-price-per-unit' ), 165 'desc' => esc_html__( "Will be shown immediatelly after recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-suffix.", 'woo-price-per-unit' ), 166 'css' => '', 167 'class' => 'wc-enhanced-select', 168 'type' => 'select', 169 'default' => '', 170 'options' => $add_text_opts_array, 171 'desc_tip' => false, 172 ), 173 array( 174 'id' => '_mcmp_ppu_recalc_text_automatic_preposition', 175 'name' => esc_html__( 'Prepostion for weight unit when using automatic text', 'woo-price-per-unit' ), 176 'desc' => esc_html__( "Automatic text will create text like this '$10/kg' with this option you can replace '/' sign with what you want.", 'woo-price-per-unit' ) . ' ' . esc_html__( 'To add space replace it with "%" sign.', 'woo-price-per-unit' ), 177 'type' => 'text', 178 'placeholder' => esc_html__( 'Example "/" or "per%".', 'woo-price-per-unit' ) . ' ' . esc_html__( 'To add space replace it with "%" sign.', 'woo-price-per-unit' ), 179 'default' => '/', 180 ), 181 array( 182 'id' => '_mcmp_ppu_recalc_text_options', 183 'name' => esc_html__( 'Predefined additional text values', 'woo-price-per-unit' ), 184 'desc' => esc_html__( "Set of additional texts from which you will be able to choose on product page. Multiple values can be separated with '|' sign.", 'woo-price-per-unit' ), 185 'type' => 'text', 186 'default' => '/kg|/oz|/g|/lbs', 187 ), 188 array( 189 'id' => '_mcmp_ppu_recalc_text_separate', 190 'name' => esc_html__( 'Separate text from price with space', 'woo-price-per-unit' ), 191 'desc' => esc_html__( "The additional text is normally separated from the recalculated price with unbreakable space. If you don't want it uncheck this option.", 'woo-price-per-unit' ), 192 'type' => 'checkbox', 193 'default' => 'yes', 194 'desc_tip' => false, 195 ), 196 array( 197 'id' => '_mcmp_ppu_recalc_text_prefix', 198 'name' => esc_html__( 'Recalculated price prefix text', 'woo-price-per-unit' ), 199 'desc' => esc_html__( "Will be shown before the recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-prefix.", 'woo-price-per-unit' ), 200 'type' => 'text', 201 'placeholder' => esc_html__( 'Example "Price per kilogram:"', 'woo-price-per-unit' ), 202 'default' => '', 203 ), 204 array( 205 'id' => '_mcmp_ppu_disable_price_rounding', 206 'name' => __( 'Disable price rounding', 'woo-price-per-unit' ), 207 'desc' => __( 'Normally WooCommerce rounds displayed prices - if you want recalculated prices trimmed instead check this field.', 'woo-price-per-unit' ), 208 'type' => 'checkbox', 209 'default' => 'no', 210 'desc_tip' => false, 211 ), 212 array( 213 'type' => 'sectionend', 214 'id' => 'mcmp_recalculation_options', 215 ), 216 array( 217 'id' => 'mcmp_plugin_options', 218 'name' => esc_html__( 'Maintenance', 'woo-price-per-unit' ), 219 'desc' => esc_html__( 'These settings are related just to the plugin itself.', 'woo-price-per-unit' ), 220 'type' => 'title', 221 ), 222 array( 223 'id' => '_mcmp_ppu_delete_meta', 224 'name' => esc_html__( 'Delete settings on uninstall', 'woo-price-per-unit' ), 225 'desc' => esc_html__( 'With this setting you will delete all plugin settings on uninstallation.', 'woo-price-per-unit' ), 226 'type' => 'checkbox', 227 'default' => 'no', 228 'desc_tip' => false, 229 ), 230 array( 231 'type' => 'sectionend', 232 'id' => 'mcmp_plugin_options', 233 ), 229 234 ); 230 235 return $custom_settings; -
woo-price-per-unit/trunk/includes/product-settings.php
r2670562 r3090318 1 1 <?php 2 /** 3 * Displays custom settings in WooCommerce backend for product 4 * 5 * @package PricePerUnit/Admin 6 */ 2 7 3 /** 4 * Displays custom settings in WooCommerce backend for product 5 * 6 * @package PricePerUnit/Admin 7 */ 8 9 if (!defined('ABSPATH')): 10 exit; // Exit if accessed directly 8 if ( ! defined( 'ABSPATH' ) ) : 9 exit; // Exit if accessed directly. 11 10 endif; 11 $product_id = get_the_ID(); 12 $altered_product = wc_get_product( $product_id ); 13 // Behavior settings of both pages. 14 $behav_settings = array( 15 '' => esc_attr__( 'Default - according to general settings', 'woo-price-per-unit' ), 16 'not' => esc_attr__( 'Do not recalculate', 'woo-price-per-unit' ), 17 ); 18 // phpcs:disable Generic.WhiteSpace.ScopeIndent 12 19 echo '<div id="mcmp_ppu_options" class="panel woocommerce_options_panel">'; 13 20 // mcmp_ppu fields will be created here. 14 21 echo '<p class="admin-warn-no-weight mcmp-product-edit-warn">'; 15 echo '<span>' .esc_html__('Warning: This product has no weight set. The price per unit will not be shown unless the weight is set on Shipping tab. Please check it.', 'woo-price-per-unit') . '</span>';22 echo '<span>' . esc_html__( 'Warning: This product has no weight set. The price per unit will not be shown unless the weight is set on Shipping tab. Please check it.', 'woo-price-per-unit' ) . '</span>'; 16 23 echo '</p>'; 17 echo '<p>'; 18 echo '<span class="section-heading">' . esc_html__('Settings for Price per unit plug-in', 'woo-price-per-unit') . '</span></br>'; 19 echo '<span class="mcmp-pro-advert">'; 20 echo esc_html__('In PRO version you will find here settings for individual products', 'woo-price-per-unit') . '</br>'; 21 echo esc_html__('You can buy the plug-in here ', 'woo-price-per-unit'); 22 echo '<a href="https://mechcomp.cz/price-per-unit-pro/" target="_blank">'; 23 echo esc_html__('Price per Unit PRO', 'woo-price-per-unit') . '</a>'; 24 echo '</span>'; 25 echo '<span class="mcmp-pro-advert">'; 26 echo esc_html__('Features you will find here:', 'woo-price-per-unit') . '</br>'; 27 echo esc_html__('- Change of display for product page', 'woo-price-per-unit') . '</br>'; 28 echo esc_html__('- Change of display for shop page', 'woo-price-per-unit') . '</br>'; 29 echo esc_html__('- Individual text for recalculated price', 'woo-price-per-unit') . '</br>'; 30 echo esc_html__('- Option to display price for different weight unit (kg,g,lbs,oz) from shop default. Example: shop in kg and some products in grams', 'woo-price-per-unit') . '</br>'; 31 echo esc_html__('- Option for entering weight, different from shipping weight. Example: use shipping weight as gross and recalculate per net weight.', 'woo-price-per-unit') . '</br>'; 32 echo esc_html__('- Option for displaying recalculation for different number of units. Example: You can display price per 5kg', 'woo-price-per-unit') . '</br>'; 33 echo '</span>'; 34 echo '<span class="mcmp-pro-advert">'; 35 echo '<span class="coupon">'; 36 echo esc_html__('New plug-in available - Sell by Weight PRO', 'woo-price-per-unit') . '</br>'; 37 echo '</span>'; 38 echo esc_html__('This plug-in allows you to sell easily products, where you want to have several weight option to sell at the same price for kilogram.', 'woo-price-per-unit') . '</br>'; 39 echo esc_html__('It works in a similar way as Variable products, but it is easier to manage because you will enter the price only once and the options price is calculated automatically.', 'woo-price-per-unit') . '</br>'; 40 echo esc_html__('More information can be found here ', 'woo-price-per-unit'); 41 echo '<a href="https://mechcomp.cz/sell-by-weight-pro/" target="_blank">'; 42 echo esc_html__('Sell by Weight PRO', 'woo-price-per-unit') . '</a>'; 43 echo '</span>'; 44 echo '<span class="mcmp-pro-advert note">'; 45 echo esc_html__('Note for old version users:', 'woo-price-per-unit') . '</br>'; 46 echo esc_html__("All your settings from this page are still in database, if you upgrade to PRO version it will be available again.", 'woo-price-per-unit') . '</br>'; 47 echo esc_html__("If you are not interested in buying PRO version and still want to use the old features, please downgrade to free version 1.9.3.", 'woo-price-per-unit'); 48 echo '<a href="https://downloads.wordpress.org/plugin/woo-price-per-unit.1.9.3.zip" target="_blank">'; 49 echo esc_html__('Download here.', 'woo-price-per-unit') . '</a></br>'; 50 echo '</span>'; 51 echo '</p>'; 24 echo '<p>'; 25 echo '<span class="section-heading">' . esc_html__( 'Local overrides for price recalculation', 'woo-price-per-unit' ) . '</span><br>'; 26 echo esc_html__( 'These settings will affect only this product despite global settings.', 'woo-price-per-unit' ) . '<br>'; 27 echo esc_html__( 'Global settings can be found at ', 'woo-price-per-unit' ); 28 echo '<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=products§ion=mcmp_price_pu' ) ) . '" target="_blank">'; 29 echo wp_kses_post( __( '<i>WooCommerce -> Settings -> Products -> Price Per Unit</i>', 'woo-price-per-unit' ) ) . '</a>'; 30 echo '</p>'; 31 echo '<div class="options_group">'; 32 woocommerce_wp_select( 33 array( 34 'id' => '_mcmp_ppu_general_override', 35 'label' => esc_html__( 'Shop page price behavior', 'woo-price-per-unit' ), 36 'description' => esc_html__( 'Behaviour of recalculated price on shop page', 'woo-price-per-unit' ), 37 'default' => '', 38 'options' => $behav_settings, 39 'desc_tip' => true, 40 ) 41 ); 42 woocommerce_wp_select( 43 array( 44 'id' => '_mcmp_ppu_single_page_override', 45 'label' => esc_html__( 'Single product page behavior', 'woo-price-per-unit' ), 46 'description' => esc_html__( 'Behaviour of recalculated price on single product page', 'woo-price-per-unit' ), 47 'default' => '', 48 'options' => $behav_settings, 49 'desc_tip' => true, 50 ) 51 ); 52 echo '</div>'; 53 echo '<p>'; 54 echo '<span class="section-heading">' . esc_html__( 'Settings for Price per unit plug-in', 'woo-price-per-unit' ) . '</span><br>'; 55 echo '<span class="mcmp-pro-advert">'; 56 echo esc_html__( 'In PRO version you will find here more settings for individual products', 'woo-price-per-unit' ) . '<br>'; 57 echo esc_html__( 'You can buy the plug-in here ', 'woo-price-per-unit' ); 58 echo '<a href="https://mechcomp.cz/price-per-unit-pro/" target="_blank">'; 59 echo esc_html__( 'Price per Unit PRO', 'woo-price-per-unit' ) . '</a>'; 60 echo '</span>'; 61 echo '<span class="mcmp-pro-advert">'; 62 echo '<span class="coupon">'; 63 echo esc_html__( 'PRO Version features:', 'woo-price-per-unit' ) . '<br>'; 64 echo '</span>'; 65 echo '<strong>' . esc_html__( '- New feature - Quick Editor settings: Easily adjust Price Per Unit (PPU) settings on the fly.', 'woo-price-per-unit' ) . '</strong><br>'; 66 echo '<strong>' . esc_html__( '- New feature - Bulk Editor settings: Save time by editing PPU settings in bulk.', 'woo-price-per-unit' ) . '</strong><br>'; 67 echo esc_html__( '- Enhanced display options: Customize how prices appear on product pages.', 'woo-price-per-unit' ) . '<br>'; 68 echo esc_html__( '- Shop Page display options: More ways to showcase prices on your shop page.', 'woo-price-per-unit' ) . '<br>'; 69 echo esc_html__( '- Custom text for recalculated prices: Tailor the recalculated price display text.', 'woo-price-per-unit' ) . '<br>'; 70 echo esc_html__( '- Flexible weight unit display: Show prices for different units (kg, g, lbs, oz) from your shop default unit. Example: shop in kg and some products in grams.', 'woo-price-per-unit' ) . '<br>'; 71 echo esc_html__( '- Alternative Weight Entry: Differentiate between shipping weight and net weight for accurate pricing. Example: use shipping weight as gross and recalculate per net weight.', 'woo-price-per-unit' ) . '<br>'; 72 echo esc_html__( '- Multiple unit Recalculation: Display prices per different quantities (e.g., price per 5kg).', 'woo-price-per-unit' ) . '<br>'; 73 echo esc_html__( '- Possibility to save prices in database for later use.', 'woo-price-per-unit' ) . '<br>'; 74 echo esc_html__( '- WPML Compatible: Seamless integration with WPML for multilingual support.', 'woo-price-per-unit' ) . '<br>'; 75 echo '</span>'; 76 echo '<span class="mcmp-pro-advert">'; 77 echo '<span class="coupon">'; 78 echo esc_html__( 'Another Must-Have Plugin: Sell by Weight PRO', 'woo-price-per-unit' ) . '<br>'; 79 echo '</span>'; 80 echo '<strong>' . esc_html__( 'Simplify product pricing with Sell by Weight PRO!', 'woo-price-per-unit' ) . '</strong><br>'; 81 echo esc_html__( 'Easily sell products at a constant price per kilogram with multiple weight options.', 'woo-price-per-unit' ) . '<br>'; 82 echo esc_html__( 'Enter the unit price once and let the plugin calculate options prices based on their weight.', 'woo-price-per-unit' ) . '<br>'; 83 echo esc_html__( 'It works similarly as Variable products, but it is easier to manage.', 'woo-price-per-unit' ) . '<br>'; 84 echo esc_html__( 'The plugin is compatible with all WooCommerce weight units and works with the one you\'ve chosen.', 'woo-price-per-unit' ) . '</br>'; 85 echo esc_html__( 'More information can be found here ', 'woo-price-per-unit' ); 86 echo '<a href="https://mechcomp.cz/sell-by-weight-pro/" target="_blank">'; 87 echo esc_html__( 'Sell by Weight PRO', 'woo-price-per-unit' ) . '</a>'; 88 echo '</span>'; 89 echo '<span class="mcmp-pro-advert">'; 90 echo '<span class="coupon">'; 91 echo esc_html__( 'New plug-in available - Unit Based Stock PRO', 'woo-price-per-unit' ) . '<br>'; 92 echo '</span>'; 93 echo '<strong>' . esc_html__( 'Manage your stock in Weight units!', 'woo-price-per-unit' ) . '</strong><br>'; 94 echo esc_html__( 'Handle inventory in weight units - a capability unprecedented in WooCommerce, which traditionally manages stock solely based on purchased quantity.', 'woo-price-per-unit' ) . '<br>'; 95 echo esc_html__( 'Override the product weight with custom stock value. This value will be used for inventory deduction.', 'woo-price-per-unit' ) . '<br>'; 96 echo esc_html__( 'Supports decimal values for stock inventory as well.', 'woo-price-per-unit' ) . '<br>'; 97 echo esc_html__( 'More information can be found here ', 'woo-price-per-unit' ); 98 echo '<a href="https://mechcomp.cz/unit-based-stock-pro/" target="_blank">'; 99 echo esc_html__( 'Unit Based Stock PRO', 'woo-price-per-unit' ) . '</a>'; 100 echo '</span>'; 101 echo '</p>'; 102 wp_nonce_field( 'mcmp_ppu_free_prod_nonce_action', '_mcmp_ppu_free_prod_nonce' ); 52 103 echo '</div>'; 104 // phpcs:enable Generic.WhiteSpace.ScopeIndent -
woo-price-per-unit/trunk/languages/woo-price-per-unit-cs_CZ.po
r2670562 r3090318 1 1 msgid "" 2 2 msgstr "" 3 "Project-Id-Version: WooCommerce Price Per Unit 2.0.9\n"3 "Project-Id-Version: WooCommerce Price Per Unit - free version\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 202 2-02-01 13:28+0100\n"6 "PO-Revision-Date: 202 2-02-01 13:32+0100\n"7 "Last-Translator: administrator <[email protected]>\n"5 "POT-Creation-Date: 2024-05-21 16:05+0200\n" 6 "PO-Revision-Date: 2024-05-21 16:08+0200\n" 7 "Last-Translator: Martin Měchura\n" 8 8 "Language-Team: Czech\n" 9 9 "Language: cs_CZ\n" … … 11 11 "Content-Type: text/plain; charset=UTF-8\n" 12 12 "Content-Transfer-Encoding: 8bit\n" 13 "X-Generator: Poedit 2.4.3\n" 13 "Plural-Forms: nplurals=3; plural=( n == 1 ) ? 0 : ( n >= 2 && n <= 4 ) ? 1 : 2;\n" 14 "X-Generator: Poedit 3.4.4\n" 14 15 "X-Poedit-SourceCharset: UTF-8\n" 15 16 "X-Poedit-KeywordsList: __;_x;_e;_ex;_n\n" 16 17 "X-Poedit-Basepath: ..\n" 17 "Plural-Forms: nplurals=3; plural=( n == 1 ) ? 0 : ( n >= 2 && n <= 4 ) ? 1 : "18 "2;\n"19 18 "X-Poedit-SearchPath-0: .\n" 20 19 "X-Poedit-SearchPathExcluded-0: !Snippets\n" 21 20 "X-Poedit-SearchPathExcluded-1: .vscode\n" 22 21 23 #: includes/general-settings.php:23 22 #: includes/database-upgrade.php:38 23 msgid "WooCommerce Price per Unit - database needs an update. Please back up your database first!" 24 msgstr "WooCommerce Price per Unit - database vyžaduje aktualizaci. Nejprve si vytvořte zálohu databáze !" 25 26 #: includes/database-upgrade.php:39 27 msgid "Upgrade database" 28 msgstr "Aktualizovat databázi" 29 30 #: includes/database-upgrade.php:42 31 msgid "WooCommerce Price per Unit - database updated successfully." 32 msgstr "WooCommerce Price per Unit - databáze úspěšně aktualizována." 33 34 #: includes/general-settings.php:22 24 35 msgid "No additional text" 25 36 msgstr "Bez přídavného textu" 26 37 27 #: includes/general-settings.php:2 438 #: includes/general-settings.php:23 28 39 msgid "Automatic text - takes unit settings from product" 29 40 msgstr "Automatický text - přebírá nastavení z produktu" 30 41 31 #: includes/general-settings.php:35 32 msgid "Important notice about new version" 33 msgstr "Důležité upozornění k nové verzi" 34 35 #: includes/general-settings.php:36 woo-price-per-unit.php:121 36 msgid "" 37 "It is no loger possible to change behaviour on single product - please check " 38 "your product settings to get more info." 39 msgstr "" 40 "Již není možné měnit chování přepočtu na jednotlivých stránkách - podívejte " 41 "se prosím na nastavení produktu pro další informace." 42 43 #: includes/general-settings.php:41 42 #: includes/general-settings.php:34 44 43 msgid "General price options" 45 44 msgstr "Obecné nastavení ceny" 46 45 47 #: includes/general-settings.php: 4246 #: includes/general-settings.php:35 48 47 msgid "Settings which affects all products" 49 48 msgstr "Nastavení, týkající se všech produktů" 50 49 51 #: includes/general-settings.php:4 750 #: includes/general-settings.php:40 52 51 msgid "General price additional text" 53 52 msgstr "Přídavný text pro všechny ceny" 54 53 55 #: includes/general-settings.php:48 56 msgid "" 57 "This text will be shown after every price text. You can modify it's " 58 "appearance through CSS class mcmp-general-price-suffix." 59 msgstr "" 60 "Tento text bude zobrazen za každou cenou. Vzhled lze upravit přes CSS třídu " 61 "mcmp-general-price-suffix." 62 63 #: includes/general-settings.php:49 54 #: includes/general-settings.php:41 55 msgid "This text will be shown after every price text. You can modify it's appearance through CSS class mcmp-general-price-suffix." 56 msgstr "Tento text bude zobrazen za každou cenou. Vzhled lze upravit přes CSS třídu mcmp-general-price-suffix." 57 58 #: includes/general-settings.php:42 64 59 msgid "Example \"Without Vat\"" 65 60 msgstr "Příklad \"bez DPH\"" 66 61 67 #: includes/general-settings.php: 5562 #: includes/general-settings.php:48 68 63 msgid "Sale price - hide regular price" 69 64 msgstr "Slevy - skrýt běžnou cenou" 70 65 71 #: includes/general-settings.php:56 72 msgid "" 73 "When product is on sale it shows regular price and sale price. This will " 74 "hide the regular price for all products." 75 msgstr "" 76 "Když je produkt ve slevě, cena je zobrazena jako běžná cena a zlevněná cena. " 77 "Toto nastavení skryje běžnou cenu u všech zlevněných produktů." 78 79 #: includes/general-settings.php:64 66 #: includes/general-settings.php:49 67 msgid "When product is on sale it shows regular price and sale price. This will hide the regular price for all products." 68 msgstr "Když je produkt ve slevě, cena je zobrazena jako běžná cena a zlevněná cena. Toto nastavení skryje běžnou cenu u všech zlevněných produktů." 69 70 #: includes/general-settings.php:60 80 71 msgid "Options for variable products" 81 72 msgstr "Nastavení pro produkty s variantami" 82 73 83 #: includes/general-settings.php:6 574 #: includes/general-settings.php:61 84 75 msgid "These settings affect only variable products" 85 76 msgstr "Tato nastavení ovlivní pouze produkty s variantami" 86 77 87 #: includes/general-settings.php: 7078 #: includes/general-settings.php:66 88 79 msgid "Variations - prefix for variable price" 89 80 msgstr "Varianty - úvodní text pro proměnlivou cenu" 90 81 91 #: includes/general-settings.php:71 92 msgid "" 93 "If the product is variable this text will be shown before the price. You can " 94 "modify it's appearance through CSS class mcmp-variable-price-prefix." 95 msgstr "" 96 "Pokud má produkt varianty, tak bude tento text zobrazen před cenou. Vzhled " 97 "lze upravit přes CSS třídu mcmp-variable-price-prefix." 98 99 #: includes/general-settings.php:72 82 #: includes/general-settings.php:67 83 msgid "If the product is variable this text will be shown before the price. You can modify it's appearance through CSS class mcmp-variable-price-prefix." 84 msgstr "Pokud má produkt varianty, tak bude tento text zobrazen před cenou. Vzhled lze upravit přes CSS třídu mcmp-variable-price-prefix." 85 86 #: includes/general-settings.php:68 100 87 msgid "Example \"From:\"" 101 88 msgstr "Příklad \"Již od:\"" 102 89 103 #: includes/general-settings.php:7 990 #: includes/general-settings.php:75 104 91 msgid "Variations - Display only lower price" 105 92 msgstr "Varianty - zobraz pouze nižší částku" 106 93 107 #: includes/general-settings.php:80 108 msgid "" 109 "When displaying variation the price is displayed as \"$10-$25\". With this " 110 "setting you will get just \"$10\"" 111 msgstr "" 112 "Cena variant je zobrazována například takto \"10Kč-25Kč\". S tímto " 113 "nastavením se zobrazí pouze \"10Kč\"" 114 115 #: includes/general-settings.php:87 94 #: includes/general-settings.php:76 95 msgid "When displaying variation the price is displayed as \"$10-$25\". With this setting you will get just \"$10\"" 96 msgstr "Cena variant je zobrazována například takto \"10Kč-25Kč\". S tímto nastavením se zobrazí pouze \"10Kč\"" 97 98 #: includes/general-settings.php:83 116 99 msgid "Variations - Show regular price" 117 100 msgstr "Varianty - zobrazit běžnou cenu" 118 101 119 #: includes/general-settings.php:88 120 msgid "" 121 "Mimics pre WooCommerce 3 variable product price display - Shows how much was " 122 "the cost before sale" 123 msgstr "" 124 "Napodobuje chování zobrazení produktu s variantami před WooCommerce 3 - " 125 "zobrazuje cenu před slevou" 126 127 #: includes/general-settings.php:96 102 #: includes/general-settings.php:84 103 msgid "Mimics pre WooCommerce 3 variable product price display - Shows how much was the cost before sale" 104 msgstr "Napodobuje chování zobrazení produktu s variantami před WooCommerce 3 - zobrazuje cenu před slevou" 105 106 #: includes/general-settings.php:95 128 107 msgid "Price recalculation" 129 108 msgstr "Přepočet ceny" 130 109 131 #: includes/general-settings.php:9 7110 #: includes/general-settings.php:96 132 111 msgid "General settings for price recalculation" 133 112 msgstr "Obecná nastavení pro přepočet ceny" 134 113 135 #: includes/general-settings.php:10 2114 #: includes/general-settings.php:101 136 115 msgid "New row different styling" 137 116 msgstr "Odlišit styl ceny v novém řádku" 138 117 139 #: includes/general-settings.php:103 140 msgid "" 141 "When displaying price as new row, the new row will be displayed in italics " 142 "with slightly smaller font size. For more styling you can use CSS class " 143 "mcmp_recalc_price_row." 144 msgstr "" 145 "Při zobrazování ceny v novém řádku bude tento řádek zobrazen kurzívou a " 146 "mírně menší velikostí. Vzhled lze upravit přes CSS třídu " 147 "mcmp_recalc_price_row." 148 149 #: includes/general-settings.php:110 118 #: includes/general-settings.php:102 119 msgid "When displaying price as new row, the new row will be displayed in italics with slightly smaller font size. For more styling you can use CSS class mcmp_recalc_price_row." 120 msgstr "Při zobrazování ceny v novém řádku bude tento řádek zobrazen kurzívou a mírně menší velikostí. Vzhled lze upravit přes CSS třídu mcmp_recalc_price_row." 121 122 #: includes/general-settings.php:109 includes/product-settings.php:35 150 123 msgid "Shop page price behavior" 151 124 msgstr "Chování na stránce obchodu" 152 125 153 #: includes/general-settings.php:11 1126 #: includes/general-settings.php:110 includes/product-settings.php:36 154 127 msgid "Behaviour of recalculated price on shop page" 155 128 msgstr "Jak se bude chovat přepočítaná cena na stránce obchodu" 156 129 157 #: includes/general-settings.php:11 7 includes/general-settings.php:132158 #: includes/general-settings.php:14 7130 #: includes/general-settings.php:116 includes/general-settings.php:131 131 #: includes/general-settings.php:146 159 132 msgid "Do not show recalculated price" 160 133 msgstr "Nezobrazovat přepočtenou cenu" 161 134 162 #: includes/general-settings.php:11 8 includes/general-settings.php:133135 #: includes/general-settings.php:117 includes/general-settings.php:132 163 136 msgid "Show recalculated price as new row" 164 137 msgstr "Přidat nový řádek s přepočtem" 165 138 166 #: includes/general-settings.php:11 9 includes/general-settings.php:134139 #: includes/general-settings.php:118 includes/general-settings.php:133 167 140 msgid "Replace price view with recalculated" 168 141 msgstr "Přepsat cenu přepočítanou cenou" 169 142 170 #: includes/general-settings.php:12 5143 #: includes/general-settings.php:124 includes/product-settings.php:45 171 144 msgid "Single product page behavior" 172 145 msgstr "Chování na stránce produktu" 173 146 174 #: includes/general-settings.php:12 6147 #: includes/general-settings.php:125 includes/product-settings.php:46 175 148 msgid "Behaviour of recalculated price on single product page" 176 149 msgstr "Jak se bude chovat přepočítaná cena na stránce jednotlivého produktu" 177 150 178 #: includes/general-settings.php:1 40151 #: includes/general-settings.php:139 179 152 msgid "Cart page behavior" 180 153 msgstr "Chování na stránce košíku" 181 154 182 #: includes/general-settings.php:141 183 msgid "" 184 "Behaviour of recalculated price on cart page. Always displayed as new row." 185 msgstr "" 186 "Jak se bude chovat přepočítaná cena na stránce košíku. Zobrazuje se vždy " 187 "jako nový řádek." 188 189 #: includes/general-settings.php:148 155 #: includes/general-settings.php:140 156 msgid "Behaviour of recalculated price on cart page. Always displayed as new row." 157 msgstr "Jak se bude chovat přepočítaná cena na stránce košíku. Zobrazuje se vždy jako nový řádek." 158 159 #: includes/general-settings.php:147 190 160 msgid "Show recalculated price always" 191 161 msgstr "Zobrazit vždy" 192 162 193 #: includes/general-settings.php:14 9163 #: includes/general-settings.php:148 194 164 msgid "Show if displayed on Single product page" 195 165 msgstr "Zobrazit, pokud se zobrazuje na stránce jednotlivého produktu" 196 166 197 #: includes/general-settings.php:1 50167 #: includes/general-settings.php:149 198 168 msgid "Show if displayed on Shop page" 199 169 msgstr "Zobrazit, pokud se zobrazuje na stránce obchodu" 200 170 201 #: includes/general-settings.php:15 7171 #: includes/general-settings.php:156 202 172 msgid "Cart - Sale products - show regular price" 203 173 msgstr "Košík - Zlevněné produkty - zobrazit běžnou cenou" 204 174 205 #: includes/general-settings.php:158 206 msgid "" 207 "Show recalculated regular price in Cart. Up to version 2.0.7 it was " 208 "displayed by default, but WooCommerce stopped displaying regular price, so " 209 "do we." 210 msgstr "" 211 "Zobrazit běžnou cenu v Košíku. Do verze 2.0.7 se zobrazovala normálně, ale " 212 "WooCommerce ji přestalo zobrazovat a tím my také." 213 214 #: includes/general-settings.php:165 175 #: includes/general-settings.php:157 176 msgid "Show recalculated regular price in Cart. Up to version 2.0.7 it was displayed by default, but WooCommerce stopped displaying regular price, so do we." 177 msgstr "Zobrazit běžnou cenu v Košíku. Do verze 2.0.7 se zobrazovala normálně, ale WooCommerce ji přestalo zobrazovat a tím my také." 178 179 #: includes/general-settings.php:164 215 180 msgid "Recalculated price additional text" 216 181 msgstr "Přídavný text pro přepočtenou cenu" 217 182 218 #: includes/general-settings.php:166 219 msgid "" 220 "Will be shown immediatelly after recalculated prices. Can be overriden in " 221 "product editor. Will be shown ONLY when recalculation takes place. You can " 222 "modify it's appearance through CSS class mcmp-recalc-price-suffix." 223 msgstr "" 224 "Zobrazí se za přepočtenou cenou. Lze nahradit v editoru produktu. Bude " 225 "zobrazen POUZE pokud k přepočtu dojde. Vzhled lze upravit přes CSS třídu " 226 "mcmp-recalc-price-suffix." 227 228 #: includes/general-settings.php:176 183 #: includes/general-settings.php:165 184 msgid "Will be shown immediatelly after recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-suffix." 185 msgstr "Zobrazí se za přepočtenou cenou. Lze nahradit v editoru produktu. Bude zobrazen POUZE pokud k přepočtu dojde. Vzhled lze upravit přes CSS třídu mcmp-recalc-price-suffix." 186 187 #: includes/general-settings.php:175 229 188 msgid "Prepostion for weight unit when using automatic text" 230 189 msgstr "Předložka před váhovou jednotkou při použití automatického textu" 231 190 232 #: includes/general-settings.php:177 233 msgid "" 234 "Automatic text will create text like this '$10/kg' with this option you can " 235 "replace '/' sign with what you want." 236 msgstr "" 237 "Automatický text vytvoří např. takovýto text '$10/kg'. Tímto nastavením " 238 "můžete změnit znak '/' na cokoliv potřebujete." 239 240 #: includes/general-settings.php:177 includes/general-settings.php:179 191 #: includes/general-settings.php:176 192 msgid "Automatic text will create text like this '$10/kg' with this option you can replace '/' sign with what you want." 193 msgstr "Automatický text vytvoří např. takovýto text '$10/kg'. Tímto nastavením můžete změnit znak '/' na cokoliv potřebujete." 194 195 #: includes/general-settings.php:176 includes/general-settings.php:178 241 196 msgid "To add space replace it with \"%\" sign." 242 197 msgstr "Mezery v textu nahraďte znakem \"%\"." 243 198 244 #: includes/general-settings.php:17 9199 #: includes/general-settings.php:178 245 200 msgid "Example \"/\" or \"per%\"." 246 201 msgstr "Příklad \"/\" nebo \"za%\"." 247 202 248 #: includes/general-settings.php:18 4203 #: includes/general-settings.php:183 249 204 msgid "Predefined additional text values" 250 205 msgstr "Předdefinované přídavné texty" 251 206 252 #: includes/general-settings.php:185 253 msgid "" 254 "Set of additional texts from which you will be able to choose on product " 255 "page. Multiple values can be separated with '|' sign." 256 msgstr "" 257 "Sada přídavných textů ze kterých budete moci vybírat na stránce produktu. " 258 "Vícero hodnot se odděluje znakem '|'." 259 260 #: includes/general-settings.php:191 207 #: includes/general-settings.php:184 208 msgid "Set of additional texts from which you will be able to choose on product page. Multiple values can be separated with '|' sign." 209 msgstr "Sada přídavných textů ze kterých budete moci vybírat na stránce produktu. Vícero hodnot se odděluje znakem '|'." 210 211 #: includes/general-settings.php:190 261 212 msgid "Separate text from price with space" 262 213 msgstr "Oddělit text od ceny mezerou" 263 214 264 #: includes/general-settings.php:192 265 msgid "" 266 "The additional text is normally separated from the recalculated price with " 267 "unbreakable space. If you don't want it uncheck this option." 268 msgstr "" 269 "Přídavný text je normálně oddělen od přepočtené ceny nedělitelnou mezerou. " 270 "Pokud toto nechcete odškrtněte toto nastavení." 271 272 #: includes/general-settings.php:199 215 #: includes/general-settings.php:191 216 msgid "The additional text is normally separated from the recalculated price with unbreakable space. If you don't want it uncheck this option." 217 msgstr "Přídavný text je normálně oddělen od přepočtené ceny nedělitelnou mezerou. Pokud toto nechcete odškrtněte toto nastavení." 218 219 #: includes/general-settings.php:198 273 220 msgid "Recalculated price prefix text" 274 221 msgstr "Text před přepočtenou cenu" 275 222 276 #: includes/general-settings.php:200 277 msgid "" 278 "Will be shown before the recalculated prices. Can be overriden in product " 279 "editor. Will be shown ONLY when recalculation takes place. You can modify " 280 "it's appearance through CSS class mcmp-recalc-price-prefix." 281 msgstr "" 282 "Zobrazí se před přepočtenou cenou. Lze nahradit v editoru produktu. Bude " 283 "zobrazen POUZE pokud k přepočtu dojde. Vzhled lze upravit přes CSS třídu " 284 "mcmp-recalc-price-prefix." 285 286 #: includes/general-settings.php:202 223 #: includes/general-settings.php:199 224 msgid "Will be shown before the recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-prefix." 225 msgstr "Zobrazí se před přepočtenou cenou. Lze nahradit v editoru produktu. Bude zobrazen POUZE pokud k přepočtu dojde. Vzhled lze upravit přes CSS třídu mcmp-recalc-price-prefix." 226 227 #: includes/general-settings.php:201 287 228 msgid "Example \"Price per kilogram:\"" 288 229 msgstr "Příklad \"Cena za kilogram:\"" 289 230 290 #: includes/general-settings.php:20 7231 #: includes/general-settings.php:206 291 232 msgid "Disable price rounding" 292 233 msgstr "Vypnout zaokrouhlování cen" 293 234 294 #: includes/general-settings.php:208 295 msgid "" 296 "Normally WooCommerce rounds displayed prices - if you want recalculated " 297 "prices trimmed instead check this field." 298 msgstr "" 299 "Normálně WooCommerce zaokrouhluje zobrazované ceny - pokud chcete místo toho " 300 "přepočtenou cenu ořezávat tak zaškrtněte toto políčko." 301 302 #: includes/general-settings.php:216 235 #: includes/general-settings.php:207 236 msgid "Normally WooCommerce rounds displayed prices - if you want recalculated prices trimmed instead check this field." 237 msgstr "Normálně WooCommerce zaokrouhluje zobrazované ceny - pokud chcete místo toho přepočtenou cenu ořezávat tak zaškrtněte toto políčko." 238 239 #: includes/general-settings.php:218 303 240 msgid "Maintenance" 304 241 msgstr "Údržba" 305 242 306 #: includes/general-settings.php:21 7243 #: includes/general-settings.php:219 307 244 msgid "These settings are related just to the plugin itself." 308 245 msgstr "Tato nastavení se týkají pouze pluginu samotného." 309 246 310 #: includes/general-settings.php:22 2247 #: includes/general-settings.php:224 311 248 msgid "Delete settings on uninstall" 312 249 msgstr "Smazat všechna nastavení při odinstalaci" 313 250 314 #: includes/general-settings.php:223 315 msgid "" 316 "With this setting you will delete all plugin settings on uninstallation." 317 msgstr "" 318 "Pomocí tohoto nastavení smažete všechna nastavení pluginu při odinstalaci." 251 #: includes/general-settings.php:225 252 msgid "With this setting you will delete all plugin settings on uninstallation." 253 msgstr "Pomocí tohoto nastavení smažete všechna nastavení pluginu při odinstalaci." 319 254 320 255 #: includes/product-settings.php:15 321 msgid "" 322 "Warning: This product has no weight set. The price per unit will not be " 323 "shown unless the weight is set on Shipping tab. Please check it." 324 msgstr "" 325 "Varování: Tento produkt nemá nastavenou váhu. Cena za jednotku nebude " 326 "zobrazena, dokud nenastavíte váhu na záložce Doprava. Prosím o " 327 "překontrolování." 328 329 #: includes/product-settings.php:18 256 msgid "Default - according to general settings" 257 msgstr "Výchozí - podle obecného nastavení" 258 259 #: includes/product-settings.php:16 260 msgid "Do not recalculate" 261 msgstr "Nepřepočítávat" 262 263 #: includes/product-settings.php:22 264 msgid "Warning: This product has no weight set. The price per unit will not be shown unless the weight is set on Shipping tab. Please check it." 265 msgstr "Varování: Tento produkt nemá nastavenou váhu. Cena za jednotku nebude zobrazena, dokud nenastavíte váhu na záložce Doprava. Prosím o překontrolování." 266 267 #: includes/product-settings.php:25 268 msgid "Local overrides for price recalculation" 269 msgstr "Lokální přenastavení přepočtu ceny" 270 271 #: includes/product-settings.php:26 272 msgid "These settings will affect only this product despite global settings." 273 msgstr "Tato nastavení ovlivní pouze tento produkt - navzdory obecnému nastavení." 274 275 #: includes/product-settings.php:27 276 msgid "Global settings can be found at " 277 msgstr "Obecná nastavení lze nalézt zde " 278 279 #: includes/product-settings.php:29 280 msgid "<i>WooCommerce -> Settings -> Products -> Price Per Unit</i>" 281 msgstr "<i>WooCommerce -> Nastavení -> Produkty -> Price per unit</i>" 282 283 #: includes/product-settings.php:54 330 284 msgid "Settings for Price per unit plug-in" 331 285 msgstr "Nastavení pro plug-in Price per Unit" 332 286 333 #: includes/product-settings.php: 20334 msgid "In PRO version you will find here settings for individual products"335 msgstr "Ve verzi PRO zde naleznete nastavení pro jednotlivé produkty"336 337 #: includes/product-settings.php: 21287 #: includes/product-settings.php:56 288 msgid "In PRO version you will find here more settings for individual products" 289 msgstr "Ve verzi PRO zde naleznete více možností nastavení pro jednotlivé produkty" 290 291 #: includes/product-settings.php:57 338 292 msgid "You can buy the plug-in here " 339 293 msgstr "Plug-in můžete zakoupit zde " 340 294 341 #: includes/product-settings.php: 23295 #: includes/product-settings.php:59 342 296 msgid "Price per Unit PRO" 343 297 msgstr "Price Per Unit PRO" 344 298 345 #: includes/product-settings.php:26 346 msgid "Features you will find here:" 347 msgstr "Možnosti, které zde naleznete:" 348 349 #: includes/product-settings.php:27 350 msgid "- Change of display for product page" 351 msgstr "- Změna zobrazení na stránce produktu" 352 353 #: includes/product-settings.php:28 354 msgid "- Change of display for shop page" 355 msgstr "- Změna zobrazení na stránce obchodu" 356 357 #: includes/product-settings.php:29 358 msgid "- Individual text for recalculated price" 359 msgstr "- Individuální text pro přepočtenou cenu" 360 361 #: includes/product-settings.php:30 362 msgid "" 363 "- Option to display price for different weight unit (kg,g,lbs,oz) from shop " 364 "default. Example: shop in kg and some products in grams" 365 msgstr "" 366 "- Možnost zobrazení přepočtené ceny pro jinou váhovou jednotku (kg, g, lb, " 367 "unce) než je hlavní jednotka obchodu. Příklad: obchod je v kg a některé " 368 "produkty v gramech" 369 370 #: includes/product-settings.php:31 371 msgid "" 372 "- Option for entering weight, different from shipping weight. Example: use " 373 "shipping weight as gross and recalculate per net weight." 374 msgstr "" 375 "- Možnost zadat váhu, která je rozdílná od váhy pro dopravu. Příklad: " 376 "použijete váhu pro dopravu jako brutto a přepočet se provede na netto váze." 377 378 #: includes/product-settings.php:32 379 msgid "" 380 "- Option for displaying recalculation for different number of units. " 381 "Example: You can display price per 5kg" 382 msgstr "" 383 "- Možnost zobrazení přepočtu pro jiný počet jednotek. Příklad: Můžete " 384 "zobrazit cenu za 5 kg" 385 386 #: includes/product-settings.php:36 387 msgid "New plug-in available - Sell by Weight PRO" 388 msgstr "Nový plug-in k dispozici - Sell by Weight PRO" 389 390 #: includes/product-settings.php:38 391 msgid "" 392 "This plug-in allows you to sell easily products, where you want to have " 393 "several weight option to sell at the same price for kilogram." 394 msgstr "" 395 "Tento plug-in Vám umožnuje jednoduše prodávat produkty, u kterých chete mít " 396 "na výběr z několika váhových možností při stejné ceně za kilogram." 397 398 #: includes/product-settings.php:39 399 msgid "" 400 "It works in a similar way as Variable products, but it is easier to manage " 401 "because you will enter the price only once and the options price is " 402 "calculated automatically." 403 msgstr "" 404 "Pracuje podobně jako Produkt s variantami, ale je snadnější na údžbu, " 405 "protože cenu za produkt zadáte jen jednou a ceny za jednotlivé váhové " 406 "možnosti se vypočítají automaticky." 407 408 #: includes/product-settings.php:40 299 #: includes/product-settings.php:63 300 msgid "PRO Version features:" 301 msgstr "Funkce PRO verze:" 302 303 #: includes/product-settings.php:65 304 msgid "- New feature - Quick Editor settings: Easily adjust Price Per Unit (PPU) settings on the fly." 305 msgstr "- Nová funkce - nastavení pro Rychlé úpravy: Snadná úprava nastavení Price per Unit (PPU) za chodu." 306 307 #: includes/product-settings.php:66 308 msgid "- New feature - Bulk Editor settings: Save time by editing PPU settings in bulk." 309 msgstr "- Nová funkce - nastavení pro Hromadné úpravy: Ušetřete čas hromadnými úpravami nastavení PPU." 310 311 #: includes/product-settings.php:67 312 msgid "- Enhanced display options: Customize how prices appear on product pages." 313 msgstr "- Rozšířené možnosti zobrazení: Přizpůsobte si zobrazení cen na stránkách produktu." 314 315 #: includes/product-settings.php:68 316 msgid "- Shop Page display options: More ways to showcase prices on your shop page." 317 msgstr "- Možnosti zobrazení stránky obchodu: Více možnosti zobrazení cen na stránce obchodu." 318 319 #: includes/product-settings.php:69 320 msgid "- Custom text for recalculated prices: Tailor the recalculated price display text." 321 msgstr "- Vlastní text pro přepočítané ceny: Přizpůsobte si text pro zobrazení přepočítaných cen." 322 323 #: includes/product-settings.php:70 324 msgid "- Flexible weight unit display: Show prices for different units (kg, g, lbs, oz) from your shop default unit. Example: shop in kg and some products in grams." 325 msgstr "- Flexibilní zobrazení váhové jednotky: Zobrazí cenu pro jinou jednotku (kg, g, lbs, oz) než je výchozí jednotka obchodu. Příklad: obchod je v kg a některé produkty v gramech." 326 327 #: includes/product-settings.php:71 328 msgid "- Alternative Weight Entry: Differentiate between shipping weight and net weight for accurate pricing. Example: use shipping weight as gross and recalculate per net weight." 329 msgstr "- Alternativní zadání hmotnosti: Rozlišujte mezi přepravní hmotností a čistou hmotností pro přepočet ceny. Příklad: Použijte přepravní hmotnost jako brutto a zatímco přepočet se provede na netto váze." 330 331 #: includes/product-settings.php:72 332 msgid "- Multiple unit Recalculation: Display prices per different quantities (e.g., price per 5kg)." 333 msgstr "- Přepočet pro více jednotek: Zobrazení cen za jiné množství (např. cena za 5 kg)." 334 335 #: includes/product-settings.php:73 336 msgid "- Possibility to save prices in database for later use." 337 msgstr "- Možnost uložení cen do databáze pro pozdější použití." 338 339 #: includes/product-settings.php:74 340 msgid "- WPML Compatible: Seamless integration with WPML for multilingual support." 341 msgstr "- Kompatibilní s WPML: Bezproblémová integrace s WPML pro vícejazyčnou podporu." 342 343 #: includes/product-settings.php:78 344 msgid "Another Must-Have Plugin: Sell by Weight PRO" 345 msgstr "Další užitečný plug-in k dispozici - Sell by Weight PRO" 346 347 #: includes/product-settings.php:80 348 msgid "Simplify product pricing with Sell by Weight PRO!" 349 msgstr "Zjednodušte si tvorbu cen produktů s Sell by Weight PRO!" 350 351 #: includes/product-settings.php:81 352 msgid "Easily sell products at a constant price per kilogram with multiple weight options." 353 msgstr "Prodávejte produkty snadněji při konstantní ceně za kilogram s vícero váhovými položkami." 354 355 #: includes/product-settings.php:82 356 msgid "Enter the unit price once and let the plugin calculate options prices based on their weight." 357 msgstr "Zadejte jednotkovou cenu a nechte plugin vypočítat ceny jednotlivých možností na základě jejich hmotnosti." 358 359 #: includes/product-settings.php:83 360 msgid "It works similarly as Variable products, but it is easier to manage." 361 msgstr "Funguje podobně jako variabilní produkty, ale je jednodušší na správu." 362 363 #: includes/product-settings.php:84 364 msgid "The plugin is compatible with all WooCommerce weight units and works with the one you've chosen." 365 msgstr "Plugin je kompatibilní se všemi váhovými jednotkami WooCommerce a pracuje s tou, kterou jste je vybraná." 366 367 #: includes/product-settings.php:85 includes/product-settings.php:97 409 368 msgid "More information can be found here " 410 369 msgstr "Více informací najdete zde " 411 370 412 #: includes/product-settings.php: 42371 #: includes/product-settings.php:87 413 372 msgid "Sell by Weight PRO" 414 373 msgstr "Sell by Weight PRO" 415 374 416 #: includes/product-settings.php:45 417 msgid "Note for old version users:" 418 msgstr "Poznámka pro uživaatele starší verze:" 419 420 #: includes/product-settings.php:46 421 msgid "" 422 "All your settings from this page are still in database, if you upgrade to " 423 "PRO version it will be available again." 424 msgstr "" 425 "Všechna nastavení z této stránky jsou stále v databázi, pokud provedete " 426 "upgrade na PRO verzi vše bude opět přístupné." 427 428 #: includes/product-settings.php:47 429 msgid "" 430 "If you are not interested in buying PRO version and still want to use the " 431 "old features, please downgrade to free version 1.9.3." 432 msgstr "" 433 "Pokud nemáte zájem o koupi PRO verze, ale stále chcete používat nastavení z " 434 "této stránky prosím proveďte downgrade na volnou verzi 1.9.3." 435 436 #: includes/product-settings.php:49 437 msgid "Download here." 438 msgstr "Ke stažení zde." 439 440 #: woo-price-per-unit.php:119 woo-price-per-unit.php:359 375 #: includes/product-settings.php:91 376 msgid "New plug-in available - Unit Based Stock PRO" 377 msgstr "Nový plug-in k dispozici - Unit Based Stock PRO" 378 379 #: includes/product-settings.php:93 380 msgid "Manage your stock in Weight units!" 381 msgstr "Spravujte skladové zásoby v jednotkách hmotnosti!" 382 383 #: includes/product-settings.php:94 384 msgid "Handle inventory in weight units - a capability unprecedented in WooCommerce, which traditionally manages stock solely based on purchased quantity." 385 msgstr "Udržujte skladové zásoby v hmotnostních jednotkách - schopnost, která je ve WooCommerce nevídaná. WooCommerce tradičně udržuje skladové zásoby pouze na základě nakoupeného množství." 386 387 #: includes/product-settings.php:95 388 msgid "Override the product weight with custom stock value. This value will be used for inventory deduction." 389 msgstr "Možnost náhrady hmotnosti produktu vlastní skladovou hodnotou. Tato hodnota bude použita pro odpočet zásob." 390 391 #: includes/product-settings.php:96 392 msgid "Supports decimal values for stock inventory as well." 393 msgstr "Podporuje desetinné hodnoty pro skladové zásoby." 394 395 #: includes/product-settings.php:99 396 msgid "Unit Based Stock PRO" 397 msgstr "Unit Based Stock PRO" 398 399 #: woo-price-per-unit.php:274 400 msgid "Price per unit plugin - PRO version is active. Please deactivate it first." 401 msgstr "Price per unit plugin - je aktivní PRO verze. Nejprve ji deaktivujte." 402 403 #: woo-price-per-unit.php:320 404 msgid "Plugin NOT activated: " 405 msgstr "Plugin NEBYL aktivován: " 406 407 #: woo-price-per-unit.php:386 408 msgid "Settings" 409 msgstr "Nastavení" 410 411 #: woo-price-per-unit.php:400 441 412 msgid "Price Per Unit" 442 413 msgstr "Price Per Unit" 443 414 444 #: woo-price-per-unit.php:120 445 msgid " - there was a change in the process of displaying." 446 msgstr " - došlo ke změně zpracování zobrazení." 447 448 #: woo-price-per-unit.php:240 449 msgid "" 450 "Price per unit plugin - PRO version is active. Please deactivate it first." 451 msgstr "Price per unit plugin - je aktivní PRO verze. Nejprve ji deaktivujte." 452 453 #: woo-price-per-unit.php:278 454 msgid "Plugin NOT activated: " 455 msgstr "Plugin NEBYL aktivován: " 456 457 #: woo-price-per-unit.php:346 458 msgid "Settings" 459 msgstr "Nastavení" 460 461 #: woo-price-per-unit.php:383 415 #: woo-price-per-unit.php:436 462 416 msgid "Price Per Unit - free version" 463 417 msgstr "Price Per Unit - verze zdarma" 464 418 465 #: woo-price-per-unit.php: 543419 #: woo-price-per-unit.php:609 466 420 msgctxt "weight unit" 467 421 msgid "kg" … … 471 425 msgstr[2] "kg" 472 426 473 #: woo-price-per-unit.php: 546427 #: woo-price-per-unit.php:612 474 428 msgctxt "weight unit" 475 429 msgid "g" … … 479 433 msgstr[2] "g" 480 434 481 #: woo-price-per-unit.php: 549435 #: woo-price-per-unit.php:615 482 436 msgctxt "weight unit" 483 437 msgid "oz" … … 487 441 msgstr[2] "uncí" 488 442 489 #: woo-price-per-unit.php: 552443 #: woo-price-per-unit.php:618 490 444 msgctxt "weight unit" 491 445 msgid "lb" … … 495 449 msgstr[2] "liber" 496 450 451 #: woo-price-per-unit.php:974 497 452 #, php-format 498 #~ msgid "Now 30% discount with this coupon: SKKG9DKN" 499 #~ msgstr "Nyní 30% sleva s tímto kupónem: SKKG9DKN" 500 501 #~ msgid "Coupon is valid till the end of April." 502 #~ msgstr "Kupón je platný do konce dubna." 503 504 #~ msgid "without VAT" 505 #~ msgstr "bez DPH" 506 507 #~ msgid "Variations - display recalculated price on option" 508 #~ msgstr "Varianty - zobrazit přepočtenou cenu při výběru varianty" 509 510 #~ msgid "" 511 #~ "Display recalculated price as new row after selected variant price on " 512 #~ "single product page. Doesn't show if recalculation is off for the product" 513 #~ msgstr "" 514 #~ "Zobrazí přepočtenou cenu jako nový řádek za cenou vybrané varianty na " 515 #~ "stránce produktu. Nezobrazuje se pokud je přepočet vypnutý pro daný " 516 #~ "produkt" 517 518 #~ msgid "" 519 #~ "Force display this feature even when recalculation is off for the product" 520 #~ msgstr "" 521 #~ "Vynutit zobrazení této možnosti i pokud je přepočet pro produkt vypnut" 522 523 #~ msgid "Special cases" 524 #~ msgstr "Speciální případy" 525 526 #~ msgid "" 527 #~ "These settings will help you when you need to alter the way the " 528 #~ "recalculation works. Use with caution - it will change the visible price." 529 #~ msgstr "" 530 #~ "Tato nastavení Vám pomohou pokud potřebujete změnit způsob jakým přepočet " 531 #~ "ceny funguje. Používejte s opatrností - toto změní viditelnou cenu." 532 533 #~ msgid "Recalculate per units" 534 #~ msgstr "Přepočítat na jednotky" 535 536 #~ msgid "" 537 #~ "The recalculation works with one weight unit (kg,g,oz,...) here you can " 538 #~ "set different number of units for recalculation - i.e. to display price " 539 #~ "for 100 grams." 540 #~ msgstr "" 541 #~ "Přepočet funguje na jednu váhovou jednotku (kg,g,oz,...) zde si můžete " 542 #~ "nastavit jiný počet jednotek pro přepočet - např. k zobrazení ceny za 100 " 543 #~ "gramů." 544 545 #~ msgid "Enter number of units in decimal form - default is 1 or empty" 546 #~ msgstr "Zadejte číslo v desetinném formátu - výchozí je 1 nebo prázdné" 547 548 #~ msgid "Activate" 549 #~ msgstr "Aktivovat" 550 551 #~ msgid "Deactivate" 552 #~ msgstr "Deaktivovat" 553 554 #~ msgid "Licence" 555 #~ msgstr "Licence" 556 557 #~ msgid "" 558 #~ "Please enter the license key for this product to activate it. You were " 559 #~ "given a license key when you purchased this item." 560 #~ msgstr "" 561 #~ "Zadejte prosím licenční klíč tohoto produktu pro jeho aktivaci. Licenční " 562 #~ "klíč jste dostali při zakoupení produktu." 563 564 #~ msgid "Licence key" 565 #~ msgstr "Licenční klíč" 566 567 #~ msgid "Default - according to general settings" 568 #~ msgstr "Výchozí - podle obecného nastavení" 569 570 #~ msgid "Custom text - enter in textbox below" 571 #~ msgstr "Vlastní text - zadejte do políčka níže" 572 573 #~ msgid "" 574 #~ "Warning: This product has no weight set. The price per unit will not be " 575 #~ "shown unless the weight is set on Shipping tab (or in more complicated " 576 #~ "cases in the field \"Custom number of units\"). Please check it." 577 #~ msgstr "" 578 #~ "Varování: Tento produkt nemá nastavenou váhu. Cena za jednotku nebude " 579 #~ "zobrazena, dokud nenastavíte váhu na záložce Doprava (nebo v " 580 #~ "komplikovanějších případech v políčku \"Vlastní počet jednotek\"). Prosím " 581 #~ "o překontrolování." 582 583 #~ msgid "" 584 #~ "If you use Variable product you can also set weight for each variation " 585 #~ "separately." 586 #~ msgstr "" 587 #~ "Pokud pouužíváte Produkt s variantami, pak můžete nastavit váhu pro " 588 #~ "jednotlivé varianty zvlášť." 589 590 #~ msgid "Local overrides for price recalculation" 591 #~ msgstr "Lokální přenastavení přepočtu ceny" 592 593 #~ msgid "" 594 #~ "These settings will affect only this product despite global settings." 595 #~ msgstr "" 596 #~ "Tato nastavení ovlivní pouze tento produkt - navzdory obecnému nastavení." 597 598 #~ msgid "Global settings can be found at " 599 #~ msgstr "Obecná nastavení lze nalézt zde " 600 601 #~ msgid "<i>WooCommerce -> Settings -> Products -> Price Per Unit</i>" 602 #~ msgstr "<i>WooCommerce -> Nastavení -> Produkty -> Price per unit</i>" 603 604 #~ msgid "Do not recalculate" 605 #~ msgstr "Nepřepočítávat" 606 607 #~ msgid "" 608 #~ "Will be shown immediatelly after recalculated prices. Will be shown ONLY " 609 #~ "when recalculation takes place. If you want more options in this list, " 610 #~ "you can add them in Global settings of this plugin." 611 #~ msgstr "" 612 #~ "Zobrazí se za přepočtenou cenou. Bude zobrazen POUZE pokud k přepočtu " 613 #~ "dojde. Pokud chcete více možností v tomto výběru můžete je přidat v " 614 #~ "obecném nastavení tohoto pluginu." 615 616 #~ msgid "" 617 #~ "Should be used only if you want unique text. For repeated texts it is " 618 #~ "better to cofigure it in Global settings." 619 #~ msgstr "" 620 #~ "Mělo by být používáno pouze pro unikátní případy. Pokud chcete text " 621 #~ "používat vícekrát, je lepší ho nadefinovat v obecném nastavení." 622 623 #~ msgid "Enter custom recalculated price additional text. Example \"/piece\"" 624 #~ msgstr "" 625 #~ "Zadejte vlastní přídavný text pro přepočtenou cenu. Příklad \"/kus\"" 626 627 #~ msgid "Local overrides for general price options" 628 #~ msgstr "Lokální přenastavení obecných nastavení ceny" 629 630 #~ msgid "This will be visible even if there is no recalculation." 631 #~ msgstr "Toto bude viditelné i pokud nedojde k přepočtu ceny." 632 633 #~ msgid "Price additional text" 634 #~ msgstr "Přídavný text pro cenu" 635 636 #~ msgid "Custom number of units / different weight" 637 #~ msgstr "Vlastní počet jednotek / jiná váha" 638 639 #~ msgid "" 640 #~ "Sometimes you may want to use different unit or weight than specified on " 641 #~ "shipping tab. Here you can enter how much of the product you sell." 642 #~ msgstr "" 643 #~ "Občas může být potřeba použít jinou jednotku nebo váhu než ta která je " 644 #~ "daná na záložce doprava. Zde můžete zadat kolik daného produktu prodáváte." 645 646 #~ msgid "" 647 #~ "Example 1: You are selling 5 pack of t-shirts and you want to show price " 648 #~ "for 1 piece(enter 5 here)" 649 #~ msgstr "" 650 #~ "Příklad 1: Prodáváte balíček 5 kusů triček a chcete zobrazovat cenu za 1 " 651 #~ "kus (sem zadáte 5)" 652 653 #~ msgid "" 654 #~ "Example 2: You are selling food in some package and you need to have the " 655 #~ "weight in shipping tab with the package for shipping purposes. But you " 656 #~ "want to show the proper recalculated price per content weight. Put full " 657 #~ "weight in shipping tab and enter here the weight of the content alone." 658 #~ msgstr "" 659 #~ "Příklad 2: Prodáváte potraviny v nějakém obalua potřebujete zachovat váhu " 660 #~ "na záložce doprava kvůli výpočtu poštovného. Přepočtenou cenu ale chcete " 661 #~ "ukazovat pouze za obsah. Na záložce doprava dáte hrubou hmotnost a sem " 662 #~ "zadáte hmotnost čistě obsahu." 663 664 #~ msgid "Custom number of units" 665 #~ msgstr "Vlastní počet jednotek" 666 667 #~ msgid "If you don't want to use this delete the value or set it to 0" 668 #~ msgstr "Pokud toto nechcete používat, vymažte hodnotu, nebo zadejte 0" 669 670 #~ msgid "Enter number of units in decimal form - default is 0 or empty" 671 #~ msgstr "" 672 #~ "Zadejte počet jednotek v desetinném formátu - výchozí je 0 nebo prázdné" 673 674 #, php-format 675 #~ msgid "" 676 #~ "Warning: \"Custom number of units\", is still related to original units " 677 #~ "(currently %s). So if you have shop in kg, and you enter there 5 and " 678 #~ "change unit to g the price will be recalculted per 5 kg not grams." 679 #~ msgstr "" 680 #~ "Varování: \"Vlastní počet jednotek\" je stále spojený s původní váhovou " 681 #~ "jednotkou (nyní %s). Takže pokud máte obchod nastaven na kilogramy, počet " 682 #~ "jednotek 5 a změníte váhovou jednotku na gramy, cena bude přepočítávána " 683 #~ "na 5 kg a ne gramů. Pouze bude zobrazena cena za gram." 684 685 #~ msgid "Different weight unit" 686 #~ msgstr "Jiná váhová jednotka" 687 688 #~ msgid "" 689 #~ "The case scenario is that your shop is set to sell in Kg, but for some " 690 #~ "products you want show the price for Grams instead. Doesn't change the " 691 #~ "weight into selected unit - only shows how much the selected unit costs" 692 #~ msgstr "" 693 #~ "Případné použití je, že e-shop máte nastavený pro prodej v Kg, ale u " 694 #~ "některých produktů chcete zobrazit cenu vypočítanou za Gramy. Toto " 695 #~ "nastavení váhu produktu do vybrané jednotky - pouze zobrazí jaká bude " 696 #~ "cena za určanou jednoktu" 697 698 #, php-format 699 #~ msgid "Recalculate price per this unit. Current shop unit is \"%s\"" 700 #~ msgstr "" 701 #~ "Přepočítá váhu na tuto jednotku. Současná jednotka obchodu je \"%s\"" 702 703 #~ msgid "Shop default" 704 #~ msgstr "Nastavení e-shopu" 705 706 #~ msgid "" 707 #~ "The recalculation works with one weight unit (kg,g,oz,...) here you can " 708 #~ "set different number of units for recalculation - i.e. to display price " 709 #~ "for 100 grams (If your shop is in Kg enter 0.1 for 100 grams)." 710 #~ msgstr "" 711 #~ "Přepočet funguje na jednu váhovou jednotku (kg,g,oz,...) zde si můžete " 712 #~ "nastavit jiný počet jednotek pro přepočet - např. k zobrazení ceny za 100 " 713 #~ "gramů (Pokud je e-shop nastavený pro prodej v Kg zadejte 0.1 pro přepočet " 714 #~ "na 100 gramů)." 715 716 #~ msgid "" 717 #~ "Default is 1. If you don't want to use this delete the value or set it to " 718 #~ "1" 719 #~ msgstr "" 720 #~ "Výchozí je 1. Pokud toto nechcete používat vymažte hodnotu, nebo ji " 721 #~ "nastavte na 1" 722 723 #~ msgid "Enter number in decimal form - default is 1 or empty" 724 #~ msgstr "Zadejte číslo v desetinném formátu - výchozí je 1 nebo prázdné" 725 726 #~ msgid "" 727 #~ "For more information look at tab 'Price per unit' - this is variation " 728 #~ "override. Warning - use with caution - changes visible price." 729 #~ msgstr "" 730 #~ "Pro více informací se podívejte na záložku 'Price per Unit' - toto je " 731 #~ "přenastavení pro variantu. Používejte s opatrností - toto změní " 732 #~ "viditelnou cenu." 733 734 #~ msgid "Unexpected Error! The query returned with an error:" 735 #~ msgstr "Neočekávaná chyba! Server vrátil následující chybu:" 736 737 #~ msgid "Licence activation was successful." 738 #~ msgstr "Aktivace licence byla úspěšná." 739 740 #~ msgid "Licence de-activation was successful." 741 #~ msgstr "Deaktivování licence bylo úspěšné." 742 743 #~ msgid "Message from the server: " 744 #~ msgstr "Zpráva ze serveru: " 745 746 #~ msgid "There was an error when activating licence!" 747 #~ msgstr "Nastala chyba při aktivování licence!" 748 749 #~ msgid "There was an error when de-activating licence!" 750 #~ msgstr "Nastala chyba při de-aktivování licence!" 751 752 #~ msgid "Licence key cannot be empty." 753 #~ msgstr "Pole licenční klíč nesmí být prázdné." 754 755 #~ msgid "The plugin licence is not activated" 756 #~ msgstr "Licence pluginu není aktivována" 757 758 #~ msgid "Activate licence" 759 #~ msgstr "Aktivovat licenci" 760 761 #~ msgid "" 762 #~ "This text will be shown after price text. You can modify it's appearance " 763 #~ "through CSS class mcmp-general-price-suffix." 764 #~ msgstr "" 765 #~ "This text will be shown after price text. You can modify it's appearance " 766 #~ "through CSS class mcmp-general-price-suffix." 767 768 #~ msgid "You are probably not connected to internet." 769 #~ msgstr "Pravděpodobně nejste připojeni k internetu." 770 771 #~ msgid "Price per unit" 772 #~ msgstr "Price per unit" 773 774 #~ msgid "Different weight unit - " 775 #~ msgstr "Jiná váhová jednotka - " 776 777 #~ msgid "Recalculate per units - " 778 #~ msgstr "Přepočítat na jednotky - " 779 780 #~ msgid "Custom recalculation ratio" 781 #~ msgstr "Upravit koeficient přepočtu" 782 783 #~ msgid "" 784 #~ "Weight unit will be multiplied by this ratio. Example if you need to " 785 #~ "calculate price for 100g instead of 1Kg(=1000g) enter 0.1" 786 #~ msgstr "" 787 #~ "Váhová jednotka bude násobena tímto koeficientem. Příklad užití: pokud " 788 #~ "potřebujete cenu počítat za 100g místo za 1Kg(=1000g) zadejte koeficient " 789 #~ "0.1" 790 791 #~ msgid "Enter ratio or leave empty disable this function" 792 #~ msgstr "Zadejte poměr, nebo nechte prázdné k vypnutí této funkce" 793 794 #~ msgid "This text will be shown after every price text." 795 #~ msgstr "Tento text bude zobrazen za každou cenou." 453 msgid "Price per Unit requires WooCommerce to be installed and active. You can download %s here." 454 msgstr "Price per Unit vyžaduje aby byl nainstalován a aktivní plugin WooCommerce. %s lze stáhnout zde." 455 456 #~ msgid "Important notice about new version" 457 #~ msgstr "Důležité upozornění k nové verzi" 458 459 #~ msgid "It is no loger possible to change behaviour on single product - please check your product settings to get more info." 460 #~ msgstr "Již není možné měnit chování přepočtu na jednotlivých stránkách - podívejte se prosím na nastavení produktu pro další informace." 461 462 #~ msgid "Features you will find here:" 463 #~ msgstr "Možnosti, které zde naleznete:" 464 465 #~ msgid "- Change of display for product page" 466 #~ msgstr "- Změna zobrazení na stránce produktu" 467 468 #~ msgid "- Change of display for shop page" 469 #~ msgstr "- Změna zobrazení na stránce obchodu" 470 471 #~ msgid "- Individual text for recalculated price" 472 #~ msgstr "- Individuální text pro přepočtenou cenu" 473 474 #~ msgid "- Option for displaying recalculation for different number of units. Example: You can display price per 5kg" 475 #~ msgstr "- Možnost zobrazení přepočtu pro jiný počet jednotek. Příklad: Můžete zobrazit cenu za 5 kg" 476 477 #~ msgid "This plug-in allows you to sell easily products, where you want to have several weight option to sell at the same price for kilogram." 478 #~ msgstr "Tento plug-in Vám umožnuje jednoduše prodávat produkty, u kterých chete mít na výběr z několika váhových možností při stejné ceně za kilogram." 479 480 #~ msgid "It works in a similar way as Variable products, but it is easier to manage because you will enter the price only once and the options price is calculated automatically." 481 #~ msgstr "Pracuje podobně jako Produkt s variantami, ale je snadnější na údžbu, protože cenu za produkt zadáte jen jednou a ceny za jednotlivé váhové možnosti se vypočítají automaticky." 482 483 #~ msgid "Note for old version users:" 484 #~ msgstr "Poznámka pro uživaatele starší verze:" 485 486 #~ msgid "All your settings from this page are still in database, if you upgrade to PRO version it will be available again." 487 #~ msgstr "Všechna nastavení z této stránky jsou stále v databázi, pokud provedete upgrade na PRO verzi vše bude opět přístupné." 488 489 #~ msgid "If you are not interested in buying PRO version and still want to use the old features, please downgrade to free version 1.9.3." 490 #~ msgstr "Pokud nemáte zájem o koupi PRO verze, ale stále chcete používat nastavení z této stránky prosím proveďte downgrade na volnou verzi 1.9.3." 491 492 #~ msgid "Download here." 493 #~ msgstr "Ke stažení zde." -
woo-price-per-unit/trunk/languages/woo-price-per-unit.pot
r2670562 r3090318 4 4 msgid "" 5 5 msgstr "" 6 "Project-Id-Version: WooCommerce Price Per Unit 2.0.9\n"7 "POT-Creation-Date: 202 2-02-01 13:28+0100\n"6 "Project-Id-Version: WooCommerce Price Per Unit - free version 2.2.4\n" 7 "POT-Creation-Date: 2024-05-21 16:05+0200\n" 8 8 "PO-Revision-Date: 2017-04-06 16:00-0500\n" 9 9 "Last-Translator: Martin Mechura\n" … … 13 13 "Content-Type: text/plain; charset=UTF-8\n" 14 14 "Content-Transfer-Encoding: 8bit\n" 15 "X-Generator: Poedit 2.4.3\n"15 "X-Generator: Poedit 3.4.4\n" 16 16 "X-Poedit-SourceCharset: UTF-8\n" 17 17 "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;esc_attr__;esc_html__;esc_html_e;esc_html_x:1,2c;_nx_noop:1,2,3c\n" … … 24 24 "X-Poedit-SearchPathExcluded-4: -interesting\n" 25 25 26 #: includes/database-upgrade.php:38 27 msgid "WooCommerce Price per Unit - database needs an update. Please back up your database first!" 28 msgstr "" 29 30 #: includes/database-upgrade.php:39 31 msgid "Upgrade database" 32 msgstr "" 33 34 #: includes/database-upgrade.php:42 35 msgid "WooCommerce Price per Unit - database updated successfully." 36 msgstr "" 37 38 #: includes/general-settings.php:22 39 msgid "No additional text" 40 msgstr "" 41 26 42 #: includes/general-settings.php:23 27 msgid "No additional text"28 msgstr ""29 30 #: includes/general-settings.php:2431 43 msgid "Automatic text - takes unit settings from product" 32 44 msgstr "" 33 45 46 #: includes/general-settings.php:34 47 msgid "General price options" 48 msgstr "" 49 34 50 #: includes/general-settings.php:35 35 msgid " Important notice about new version"36 msgstr "" 37 38 #: includes/general-settings.php: 36 woo-price-per-unit.php:12139 msgid " It is no loger possible to change behaviour on single product - please check your product settings to get more info."51 msgid "Settings which affects all products" 52 msgstr "" 53 54 #: includes/general-settings.php:40 55 msgid "General price additional text" 40 56 msgstr "" 41 57 42 58 #: includes/general-settings.php:41 43 msgid " General price options"59 msgid "This text will be shown after every price text. You can modify it's appearance through CSS class mcmp-general-price-suffix." 44 60 msgstr "" 45 61 46 62 #: includes/general-settings.php:42 47 msgid "Settings which affects all products" 48 msgstr "" 49 50 #: includes/general-settings.php:47 51 msgid "General price additional text" 63 msgid "Example \"Without Vat\"" 52 64 msgstr "" 53 65 54 66 #: includes/general-settings.php:48 55 msgid " This text will be shown after every price text. You can modify it's appearance through CSS class mcmp-general-price-suffix."67 msgid "Sale price - hide regular price" 56 68 msgstr "" 57 69 58 70 #: includes/general-settings.php:49 59 msgid "Example \"Without Vat\""60 msgstr ""61 62 #: includes/general-settings.php:5563 msgid "Sale price - hide regular price"64 msgstr ""65 66 #: includes/general-settings.php:5667 71 msgid "When product is on sale it shows regular price and sale price. This will hide the regular price for all products." 68 72 msgstr "" 69 73 70 #: includes/general-settings.php:6 474 #: includes/general-settings.php:60 71 75 msgid "Options for variable products" 72 76 msgstr "" 73 77 74 #: includes/general-settings.php:6 578 #: includes/general-settings.php:61 75 79 msgid "These settings affect only variable products" 76 80 msgstr "" 77 81 78 #: includes/general-settings.php: 7082 #: includes/general-settings.php:66 79 83 msgid "Variations - prefix for variable price" 80 84 msgstr "" 81 85 82 #: includes/general-settings.php: 7186 #: includes/general-settings.php:67 83 87 msgid "If the product is variable this text will be shown before the price. You can modify it's appearance through CSS class mcmp-variable-price-prefix." 84 88 msgstr "" 85 89 86 #: includes/general-settings.php: 7290 #: includes/general-settings.php:68 87 91 msgid "Example \"From:\"" 88 92 msgstr "" 89 93 90 #: includes/general-settings.php:7 994 #: includes/general-settings.php:75 91 95 msgid "Variations - Display only lower price" 92 96 msgstr "" 93 97 94 #: includes/general-settings.php: 8098 #: includes/general-settings.php:76 95 99 msgid "When displaying variation the price is displayed as \"$10-$25\". With this setting you will get just \"$10\"" 96 100 msgstr "" 97 101 98 #: includes/general-settings.php:8 7102 #: includes/general-settings.php:83 99 103 msgid "Variations - Show regular price" 100 104 msgstr "" 101 105 102 #: includes/general-settings.php:8 8106 #: includes/general-settings.php:84 103 107 msgid "Mimics pre WooCommerce 3 variable product price display - Shows how much was the cost before sale" 104 108 msgstr "" 105 109 110 #: includes/general-settings.php:95 111 msgid "Price recalculation" 112 msgstr "" 113 106 114 #: includes/general-settings.php:96 107 msgid "Price recalculation"108 msgstr ""109 110 #: includes/general-settings.php:97111 115 msgid "General settings for price recalculation" 112 116 msgstr "" 113 117 118 #: includes/general-settings.php:101 119 msgid "New row different styling" 120 msgstr "" 121 114 122 #: includes/general-settings.php:102 115 msgid "New row different styling"116 msgstr ""117 118 #: includes/general-settings.php:103119 123 msgid "When displaying price as new row, the new row will be displayed in italics with slightly smaller font size. For more styling you can use CSS class mcmp_recalc_price_row." 120 124 msgstr "" 121 125 122 #: includes/general-settings.php:1 10126 #: includes/general-settings.php:109 includes/product-settings.php:35 123 127 msgid "Shop page price behavior" 124 128 msgstr "" 125 129 126 #: includes/general-settings.php:11 1130 #: includes/general-settings.php:110 includes/product-settings.php:36 127 131 msgid "Behaviour of recalculated price on shop page" 128 132 msgstr "" 129 133 134 #: includes/general-settings.php:116 includes/general-settings.php:131 135 #: includes/general-settings.php:146 136 msgid "Do not show recalculated price" 137 msgstr "" 138 130 139 #: includes/general-settings.php:117 includes/general-settings.php:132 140 msgid "Show recalculated price as new row" 141 msgstr "" 142 143 #: includes/general-settings.php:118 includes/general-settings.php:133 144 msgid "Replace price view with recalculated" 145 msgstr "" 146 147 #: includes/general-settings.php:124 includes/product-settings.php:45 148 msgid "Single product page behavior" 149 msgstr "" 150 151 #: includes/general-settings.php:125 includes/product-settings.php:46 152 msgid "Behaviour of recalculated price on single product page" 153 msgstr "" 154 155 #: includes/general-settings.php:139 156 msgid "Cart page behavior" 157 msgstr "" 158 159 #: includes/general-settings.php:140 160 msgid "Behaviour of recalculated price on cart page. Always displayed as new row." 161 msgstr "" 162 131 163 #: includes/general-settings.php:147 132 msgid "Do not show recalculated price" 133 msgstr "" 134 135 #: includes/general-settings.php:118 includes/general-settings.php:133 136 msgid "Show recalculated price as new row" 137 msgstr "" 138 139 #: includes/general-settings.php:119 includes/general-settings.php:134 140 msgid "Replace price view with recalculated" 141 msgstr "" 142 143 #: includes/general-settings.php:125 144 msgid "Single product page behavior" 145 msgstr "" 146 147 #: includes/general-settings.php:126 148 msgid "Behaviour of recalculated price on single product page" 149 msgstr "" 150 151 #: includes/general-settings.php:140 152 msgid "Cart page behavior" 153 msgstr "" 154 155 #: includes/general-settings.php:141 156 msgid "Behaviour of recalculated price on cart page. Always displayed as new row." 164 msgid "Show recalculated price always" 157 165 msgstr "" 158 166 159 167 #: includes/general-settings.php:148 160 msgid "Show recalculated price always"168 msgid "Show if displayed on Single product page" 161 169 msgstr "" 162 170 163 171 #: includes/general-settings.php:149 164 msgid "Show if displayed on Single product page"165 msgstr ""166 167 #: includes/general-settings.php:150168 172 msgid "Show if displayed on Shop page" 169 173 msgstr "" 170 174 175 #: includes/general-settings.php:156 176 msgid "Cart - Sale products - show regular price" 177 msgstr "" 178 171 179 #: includes/general-settings.php:157 172 msgid "Cart - Sale products - show regular price"173 msgstr ""174 175 #: includes/general-settings.php:158176 180 msgid "Show recalculated regular price in Cart. Up to version 2.0.7 it was displayed by default, but WooCommerce stopped displaying regular price, so do we." 177 181 msgstr "" 178 182 183 #: includes/general-settings.php:164 184 msgid "Recalculated price additional text" 185 msgstr "" 186 179 187 #: includes/general-settings.php:165 180 msgid "Recalculated price additional text"181 msgstr ""182 183 #: includes/general-settings.php:166184 188 msgid "Will be shown immediatelly after recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-suffix." 185 189 msgstr "" 186 190 191 #: includes/general-settings.php:175 192 msgid "Prepostion for weight unit when using automatic text" 193 msgstr "" 194 187 195 #: includes/general-settings.php:176 188 msgid "Prepostion for weight unit when using automatic text"189 msgstr ""190 191 #: includes/general-settings.php:177192 196 msgid "Automatic text will create text like this '$10/kg' with this option you can replace '/' sign with what you want." 193 197 msgstr "" 194 198 195 #: includes/general-settings.php:17 7 includes/general-settings.php:179199 #: includes/general-settings.php:176 includes/general-settings.php:178 196 200 msgid "To add space replace it with \"%\" sign." 197 201 msgstr "" 198 202 199 #: includes/general-settings.php:17 9203 #: includes/general-settings.php:178 200 204 msgid "Example \"/\" or \"per%\"." 201 205 msgstr "" 202 206 207 #: includes/general-settings.php:183 208 msgid "Predefined additional text values" 209 msgstr "" 210 203 211 #: includes/general-settings.php:184 204 msgid "Predefined additional text values"205 msgstr ""206 207 #: includes/general-settings.php:185208 212 msgid "Set of additional texts from which you will be able to choose on product page. Multiple values can be separated with '|' sign." 209 213 msgstr "" 210 214 215 #: includes/general-settings.php:190 216 msgid "Separate text from price with space" 217 msgstr "" 218 211 219 #: includes/general-settings.php:191 212 msgid "Separate text from price with space"213 msgstr ""214 215 #: includes/general-settings.php:192216 220 msgid "The additional text is normally separated from the recalculated price with unbreakable space. If you don't want it uncheck this option." 217 221 msgstr "" 218 222 223 #: includes/general-settings.php:198 224 msgid "Recalculated price prefix text" 225 msgstr "" 226 219 227 #: includes/general-settings.php:199 220 msgid "Recalculated price prefix text"221 msgstr ""222 223 #: includes/general-settings.php:200224 228 msgid "Will be shown before the recalculated prices. Can be overriden in product editor. Will be shown ONLY when recalculation takes place. You can modify it's appearance through CSS class mcmp-recalc-price-prefix." 225 229 msgstr "" 226 230 227 #: includes/general-settings.php:20 2231 #: includes/general-settings.php:201 228 232 msgid "Example \"Price per kilogram:\"" 229 233 msgstr "" 230 234 235 #: includes/general-settings.php:206 236 msgid "Disable price rounding" 237 msgstr "" 238 231 239 #: includes/general-settings.php:207 232 msgid "Disable price rounding"233 msgstr ""234 235 #: includes/general-settings.php:208236 240 msgid "Normally WooCommerce rounds displayed prices - if you want recalculated prices trimmed instead check this field." 237 241 msgstr "" 238 242 239 #: includes/general-settings.php:21 6243 #: includes/general-settings.php:218 240 244 msgid "Maintenance" 241 245 msgstr "" 242 246 243 #: includes/general-settings.php:21 7247 #: includes/general-settings.php:219 244 248 msgid "These settings are related just to the plugin itself." 245 249 msgstr "" 246 250 247 #: includes/general-settings.php:22 2251 #: includes/general-settings.php:224 248 252 msgid "Delete settings on uninstall" 249 253 msgstr "" 250 254 251 #: includes/general-settings.php:22 3255 #: includes/general-settings.php:225 252 256 msgid "With this setting you will delete all plugin settings on uninstallation." 253 257 msgstr "" 254 258 255 259 #: includes/product-settings.php:15 260 msgid "Default - according to general settings" 261 msgstr "" 262 263 #: includes/product-settings.php:16 264 msgid "Do not recalculate" 265 msgstr "" 266 267 #: includes/product-settings.php:22 256 268 msgid "Warning: This product has no weight set. The price per unit will not be shown unless the weight is set on Shipping tab. Please check it." 257 269 msgstr "" 258 270 259 #: includes/product-settings.php:18 271 #: includes/product-settings.php:25 272 msgid "Local overrides for price recalculation" 273 msgstr "" 274 275 #: includes/product-settings.php:26 276 msgid "These settings will affect only this product despite global settings." 277 msgstr "" 278 279 #: includes/product-settings.php:27 280 msgid "Global settings can be found at " 281 msgstr "" 282 283 #: includes/product-settings.php:29 284 msgid "<i>WooCommerce -> Settings -> Products -> Price Per Unit</i>" 285 msgstr "" 286 287 #: includes/product-settings.php:54 260 288 msgid "Settings for Price per unit plug-in" 261 289 msgstr "" 262 290 263 #: includes/product-settings.php: 20264 msgid "In PRO version you will find here settings for individual products"265 msgstr "" 266 267 #: includes/product-settings.php: 21291 #: includes/product-settings.php:56 292 msgid "In PRO version you will find here more settings for individual products" 293 msgstr "" 294 295 #: includes/product-settings.php:57 268 296 msgid "You can buy the plug-in here " 269 297 msgstr "" 270 298 271 #: includes/product-settings.php: 23299 #: includes/product-settings.php:59 272 300 msgid "Price per Unit PRO" 273 301 msgstr "" 274 302 275 #: includes/product-settings.php:26 276 msgid "Features you will find here:" 277 msgstr "" 278 279 #: includes/product-settings.php:27 280 msgid "- Change of display for product page" 281 msgstr "" 282 283 #: includes/product-settings.php:28 284 msgid "- Change of display for shop page" 285 msgstr "" 286 287 #: includes/product-settings.php:29 288 msgid "- Individual text for recalculated price" 289 msgstr "" 290 291 #: includes/product-settings.php:30 292 msgid "- Option to display price for different weight unit (kg,g,lbs,oz) from shop default. Example: shop in kg and some products in grams" 293 msgstr "" 294 295 #: includes/product-settings.php:31 296 msgid "- Option for entering weight, different from shipping weight. Example: use shipping weight as gross and recalculate per net weight." 297 msgstr "" 298 299 #: includes/product-settings.php:32 300 msgid "- Option for displaying recalculation for different number of units. Example: You can display price per 5kg" 301 msgstr "" 302 303 #: includes/product-settings.php:36 304 msgid "New plug-in available - Sell by Weight PRO" 305 msgstr "" 306 307 #: includes/product-settings.php:38 308 msgid "This plug-in allows you to sell easily products, where you want to have several weight option to sell at the same price for kilogram." 309 msgstr "" 310 311 #: includes/product-settings.php:39 312 msgid "It works in a similar way as Variable products, but it is easier to manage because you will enter the price only once and the options price is calculated automatically." 313 msgstr "" 314 315 #: includes/product-settings.php:40 303 #: includes/product-settings.php:63 304 msgid "PRO Version features:" 305 msgstr "" 306 307 #: includes/product-settings.php:65 308 msgid "- New feature - Quick Editor settings: Easily adjust Price Per Unit (PPU) settings on the fly." 309 msgstr "" 310 311 #: includes/product-settings.php:66 312 msgid "- New feature - Bulk Editor settings: Save time by editing PPU settings in bulk." 313 msgstr "" 314 315 #: includes/product-settings.php:67 316 msgid "- Enhanced display options: Customize how prices appear on product pages." 317 msgstr "" 318 319 #: includes/product-settings.php:68 320 msgid "- Shop Page display options: More ways to showcase prices on your shop page." 321 msgstr "" 322 323 #: includes/product-settings.php:69 324 msgid "- Custom text for recalculated prices: Tailor the recalculated price display text." 325 msgstr "" 326 327 #: includes/product-settings.php:70 328 msgid "- Flexible weight unit display: Show prices for different units (kg, g, lbs, oz) from your shop default unit. Example: shop in kg and some products in grams." 329 msgstr "" 330 331 #: includes/product-settings.php:71 332 msgid "- Alternative Weight Entry: Differentiate between shipping weight and net weight for accurate pricing. Example: use shipping weight as gross and recalculate per net weight." 333 msgstr "" 334 335 #: includes/product-settings.php:72 336 msgid "- Multiple unit Recalculation: Display prices per different quantities (e.g., price per 5kg)." 337 msgstr "" 338 339 #: includes/product-settings.php:73 340 msgid "- Possibility to save prices in database for later use." 341 msgstr "" 342 343 #: includes/product-settings.php:74 344 msgid "- WPML Compatible: Seamless integration with WPML for multilingual support." 345 msgstr "" 346 347 #: includes/product-settings.php:78 348 msgid "Another Must-Have Plugin: Sell by Weight PRO" 349 msgstr "" 350 351 #: includes/product-settings.php:80 352 msgid "Simplify product pricing with Sell by Weight PRO!" 353 msgstr "" 354 355 #: includes/product-settings.php:81 356 msgid "Easily sell products at a constant price per kilogram with multiple weight options." 357 msgstr "" 358 359 #: includes/product-settings.php:82 360 msgid "Enter the unit price once and let the plugin calculate options prices based on their weight." 361 msgstr "" 362 363 #: includes/product-settings.php:83 364 msgid "It works similarly as Variable products, but it is easier to manage." 365 msgstr "" 366 367 #: includes/product-settings.php:84 368 msgid "The plugin is compatible with all WooCommerce weight units and works with the one you've chosen." 369 msgstr "" 370 371 #: includes/product-settings.php:85 includes/product-settings.php:97 316 372 msgid "More information can be found here " 317 373 msgstr "" 318 374 319 #: includes/product-settings.php: 42375 #: includes/product-settings.php:87 320 376 msgid "Sell by Weight PRO" 321 377 msgstr "" 322 378 323 #: includes/product-settings.php:45 324 msgid "Note for old version users:" 325 msgstr "" 326 327 #: includes/product-settings.php:46 328 msgid "All your settings from this page are still in database, if you upgrade to PRO version it will be available again." 329 msgstr "" 330 331 #: includes/product-settings.php:47 332 msgid "If you are not interested in buying PRO version and still want to use the old features, please downgrade to free version 1.9.3." 333 msgstr "" 334 335 #: includes/product-settings.php:49 336 msgid "Download here." 337 msgstr "" 338 339 #: woo-price-per-unit.php:119 woo-price-per-unit.php:359 379 #: includes/product-settings.php:91 380 msgid "New plug-in available - Unit Based Stock PRO" 381 msgstr "" 382 383 #: includes/product-settings.php:93 384 msgid "Manage your stock in Weight units!" 385 msgstr "" 386 387 #: includes/product-settings.php:94 388 msgid "Handle inventory in weight units - a capability unprecedented in WooCommerce, which traditionally manages stock solely based on purchased quantity." 389 msgstr "" 390 391 #: includes/product-settings.php:95 392 msgid "Override the product weight with custom stock value. This value will be used for inventory deduction." 393 msgstr "" 394 395 #: includes/product-settings.php:96 396 msgid "Supports decimal values for stock inventory as well." 397 msgstr "" 398 399 #: includes/product-settings.php:99 400 msgid "Unit Based Stock PRO" 401 msgstr "" 402 403 #: woo-price-per-unit.php:274 404 msgid "Price per unit plugin - PRO version is active. Please deactivate it first." 405 msgstr "" 406 407 #: woo-price-per-unit.php:320 408 msgid "Plugin NOT activated: " 409 msgstr "" 410 411 #: woo-price-per-unit.php:386 412 msgid "Settings" 413 msgstr "" 414 415 #: woo-price-per-unit.php:400 340 416 msgid "Price Per Unit" 341 417 msgstr "" 342 418 343 #: woo-price-per-unit.php:120 344 msgid " - there was a change in the process of displaying." 345 msgstr "" 346 347 #: woo-price-per-unit.php:240 348 msgid "Price per unit plugin - PRO version is active. Please deactivate it first." 349 msgstr "" 350 351 #: woo-price-per-unit.php:278 352 msgid "Plugin NOT activated: " 353 msgstr "" 354 355 #: woo-price-per-unit.php:346 356 msgid "Settings" 357 msgstr "" 358 359 #: woo-price-per-unit.php:383 419 #: woo-price-per-unit.php:436 360 420 msgid "Price Per Unit - free version" 361 421 msgstr "" 362 422 363 #: woo-price-per-unit.php: 543423 #: woo-price-per-unit.php:609 364 424 msgctxt "weight unit" 365 425 msgid "kg" … … 368 428 msgstr[1] "" 369 429 370 #: woo-price-per-unit.php: 546430 #: woo-price-per-unit.php:612 371 431 msgctxt "weight unit" 372 432 msgid "g" … … 375 435 msgstr[1] "" 376 436 377 #: woo-price-per-unit.php: 549437 #: woo-price-per-unit.php:615 378 438 msgctxt "weight unit" 379 439 msgid "oz" … … 382 442 msgstr[1] "" 383 443 384 #: woo-price-per-unit.php: 552444 #: woo-price-per-unit.php:618 385 445 msgctxt "weight unit" 386 446 msgid "lb" … … 388 448 msgstr[0] "" 389 449 msgstr[1] "" 450 451 #: woo-price-per-unit.php:974 452 #, php-format 453 msgid "Price per Unit requires WooCommerce to be installed and active. You can download %s here." 454 msgstr "" -
woo-price-per-unit/trunk/readme.txt
r2670562 r3090318 2 2 Contributors: mechuram 3 3 Tags: woocommerce, price, weight, price customization 4 Stable tag: 2. 0.94 Stable tag: 2.2.4 5 5 Requires PHP: 7.0 6 Tested up to: 5.9.06 Tested up to: 6.5.3 7 7 Requires at least: 4.4 8 8 … … 12 12 IMPORTANT NOTICE: With this version of free plug-in come a different approach to free version. Single product settings were removed. This is because the development of free version and PRO version was unified to simplify the parallel development for me. This also means more regular updates in free version. 13 13 If you want to use the Single product settings please buy PRO version or DO NOT update the plug-in anymore. 14 == New plug-in Sell by Weight PRO available==14 == Another Must-Have Plugin: Sell by Weight PRO == 15 15 16 16 This plug-in allows you to sell easily products, where you want to have several weight option to sell at the same price for kilogram. … … 18 18 19 19 More info here - [Sell by Weight PRO](https://mechcomp.cz/sell-by-weight-pro/) 20 21 == New plug-in available - Unit Based Stock PRO == 22 23 Manage your stock in Weight units! 24 25 Handle inventory in weight units - a capability unprecedented in WooCommerce, which traditionally manages stock solely based on purchased quantity. 26 Supports decimal values for stock inventory as well. 27 28 More info here - [Unit Based Stock PRO](https://mechcomp.cz/unit-based-stock-pro/) 20 29 21 30 == PRO version available == … … 78 87 It is located in product editor - tab Price Per Unit 79 88 80 **Changelog** 81 82 **2.0.9** 83 - Improvement - Warning displayed when no weight is set 84 - Compatibility with WooCommerce 6.1.1 85 - Compatibility with Wordpress 5.9.0 86 87 **2.0.8** 88 - Bug-fix - Do not display additional text on empty price 89 - Bug-fix - Division by zero in some rare circumstances 90 - Scripts updated 91 - RTL languages improvement 92 - WPML configuration created 93 - Compatibility with WooCommerce 5.6.0 94 - Compatibility with Wordpress 5.8.1 95 96 **2.0.7** 97 - Backward compatibility for recent bug-fix 98 99 **2.0.6** 100 - Bug-fix - In certain configurations price with taxes was displayed improperly in Cart 101 102 **2.0.5** 103 - Bug-fix - Improper price display with taxes 104 105 **2.0.4** 106 - Bug-fix - "Variations - prefix for variable price" not visible for replaced row 107 108 **2.0.3** 109 - New free version - due to huge changes in code(security hardening) the free version is created from scratch 110 - For sake of easier parallel development of free and PRO version there is a change in free version approach 111 - Removal - Single product settings removed 112 - Paid feature released for free - display of recalculated price in Cart 113 - New feature - automatic recalculation text 114 115 **2.0.1** 116 - Fixed info messages in admin for WooCommerce 4.0.1 117 118 **2.0.0** 119 - Added option to trim recalculated prices instead of rounding 120 - Added recalculated price prefix 121 - Security hardening - complete revision of the code to comply with latest wordpress security recommendations 122 123 **1.9.7** 124 - Code revision and rewrite 125 126 **1.9.5** 127 - Bug-fix - recalculated price was displayed on products with zero price 128 129 **1.9.4** 130 - New feature/bug-fix - displaying recalculate price on cart was influenced by Shop page price behaviour - now it has option by itself 131 The settings "Show if displayed on Shop page" and "Show if displayed on Single product page" take respective override from product settings 132 Default setting is to show always 133 134 **1.9.3** 135 - New feature - Automatic recalculation text - it takes the weight unit from your shop settings and creates the text from it (example: /kg). Works together with other setting of this plug-in so it can create text for Different weight unit and also Custom number of units. 136 - Added option to control the appearance of the price text 137 - Added warning for no weight set(many people is asking why they don't see the recalculated price) 138 139 **1.9.2** 140 - Dropped support for WooCommerce pre 3.0 141 142 **1.9.1** 143 - Bug-fix - Settings automatically deleted on uninstall - now there is a setting in general options to delete on uninstall - caused troubles during manual update or upgrade to Pro version. 144 145 **1.9** 146 - New approach to entering additional text - predefined values 147 148 **1.8.1** 149 - Bug-fix - "General price additional text" - not showing properly on recalculation 150 151 **1.8** 152 - Compatibility with WordPress 5.1 153 154 **1.7** 155 - Added Custom recalculation ratio for variations 156 - Option to show recalc on variation selector even if the recalc is off 157 158 **1.6** 159 - Added Custom recalculation ratio 160 - Recalculated price can be shown also on variation selection 161 - Translation fix 162 - Core rewrite 163 164 **1.5** 165 - Plug-in is set to display recalculation for all products by default after installation. Doesn't affect current installations. 166 - Fixed compatibility with WooCommerce POS 167 168 **1.4** 169 - Fixed bug of improperly displayed price with TAX 170 171 **1.3** 172 - Added CSS class for whole new row. The class name is mcmp_recalc_price_row. 173 - Added option for predefined styling of new row (off by default). New row will be in different size and italics. 174 175 **1.2** 176 - Improved handling of variable products. Now it works properly even with different weight on variations. 177 - Added CSS classes for modification of additional texts appearance. Classes can be found in general settings help texts. 178 179 **1.1** 180 - Changed behaviour on variable products to conform with WooCommerce 3.x 181 - Don't show sale price on variable products 182 183 **1.0** 184 - Initial Release 185 89 90 186 91 == Installation == 187 92 … … 220 125 == Changelog == 221 126 127 = 2.2.4 = 128 - New feature - Options on product detail to disable recalculation 129 - Improvement - Variable products performance optimization 130 - Bug-fix - small bugfixes 131 - Improvement - HPOS compatibility 132 - Improvement - Code refactoring 133 - Compatibility with WooCommerce 8.8.3 134 - Compatibility with WordPress 6.5.3 135 222 136 = 2.0.9 = 223 137 - Improvement - Warning displayed when no weight is set 224 138 - Compatibility with WooCommerce 6.1.1 225 - Compatibility with Word press 5.9.0139 - Compatibility with WordPress 5.9.0 226 140 227 141 = 2.0.8 = … … 232 146 - WPML configuration created 233 147 - Compatibility with WooCommerce 5.6.0 234 - Compatibility with Word press 5.8.1148 - Compatibility with WordPress 5.8.1 235 149 236 150 = 2.0.7 = … … 238 152 239 153 = 2.0.6 = 240 - Bug-fix - In certain configurations price 154 - Bug-fix - In certain configurations price with taxes was displayed improperly in Cart 241 155 242 156 = 2.0.5 = … … 325 239 == Upgrade Notice == 326 240 241 = 2.2.4 = 242 - New feature - Options on product detail to disable recalculation 243 - Improvement - Variable products performance optimization 244 - Bug-fix - small bugfixes 245 - Improvement - HPOS compatibility 246 - Improvement - Code refactoring 247 - Compatibility with WooCommerce 8.8.3 248 - Compatibility with WordPress 6.5.3 249 327 250 = 2.0.9 = 328 251 - Improvement - Warning displayed when no weight is set 329 252 - Compatibility with WooCommerce 6.1.1 330 - Compatibility with Wordpress 5.9.0 331 332 = 2.0.8 = 333 - Bug-fix - Do not display additional text on empty price 334 - Bug-fix - Division by zero in some rare circumstances 335 - Scripts updated 336 - RTL languages improvement 337 - WPML configuration created 338 - Compatibility with WooCommerce 5.6.0 339 - Compatibility with Wordpress 5.8.1 340 341 = 2.0.7 = 342 - Backward compatibility for recent bug-fix 343 344 = 2.0.6 = 345 - Bug-fix - In certain configurations price with taxes was displayed improperly in Cart 346 347 = 2.0.5 = 348 - Bug-fix - Improper price display with taxes 349 350 = 2.0.4 = 351 - Bug-fix - "Variations - prefix for variable price" not visible for replaced row 253 - Compatibility with WordPress 5.9.0 -
woo-price-per-unit/trunk/uninstall.php
r2599970 r3090318 3 3 * Delete WooCommerce Unit Of Measure data if plugin is deleted. 4 4 * 5 * @package PricePerUnit 5 6 * @since 1.0 6 7 */ 8 7 9 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) : 8 10 exit; 9 11 endif; 10 if (get_option('_mcmp_ppu_delete_meta')=='yes'){12 if ( get_option( '_mcmp_ppu_delete_meta' ) == 'yes' ) { 11 13 delete_post_meta_by_key( '_mcmp_ppu_general_override' ); 12 14 delete_post_meta_by_key( '_mcmp_ppu_single_page_override' ); 13 15 delete_post_meta_by_key( '_mcmp_ppu_recalc_text_override' ); 14 delete_post_meta_by_key( '_mcmp_ppu_additional_text_override');16 delete_post_meta_by_key( '_mcmp_ppu_additional_text_override' ); 15 17 delete_post_meta_by_key( '_mcmp_ppu_ratio_unit_override' ); 16 delete_post_meta_by_key( '_mcmp_ppu_recalc_per_units_override' );17 18 delete_post_meta_by_key( '_mcmp_ppu_cust_num_of_units_override' ); 18 19 delete_post_meta_by_key( '_mcmp_ppu_var_prefix_text_override' ); 19 delete_option('mcmp_ppu_licence_key'); 20 delete_option('_mcmp_ppu_additional_text'); 21 delete_option('_mcmp_ppu_hide_sale_price'); 22 delete_option('_mcmp_ppu_var_prefix_text'); 23 delete_option('_mcmp_ppu_var_hide_max_price'); 24 delete_option('_mcmp_ppu_var_show_sale_price'); 25 delete_option('_mcmp_ppu_var_display_option_recalc'); 26 delete_option('_mcmp_ppu_var_display_option_recalc_forced'); 27 delete_option('_mcmp_ppu_add_row_css'); 28 delete_option('_mcmp_ppu_general'); 29 delete_option('_mcmp_ppu_single_page'); 30 delete_option('_mcmp_ppu_cart_page'); 31 delete_option('_mcmp_ppu_cart_show_sale_price'); 32 delete_option('_mcmp_ppu_recalc_text'); 33 delete_option('_mcmp_ppu_recalc_text_options'); 34 delete_option('_mcmp_ppu_recalc_per_units'); 35 delete_option('_mcmp_ppu_delete_meta'); 36 delete_option('_mcmp_ppu_recalc_text_automatic_preposition'); 37 delete_option('_mcmp_ppu_recalc_text_separate'); 38 delete_option('_mcmp_ppu_disable_price_rounding'); 39 delete_option('_mcmp_ppu_var_prefix_text'); 20 // Meta not used in free version anymore. 21 delete_post_meta_by_key( '_mcmp_ppu_recalc_per_units_override' ); 22 delete_option( '_mcmp_ppu_additional_text' ); 23 delete_option( '_mcmp_ppu_hide_sale_price' ); 24 delete_option( '_mcmp_ppu_var_prefix_text' ); 25 delete_option( '_mcmp_ppu_var_hide_max_price' ); 26 delete_option( '_mcmp_ppu_var_show_sale_price' ); 27 delete_option( '_mcmp_ppu_add_row_css' ); 28 delete_option( '_mcmp_ppu_general' ); 29 delete_option( '_mcmp_ppu_single_page' ); 30 delete_option( '_mcmp_ppu_cart_page' ); 31 delete_option( '_mcmp_ppu_cart_show_sale_price' ); 32 delete_option( '_mcmp_ppu_recalc_text' ); 33 delete_option( '_mcmp_ppu_recalc_text_automatic_preposition' ); 34 delete_option( '_mcmp_ppu_recalc_text_options' ); 35 delete_option( '_mcmp_ppu_recalc_text_separate' ); 36 delete_option( '_mcmp_ppu_recalc_text_prefix' ); 37 delete_option( '_mcmp_ppu_disable_price_rounding' ); 38 delete_option( '_mcmp_ppu_delete_meta' ); 39 // Options not used in free version anymore. 40 delete_option( '_mcmp_ppu_recalc_per_units' ); 41 delete_option( '_mcmp_ppu_var_display_option_recalc' ); 42 delete_option( '_mcmp_ppu_var_display_option_recalc_forced' ); 40 43 } -
woo-price-per-unit/trunk/woo-price-per-unit.php
r2670562 r3090318 1 1 <?php 2 /* 3 Plugin Name: WooCommerce Price Per Unit 4 Plugin URI: https://mechcomp.cz/price-per-unit-pro/ 5 Description: WooCommerce Price Per Unit allows the user to show prices recalculated per units(weight) and do some customization to the look of the prices 6 Version: 2.0.9 7 Author: Martin Mechura 8 Author URI: http://mechcomp.cz 9 Text Domain: woo-price-per-unit 10 WC tested up to: 6.1.1 11 WC requires at least: 3.0 12 13 @author Martin Mechura 14 @category Admin 15 16 WooCommerce Price Per Unit. A Plugin that works with the WooCommerce plugin for WordPress. 17 Copyright (C) 2017 Martin Mechura 18 19 This program is free software: you can redistribute it and/or modify 20 it under the terms of the GNU General Public License as published by 21 the Free Software Foundation, either version 3 of the License, or 22 (at your option) any later version. 23 24 This program is distributed in the hope that it will be useful, 25 but WITHOUT ANY WARRANTY; without even the implied warranty of 26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 GNU General Public License for more details. 28 29 You should have received a copy of the GNU General Public License 30 along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.html. 2 /** 3 * Plugin Name: WooCommerce Price Per Unit 4 * Plugin URI: https://mechcomp.cz/price-per-unit-pro/ 5 * Description: WooCommerce Price Per Unit allows the user to show prices recalculated per units(weight) and do some customization to the look of the prices 6 * Version: 2.2.4 7 * Author: Martin Mechura 8 * Author URI: http://mechcomp.cz 9 * Text Domain: woo-price-per-unit 10 * WC tested up to: 8.8.3 11 * WC requires at least: 3.0 12 * 13 * @package PricePerUnit 14 * 15 * WooCommerce Price Per Unit. A Plugin that works with the WooCommerce plugin for WordPress. 16 * Copyright (C) 2017 Martin Mechura 17 * 18 * This program is free software: you can redistribute it and/or modify 19 * it under the terms of the GNU General Public License as published by 20 * the Free Software Foundation, either version 3 of the License, or 21 * (at your option) any later version. 22 * 23 * This program is distributed in the hope that it will be useful, 24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 * GNU General Public License for more details. 27 * 28 * You should have received a copy of the GNU General Public License 29 * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.html. 31 30 */ 32 if (!defined('ABSPATH')): 33 exit; // Exit if accessed directly 31 32 if ( ! defined( 'ABSPATH' ) ) : 33 exit; // Exit if accessed directly. 34 34 endif; 35 define('MCMP_PPU_FREE_PLUGIN_VERSION','2.0.8'); 36 class mcmp_PPU 37 { 38 private static $instance = null; 39 private $single_pr_id = 0; 40 public $woo_version = ''; 41 public $dependency = null; 42 public static function get_instance() 43 { 44 if (null == self::$instance) { 45 self::$instance = new self; 46 } 47 return self::$instance; 48 } 49 /** 50 * The Constructor! 51 * @since 1.0 52 */ 53 public function __construct() 54 { 55 global $woocommerce; 56 add_action( 'admin_init', array( $this, 'admin_activation_check' ) ); 57 if($this->dependency_checks()!==true){ 58 return; 59 } 60 //Loading translation 61 add_action('init', array($this, 'plugin_init')); 62 //Action on plugin activation 63 register_activation_hook(__FILE__, array($this, 'plugin_activated')); 64 //Database upgrades. 35 define( 'MCMP_PPU_FREE_PLUGIN_VERSION', '2.2.4' ); 36 define( 'MCMP_PPU_FREE_PLUGIN_FILE', __FILE__ ); 37 define( 'MCMP_PPU_FREE_PLUGIN_DIR', plugin_dir_path( MCMP_PPU_FREE_PLUGIN_FILE ) ); 38 39 /** 40 * MCMP PPU Pro Class 41 */ 42 class MCMP_PPU { 43 44 /** 45 * Instance of the class 46 * 47 * @var mixed 48 */ 49 private static $instance = null; 50 51 /** 52 * Product ID for single page 53 * 54 * @var integer 55 */ 56 private $single_pr_id = 0; 57 58 /** 59 * WooCommerce version 60 * 61 * @var string 62 */ 63 public $woo_version = ''; 64 65 /** 66 * Dependent on 67 * 68 * @var mixed dependency 69 */ 70 public $dependency = null; 71 72 /** 73 * Default hook priority 74 * 75 * @var integer 76 */ 77 public $hook_priority = 1010; 78 79 /** 80 * Returns Class instance 81 * 82 * @return object 83 */ 84 public static function get_instance() { 85 if ( null == self::$instance ) { 86 self::$instance = new self(); 87 } 88 return self::$instance; 89 } 90 91 /** 92 * The Constructor! 93 * 94 * @since 1.0 95 */ 96 public function __construct() { 97 add_action( 'admin_init', array( $this, 'admin_activation_check' ) ); 98 if ( $this->dependency_checks() !== true ) { 99 return; 100 } 101 // Loading translation. 102 add_action( 'init', array( $this, 'plugin_init' ) ); 103 // Action on plugin activation. 104 register_activation_hook( MCMP_PPU_FREE_PLUGIN_FILE, array( $this, 'plugin_activated' ) ); 105 // Claim Woo HPOS compatibility. 106 add_action( 'before_woocommerce_init', array( $this, 'declare_hpos_compatibility' ) ); 107 // Database upgrades. 65 108 add_action( 'current_screen', array( $this, 'perform_db_upgrade' ) ); 66 //After upgrade action 67 add_action( 'upgrader_process_complete', array($this,'upgrade_completed'), 10, 2 ); 68 //add_action( 'admin_notices', array($this,'ppu_plugin_update_notice')); 69 //Loading stylesheet 70 add_action('wp_enqueue_scripts', array($this, 'load_style')); 71 add_action('admin_enqueue_scripts', array($this, 'load_admin_style')); 72 add_filter('woocommerce_get_sections_products', array($this, 'add_general_options_section')); 73 add_filter('woocommerce_get_settings_products', array($this, 'general_options'), 10, 2); 74 75 // Render the ppu field output on the frontend 76 add_filter('woocommerce_get_price_html', array($this, 'custom_price'), 10, 2); 77 add_filter('woocommerce_cart_item_price', array($this, 'custom_cart_price'), 10, 3); 78 //Adding single product options tab 79 add_filter('woocommerce_product_data_tabs', array($this, 'add_custom_product_options_tab'), 99, 1); 80 //Adding single product options 81 add_action('woocommerce_product_data_panels', array($this, 'product_options')); 82 //helper for getting single product ID 83 add_action('woocommerce_before_single_product', array($this, 'get_single_id')); 84 85 //Extending plugin actions 86 add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); 87 } 88 89 /** 90 * This function runs when WordPress completes its upgrade process 91 * It iterates through each plugin updated to see if ours is included 92 * @param $upgrader_object Array 93 * @param $options Array 94 * @since 2.0.2 95 */ 96 public function upgrade_completed( $upgrader_object, $options ) { 97 // The path to our plugin's main file 98 $ppu_plugin = plugin_basename( __FILE__ ); 99 // If an update has taken place and the updated type is plugins and the plugins element exists 100 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) { 101 // Iterate through the plugins being updated and check if ours is there 102 foreach( $options['plugins'] as $plugin ) { 103 if( $plugin == $ppu_plugin ) { 104 // Set a transient to record that our plugin has just been updated 105 set_transient( 'ppu_plugin_updated', 1 ); 106 } 107 } 108 } 109 } 110 111 /** 112 * Show a notice to anyone who has just updated this plugin 113 * This notice shouldn't display to anyone who has just installed the plugin for the first time 114 * @since 2.0.2 115 */ 116 public function ppu_plugin_update_notice() { 117 // Check the transient to see if we've just updated the plugin 118 if( get_transient( 'ppu_plugin_updated' ) ) { 119 echo '<div class="notice notice-warning is-dismissible"><p>'. esc_html__( 'Price Per Unit', 'woo-price-per-unit'); 120 echo esc_html__( ' - there was a change in the process of displaying.', 'woo-price-per-unit') . '</p>'; 121 echo '<p>'. esc_html__( 'It is no loger possible to change behaviour on single product - please check your product settings to get more info.', 'woo-price-per-unit') .'</p></div>'; 122 delete_transient( 'ppu_plugin_updated' ); 123 } 124 } 125 126 /** 127 * Checks woocommerce version and remembers for later purpose 128 * @param string $compare_version Version to check against, default is 3.0 129 * @return boolean is the WooCommerce version greater than $compare_version 130 * @since 1.5 131 */ 132 public function check_woo_version($compare_version = '3.0',$compare_operator = '>=') 133 { 134 $version = $this->woo_version; 135 if (empty($version)) { 136 $version=get_option( 'woocommerce_version' ); 137 $this->woo_version = $version; 138 } 139 if (version_compare($version, $compare_version, $compare_operator)) { 140 return true; 141 } 142 return false; 143 } 144 145 /** 146 * Displays admin notice - when in WooCommerce 4 it handles the display through transients and function "display_stored_messages" 147 * @param string $message Message to output 148 * @param string $type Type of the message 149 * @param string $transient Name of transient to store the message 150 * @since 1.8 151 */ 152 public function mcmp_add_message($message, $type, $transient = '') 153 { 154 if(empty($message) or !is_string($message)){ 155 return; 156 } 157 $class='notice is-dismissible '; 158 switch ($type) { 159 case 'success': 160 case 'warning': 161 case 'error': 162 case 'info': 163 $class.='notice-'.$type; 164 break; 165 default: 166 $class.='notice-info'; 167 break; 168 } 169 $output = '<div class="' . $class . '"><p>' . wp_kses_post($message) . '</p></div>'; 170 if (!empty($transient)){ 171 $notice_num = 0; 172 $trans_num = $transient . $notice_num; 173 while (get_transient($trans_num)!=false){ 174 $trans_num = $transient . ++$notice_num; 175 } 176 set_transient( $trans_num, $output, 60 ); 177 }else{ 178 echo $output; 179 } 180 } 181 182 /** 183 * Displays message stored in transient 184 * @param string $message Message to output 185 * @param string $type Type of the message 186 * @since 2.0.1 187 */ 188 public function display_stored_messages($transient = 'ppu-notice') 189 { 190 $notice_num = 0; 191 $trans_num = $transient . $notice_num; 192 $message = get_transient($trans_num); 193 while ($message!=false){ 194 delete_transient($trans_num); 195 echo $message; 196 $trans_num = $transient . ++$notice_num; 197 $message = get_transient($trans_num); 198 } 199 } 200 201 /** 202 * Truncates number to $precision decimal points 203 * @param float $number Number to truncate 204 * @param float $precision Number of digits after decimal point 205 * @return float trimmed number 206 * @since 1.9.5 207 */ 208 public function truncate_number($number, $precision = 0) 209 { 210 if(function_exists('bcadd')){ 211 return floatval(bcadd($number, 0, $precision)); 212 }else{ 213 return floatval(preg_replace('/\.(\d{'.intval($precision).'}).*/', '.$1', $number)); 214 } 215 } 216 217 /** 218 * Load plugin's textdomain 219 * @since 1.0 220 */ 221 public function plugin_init() 222 { 223 $this->legacy_options_fix(); 224 load_plugin_textdomain('woo-price-per-unit', false, dirname(plugin_basename(__FILE__)) . '/languages/'); 225 } 226 227 /** 228 * Checks if requirements for activation are met 229 * Now it tests if free version is active 230 * @return mixed String with error message or true when dependecy checks are allright 231 * @since 1.9 232 */ 233 public function dependency_checks() 234 { 235 if (!is_null($this->dependency)){ 236 return $this->dependency; 237 } 238 if ( in_array( 'woo-price-per-unit-pro/woo-price-per-unit.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) 239 || (is_multisite() && array_key_exists( 'woo-price-per-unit-pro/woo-price-per-unit.php', apply_filters( 'active_plugins', get_site_option( 'active_sitewide_plugins' ) ) ) ) ) { 240 $this->dependency = esc_html__('Price per unit plugin - PRO version is active. Please deactivate it first.', 'woo-price-per-unit'); 241 return $this->dependency; 242 } 243 $this->dependency = true; 244 return $this->dependency; 245 } 246 247 /** 248 * Prevents activation of the plugin when dependecy checks fail 249 * @since 1.9 250 */ 251 function admin_activation_check() 252 { 253 $dependecy_info=$this->dependency_checks(); 254 if($dependecy_info!==true){ 255 if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { 256 deactivate_plugins( plugin_basename( __FILE__ ) ); 257 $type='error'; 258 //Passing arguments into add_action by using PHP lambda - nice workaround 259 add_action('admin_notices', function() use ( $dependecy_info,$type) { 260 $this->mcmp_add_message($dependecy_info,$type); }); 261 if ( isset( $_GET['activate'] ) ) { 262 unset( $_GET['activate'] ); 263 } 264 } 265 } 266 } 267 268 /** 269 * Action on plugin activation - currently setting defaults 270 * Checks also the conditions for plugin activation - if not it prevents the activation 271 * @since 1.5 272 */ 273 public function plugin_activated() 274 { 275 $dependecy_info=$this->dependency_checks(); 276 if($dependecy_info!==true){ 277 deactivate_plugins( plugin_basename( __FILE__ ) ); 278 wp_die(esc_html__('Plugin NOT activated: ', 'woo-price-per-unit') . $dependecy_info); 279 } 280 include 'includes/general-setting-defaults.php'; 281 } 282 283 /** 284 * Performs upgrade on plugin update 285 * 109 // Loading style-sheet. 110 add_action( 'wp_enqueue_scripts', array( $this, 'load_style' ) ); 111 add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_style' ) ); 112 // Display admin messages. 113 add_action( 'admin_notices', array( $this, 'display_stored_messages' ), 50, 0 ); 114 add_filter( 'woocommerce_get_sections_products', array( $this, 'add_general_options_section' ) ); 115 add_filter( 'woocommerce_get_settings_products', array( $this, 'general_options' ), 10, 2 ); 116 // Loading hooks on frontend. 117 add_action( 'after_setup_theme', array( $this, 'add_frontend_hooks' ), $this->hook_priority ); 118 // Adding single product options tab. 119 add_filter( 'woocommerce_product_data_tabs', array( $this, 'add_custom_product_options_tab' ), 99, 1 ); 120 // Adding single product options. 121 add_action( 'woocommerce_product_data_panels', array( $this, 'product_options' ) ); 122 // Saving single product options. 123 add_action( 'woocommerce_process_product_meta', array( $this, 'save_product_options' ), 30 ); 124 // Extending plugin actions. 125 add_filter( 'plugin_action_links_' . plugin_basename( MCMP_PPU_FREE_PLUGIN_FILE ), array( $this, 'plugin_action_links' ) ); 126 } 127 128 /** 129 * Hooks all frontend code 130 * 131 * @since 2.2.4 132 * @return void 133 */ 134 public function add_frontend_hooks() { 135 /** Front proccessing allowed 136 * 137 * @since 2.2.4 138 */ 139 if ( true == apply_filters( 'mcmp_ppu_process_front_end', true ) ) { 140 // Render the ppu field output on the front-end. 141 add_filter( 'woocommerce_get_price_html', array( $this, 'custom_price' ), $this->hook_priority, 2 ); 142 add_filter( 'woocommerce_cart_item_price', array( $this, 'custom_cart_price' ), $this->hook_priority, 3 ); 143 // helper for getting single product ID. 144 add_action( 'woocommerce_before_single_product', array( $this, 'get_single_id' ) ); 145 } 146 } 147 148 /** 149 * Checks woocommerce version and remembers for later purpose 150 * 151 * @param string $compare_version Version to check against, default is 3.0. 152 * @param string $compare_operator Operator used for comparison.. 153 * @return boolean is the WooCommerce version greater than $compare_version 154 * @since 1.5 155 */ 156 public function check_woo_version( $compare_version = '3.0', $compare_operator = '>=' ) { 157 $version = $this->woo_version; 158 if ( empty( $version ) ) { 159 $version = (string) get_option( 'woocommerce_version' ); 160 $this->woo_version = $version; 161 } 162 /** 163 * Psalm suppression 164 * 165 * @psalm-suppress ArgumentTypeCoercion */ 166 // phpcs:ignore Generic.Commenting.DocComment.MissingShort 167 if ( version_compare( $version, $compare_version, $compare_operator ) ) { 168 return true; 169 } 170 return false; 171 } 172 173 /** 174 * Displays admin notice - when in WooCommerce 4 it handles the display through transients and function "display_stored_messages" 175 * 176 * @param mixed $message Message to output. 177 * @param string $type Type of the message. 178 * @param string $transient Name of transient to store the message. 179 * @return void 180 * @since 1.8 181 * @see display_stored_messages() 182 */ 183 public function mcmp_add_message( $message, $type, $transient = '' ) { 184 if ( empty( $message ) || ! is_string( $message ) ) { 185 return; 186 } 187 $class = 'notice is-dismissible '; 188 switch ( $type ) { 189 case 'success': 190 case 'warning': 191 case 'error': 192 case 'info': 193 $class .= 'notice-' . $type; 194 break; 195 default: 196 $class .= 'notice-info'; 197 break; 198 } 199 $output = '<div class="' . $class . '"><p>' . wp_kses_post( $message ) . '</p></div>'; 200 if ( ! empty( $transient ) ) { 201 $notice_num = 0; 202 $trans_num = $transient . $notice_num; 203 while ( get_transient( $trans_num ) != false ) { 204 $trans_num = $transient . ( ++$notice_num ); 205 } 206 set_transient( $trans_num, $output, 60 ); 207 } else { 208 echo wp_kses_post( $output ); 209 } 210 } 211 212 /** 213 * Displays message stored in transient 214 * 215 * @param string $transient - Name of the transient holding the message. 216 * @return void 217 * @since 2.0.1 218 */ 219 public function display_stored_messages( $transient = 'ppu-free-notice' ) { 220 $notice_num = 0; 221 $trans_num = $transient . $notice_num; 222 $message = get_transient( $trans_num ); 223 while ( false != $message ) { 224 delete_transient( $trans_num ); 225 echo wp_kses_post( $message ); 226 $trans_num = $transient . ( ++$notice_num ); 227 $message = get_transient( $trans_num ); 228 } 229 } 230 231 /** 232 * Truncates number to $precision decimal points 233 * 234 * @param string|float $number Number to truncate. 235 * @param integer $precision Number of digits after decimal point. 236 * @return float trimmed number 237 * @since 1.9.5 238 */ 239 public function truncate_number( $number, $precision = 0 ) { 240 if ( function_exists( 'bcadd' ) ) { 241 /** 242 * Psalm suppression 243 * 244 * @psalm-suppress ArgumentTypeCoercion */ 245 // phpcs:ignore Generic.Commenting.DocComment.MissingShort 246 return floatval( bcadd( strval( $number ), '0', $precision ) ); 247 } else { 248 return floatval( preg_replace( '/\.(\d{' . intval( $precision ) . '}).*/', '.$1', $number ) ); 249 } 250 } 251 252 /** 253 * Load plugin's textdomain 254 * 255 * @since 1.0 256 */ 257 public function plugin_init() { 258 load_plugin_textdomain( 'woo-price-per-unit', false, dirname( plugin_basename( MCMP_PPU_FREE_PLUGIN_FILE ) ) . '/languages/' ); 259 } 260 261 /** 262 * Checks if requirements for activation are met 263 * Now it tests if free version is active 264 * 265 * @return mixed String with error message or true when dependency checks are all-right 266 * @since 1.9 267 */ 268 public function dependency_checks() { 269 if ( ! is_null( $this->dependency ) ) { 270 return $this->dependency; 271 } 272 if ( in_array( 'woo-price-per-unit-pro/woo-price-per-unit.php', (array) get_option( 'active_plugins' ), true ) 273 || ( is_multisite() && array_key_exists( 'woo-price-per-unit-pro/woo-price-per-unit.php', (array) get_site_option( 'active_sitewide_plugins' ) ) ) ) { 274 $this->dependency = esc_html__( 'Price per unit plugin - PRO version is active. Please deactivate it first.', 'woo-price-per-unit' ); 275 return $this->dependency; 276 } 277 $this->dependency = true; 278 return $this->dependency; 279 } 280 281 /** 282 * Prevents activation of the plugin when dependency checks fail 283 * 284 * @return void 285 * @since 1.9 286 */ 287 public function admin_activation_check() { 288 $dependency_info = $this->dependency_checks(); 289 if ( true !== $dependency_info ) { 290 if ( is_plugin_active( plugin_basename( MCMP_PPU_FREE_PLUGIN_FILE ) ) ) { 291 deactivate_plugins( plugin_basename( MCMP_PPU_FREE_PLUGIN_FILE ) ); 292 $type = 'error'; 293 // Passing arguments into add_action by using PHP lambda - nice workaround. 294 add_action( 295 'admin_notices', 296 function () use ( $dependency_info, $type ) { 297 $this->mcmp_add_message( $dependency_info, $type ); 298 } 299 ); 300 // phpcs:disable WordPress.Security.NonceVerification.Recommended 301 if ( isset( $_GET['activate'] ) ) { 302 unset( $_GET['activate'] ); 303 } 304 // phpcs:enable WordPress.Security.NonceVerification.Recommended 305 } 306 } 307 } 308 309 /** 310 * Action on plugin activation - currently setting defaults 311 * Checks also the conditions for plugin activation - if not it prevents the activation 312 * 313 * @return void 314 * @since 1.5 315 */ 316 public function plugin_activated() { 317 $dependency_info = $this->dependency_checks(); 318 if ( true !== $dependency_info ) { 319 deactivate_plugins( plugin_basename( MCMP_PPU_FREE_PLUGIN_FILE ) ); 320 wp_die( esc_html__( 'Plugin NOT activated: ', 'woo-price-per-unit' ) . wp_kses_post( $dependency_info ) ); 321 } 322 include MCMP_PPU_FREE_PLUGIN_DIR . 'includes/general-setting-defaults.php'; 323 } 324 325 /** 326 * Declares compatibility with WooCommerce HPOS feature 327 * 328 * @since 2.2.2 329 * 330 * @return void 331 */ 332 public function declare_hpos_compatibility() { 333 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 334 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', MCMP_PPU_FREE_PLUGIN_FILE, true ); 335 } 336 } 337 338 /** 339 * Performs db upgrade on plugin update 340 * 341 * @return void 286 342 * @since 2.0.8 287 343 */ 288 344 public function perform_db_upgrade() { 289 345 $used_db_version = get_option( '_mcmp_ppu_free_db_version', '1.0.0' ); 290 if ( MCMP_PPU_FREE_PLUGIN_VERSION != $used_db_version ){ 291 include 'includes/database-upgrade.php'; 292 } 293 } 294 295 /** 296 * Legacy options removal and migrating to new settings 297 * @since 1.6 298 */ 299 public function legacy_options_fix() 300 { 301 $old_opt = get_option('_mcmp_ppu_general_behaviour'); 302 if ($old_opt !== false) { 303 $old_opt = (empty($old_opt)) ? 'not' : $old_opt; 304 update_option('_mcmp_ppu_general', $old_opt); 305 delete_option('_mcmp_ppu_general_behaviour'); 306 } 307 $old_opt = get_option('_mcmp_ppu_single_page_behaviour'); 308 if ($old_opt !== false) { 309 $old_opt = (empty($old_opt)) ? 'not' : $old_opt; 310 update_option('_mcmp_ppu_single_page', $old_opt); 311 delete_option('_mcmp_ppu_single_page_behaviour'); 312 } 313 } 314 315 /** 316 * Load plugin's CSS style 317 * @since 1.3 318 */ 319 public function load_style() 320 { 321 wp_enqueue_style('mcmp_price_per_unit_style', plugins_url('/assets/CSS/woo-ppu-default-style.css', __FILE__), array(), MCMP_PPU_FREE_PLUGIN_VERSION ); 322 if (get_option('_mcmp_ppu_add_row_css') == 'yes') { 323 wp_enqueue_style('mcmp_price_per_altered_style', plugins_url('/assets/CSS/woo-ppu.css', __FILE__), array(), MCMP_PPU_FREE_PLUGIN_VERSION ); 324 } 325 } 326 327 /** 328 * Load plugin's admin styles and scripts 329 * @since 1.6 330 */ 331 public function load_admin_style() 332 { 333 wp_register_script('mcmp-ppu-admin', plugins_url('/assets/JS/woo-ppu-admin.js', __FILE__), array('jquery'), MCMP_PPU_FREE_PLUGIN_VERSION); 334 wp_enqueue_script('mcmp-ppu-admin'); 335 wp_enqueue_style('mcmp_price_per_unit_admin_style', plugins_url('/assets/CSS/woo-ppu-admin.css', __FILE__), array(), MCMP_PPU_FREE_PLUGIN_VERSION); 336 } 337 338 /** 339 * Add settings link 340 * @return string HTML output into plugin info 341 * @since 1.0 342 */ 343 public function plugin_action_links($links) 344 { 345 $plugin_links = array( 346 '<a href="' . admin_url('admin.php?page=wc-settings&tab=products§ion=mcmp_price_pu') . '">' . esc_html__('Settings', 'woo-price-per-unit') . '</a>', 347 ); 348 return array_merge($plugin_links, $links); 349 } 350 351 /** 352 * Adds tab to product options 353 * @param array $product_opt_tabs Newly created tab 354 * @since 1.0 355 */ 356 public function add_custom_product_options_tab($product_opt_tabs) 357 { 358 $product_opt_tabs['price-per-unit'] = array( 359 'label' => esc_html__('Price Per Unit', 'woo-price-per-unit'), // translatable 360 'target' => 'mcmp_ppu_options', // translatable 361 ); 362 return $product_opt_tabs; 363 } 364 365 /** 366 * @param array $atts Outputs options to show on plugin general settings tab 367 * Add the custom fields to the product general tab 368 * @since 1.0 369 */ 370 public function product_options($atts) 371 { 372 global $woocommerce, $post; 373 include 'includes/product-settings.php'; 374 } 375 376 /** 377 * Add Price per Unit settings section under the Products tab. 378 * @param array $sections List of sections 379 * @since 1.0 380 */ 381 public function add_general_options_section($sections) 382 { 383 $sections['mcmp_price_pu'] = esc_html__('Price Per Unit - free version', 'woo-price-per-unit'); 384 return $sections; 385 } 386 387 /** 388 * Populates Price per Unit settings section under the Products tab. 389 * @param array $settings Settings of WooCommerce 390 * @param string $current_section Which section is populated right now 391 * @since 1.0 392 */ 393 public function general_options($settings, $current_section) 394 { 395 if ($current_section == 'mcmp_price_pu') { 396 $cust_settings = include 'includes/general-settings.php'; 397 return $cust_settings; 398 // If not, return the standard settings 399 } else { 400 return $settings; 401 } 402 } 403 404 /** 405 * Saves product id from single product view 406 * needed for determining if not running from widget on single page 407 * @since 1.0 408 */ 409 public function get_single_id() 410 { 411 global $product; 412 if(is_object($product)){ 413 $this->single_pr_id = $product->get_id(); 414 } 415 } 416 417 /** 418 * Checks if the product is valid and then returns it's ID 419 * @since 2.0 420 * @param mixed $product_to_inspect which product to check 421 * @param boolean $get_parent whether to get parent product ID 422 * @return mixed ID of the verified product of false when wrong Product 423 */ 424 public function check_product_id($product_to_inspect, $get_parent = false) 425 { 426 $product_id = false; 427 if (!empty($product_to_inspect)) { 428 if (is_numeric($product_to_inspect)) { 429 $product_to_inspect = wc_get_product($product_to_inspect); 430 } 431 if (is_object($product_to_inspect)) { 432 $product_id = $product_to_inspect->get_id(); 433 if($get_parent == true && $product_to_inspect->get_type() === 'variation'){ 434 $product_id = $product_to_inspect->get_parent_id(); 435 } 436 } 437 } 438 return $product_id; 439 } 440 441 /** 442 * Gets option with product option overrides 443 * Works with product meta to check for option, if value is empty proceed to general options 444 * @since 1.6 445 * @param string $option which option to check 446 * @param integer $product_id_to_inspect which product to check - supposed to be checked first 447 * @param mixed $default value which should be passed if nothing is found 448 * @return string 449 */ 450 public function get_option_override($option, $product_id_to_inspect, $default = '') 451 { 452 $option_val = ''; 453 //General options 454 if (empty($option_val)) { 455 $option_val = get_option($option); 456 } 457 //Everything failed and we have default? Place it there. The ifs order is this because default is rarely used 458 if (!empty($default)) { 459 if (empty($option_val)) { 460 $option_val = $default; 461 } 462 } 463 return $option_val; 464 } 465 466 /** 467 * Gets behaviour of recalculation 468 * The product is checked - on problems returns false 469 * @since 1.6 470 * @param mixed $product_to_inspect product id of product object 471 * @param string $special_case Alter the behavior on special ocasion 472 * @return mixed false if should not recalculate or string type of behaviour for recalculation 473 * 474 */ 475 public function get_recalc_behaviour($product_to_inspect, $special_case = false) 476 { 477 $behav = ''; 478 $product_id = $this->check_product_id($product_to_inspect, true); 479 if (empty($product_id)) { 480 return false; 481 } 482 switch ($special_case) { 483 case 'cart': 484 $option = get_option('_mcmp_ppu_cart_page'); 485 switch ($option) { 486 case 'single': 487 $option = '_mcmp_ppu_single_page'; 488 break; 489 case 'shop': 490 $option = '_mcmp_ppu_general'; 491 break; 492 default: 493 $behav = $option; 494 break; 495 } 496 break; 497 498 default: 499 //Determine whether to recalculate or not - depending also on override 500 if (is_product() && $product_id === $this->single_pr_id) { 501 //Single product page + is it That product or some widget product? 502 $option = '_mcmp_ppu_single_page'; 503 } else { 504 //Other pages 505 $option = '_mcmp_ppu_general'; 506 } 507 break; 508 } 509 $behav = empty($behav) ? $this->get_option_override($option, $product_id) : $behav; 510 $behav = ($behav === 'not') ? false : $behav; 511 return $behav; 512 } 513 514 /** 515 * Render additional recalculated text and wrap it around the original price 516 * @param integer $product_id_to_inspect Product which will receive the additional text - supposed to be checked first 517 * @param mixed $price_text Recalculated price 518 * @param boolean $row_wrapper Should be a recalc row wrapper? 519 * @return string Automatic additional text 520 * @since 1.9.3 521 */ 522 public function render_recalc_text($product_id_to_inspect , $price_text = '', $row_wrapper = false) 523 { 524 525 $pre_text = $this->get_option_override('_mcmp_ppu_recalc_text_prefix', $product_id_to_inspect); 526 $pre_text = empty($pre_text) ? '' : esc_html_x( $pre_text, 'Recalculated price prefix text', 'woo-price-per-unit' ); 527 $suf_text = $this->get_option_override('_mcmp_ppu_recalc_text', $product_id_to_inspect); 528 $suf_text = (empty($suf_text) || $suf_text==' ') ? '' : $suf_text; 529 if($suf_text=='-automatic-'){ 530 $suf_text = get_option('_mcmp_ppu_recalc_text_automatic_preposition','/'); 531 $suf_text = _x( $suf_text, 'Preposition for weight unit when using automatic text', 'woo-price-per-unit' ); 532 $suf_text = !empty($suf_text) ? '<span class="mcmp-recalc-price-suffix-preposition">'.esc_html(str_replace('%',' ',$suf_text)).'</span>':''; 533 $recalc_per_units = $this->get_option_override('_mcmp_ppu_recalc_per_units', $product_id_to_inspect, 1); 534 if($recalc_per_units!=1){ 535 $suf_text.=$recalc_per_units.' '; 536 } 537 $ratio_unit = $this->get_option_override('_mcmp_ppu_ratio_unit', $product_id_to_inspect); 538 if(empty($ratio_unit)){ 539 $ratio_unit = get_option('woocommerce_weight_unit'); 540 } 541 switch ( $ratio_unit) { 542 case 'kg': 543 $ratio_unit = esc_html(_nx( 'kg', 'kg', $recalc_per_units,'weight unit', 'woo-price-per-unit')); 544 break; 545 case 'g': 546 $ratio_unit = esc_html(_nx( 'g', 'g', $recalc_per_units,'weight unit', 'woo-price-per-unit')); 547 break; 548 case 'oz': 549 $ratio_unit = esc_html(_nx( 'oz', 'oz', $recalc_per_units,'weight unit', 'woo-price-per-unit')); 550 break; 551 case 'lbs': 552 $ratio_unit = esc_html(_nx( 'lb', 'lbs', $recalc_per_units,'weight unit', 'woo-price-per-unit')); 553 break; 554 default: 555 $ratio_unit=esc_html__($ratio_unit, 'woo-price-per-unit'); 556 } 557 $suf_text.=$ratio_unit; 558 }else{ 559 $suf_text = esc_html_x($suf_text, 'Recalculated price suffix text', 'woo-price-per-unit'); 560 } 561 if(!empty($pre_text) || !empty($suf_text)){ 562 $separator=get_option('_mcmp_ppu_recalc_text_separate'); 563 $separator=($separator=='no')?'':' '; 564 } 565 if (!empty($pre_text)) { 566 $pre_text = '<span class="woocommerce-Price-currencySymbol amount mcmp-recalc-price-prefix">' . $pre_text . '</span>' . $separator; 567 } 568 if (!empty($suf_text)) { 569 $suf_text = $separator . '<span class="woocommerce-Price-currencySymbol amount mcmp-recalc-price-suffix">' . $suf_text . '</span>'; 570 } 571 if($row_wrapper == true){ 572 $pre_text = '</br><span class="mcmp_recalc_price_row">' . $pre_text; 573 $suf_text .= '</span>'; 574 } 575 576 return $pre_text . $price_text . $suf_text; 577 } 578 579 /** 580 * Render cart and minicart price - caled from filter woocommerce_cart_item_price 581 * @param string $price_text Original text 582 * @param array $product_data Information about the product in the cart 583 * @param integer $cart_key Id of the cart 584 * @since 1.6 585 * @return string recalculated $price + custom string 586 */ 587 public function custom_cart_price($price_text, $product_data, $cart_key) 588 { 346 if ( MCMP_PPU_FREE_PLUGIN_VERSION != $used_db_version ) { 347 include MCMP_PPU_FREE_PLUGIN_DIR . 'includes/database-upgrade.php'; 348 } 349 } 350 351 /** 352 * Load plugin's CSS style 353 * 354 * @return void 355 * @since 1.3 356 */ 357 public function load_style() { 358 wp_enqueue_style( 'mcmp_price_per_unit_style', plugins_url( '/assets/CSS/woo-ppu-default-style.css', MCMP_PPU_FREE_PLUGIN_FILE ), array(), MCMP_PPU_FREE_PLUGIN_VERSION ); 359 if ( get_option( '_mcmp_ppu_add_row_css' ) == 'yes' ) { 360 wp_enqueue_style( 'mcmp_price_per_altered_style', plugins_url( '/assets/CSS/woo-ppu.css', MCMP_PPU_FREE_PLUGIN_FILE ), array(), MCMP_PPU_FREE_PLUGIN_VERSION ); 361 } 362 } 363 364 /** 365 * Load plugin's admin styles and scripts 366 * 367 * @param string $hook - Where is action executed. 368 * @return void 369 * @since 1.6 370 */ 371 public function load_admin_style( $hook ) { 372 wp_register_script( 'mcmp-ppu-admin', plugins_url( '/assets/JS/woo-ppu-admin.js', MCMP_PPU_FREE_PLUGIN_FILE ), array( 'jquery' ), MCMP_PPU_FREE_PLUGIN_VERSION, false ); 373 wp_enqueue_script( 'mcmp-ppu-admin' ); 374 wp_enqueue_style( 'mcmp_price_per_unit_admin_style', plugins_url( '/assets/CSS/woo-ppu-admin.css', MCMP_PPU_FREE_PLUGIN_FILE ), array(), MCMP_PPU_FREE_PLUGIN_VERSION ); 375 } 376 377 /** 378 * Add settings link 379 * 380 * @param array $links - Action links. 381 * @return array HTML output into plugin info 382 * @since 1.0 383 */ 384 public function plugin_action_links( $links ) { 385 $plugin_links = array( 386 '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=products§ion=mcmp_price_pu' ) . '">' . esc_html__( 'Settings', 'woo-price-per-unit' ) . '</a>', 387 ); 388 return array_merge( $plugin_links, $links ); 389 } 390 391 /** 392 * Adds tab to product options 393 * 394 * @param array $product_opt_tabs Newly created tab. 395 * @return array 396 * @since 1.0 397 */ 398 public function add_custom_product_options_tab( $product_opt_tabs ) { 399 $product_opt_tabs['price-per-unit'] = array( 400 'label' => esc_html__( 'Price Per Unit', 'woo-price-per-unit' ), // translatable. 401 'target' => 'mcmp_ppu_options', // translatable. 402 ); 403 return $product_opt_tabs; 404 } 405 406 /** 407 * Outputs product options. 408 * 409 * @param array $atts Product settings. 410 * @return void 411 * @since 1.0 412 */ 413 public function product_options( $atts ) { 414 include MCMP_PPU_FREE_PLUGIN_DIR . 'includes/product-settings.php'; 415 } 416 417 /** 418 * Update the database with the new options 419 * 420 * @param integer $post_id Id of the post where setting will be saved. 421 * @return void 422 * @since 2.2.4 423 */ 424 public function save_product_options( $post_id ) { 425 include MCMP_PPU_FREE_PLUGIN_DIR . 'includes/product-settings-save.php'; 426 } 427 428 /** 429 * Add Price per Unit settings section under the Products tab. 430 * 431 * @param array $sections List of sections. 432 * @return array 433 * @since 1.0 434 */ 435 public function add_general_options_section( $sections ) { 436 $sections['mcmp_price_pu'] = esc_html__( 'Price Per Unit - free version', 'woo-price-per-unit' ); 437 return $sections; 438 } 439 440 /** 441 * Populates Price per Unit settings section under the Products tab. 442 * 443 * @param array $settings Settings of WooCommerce. 444 * @param string $current_section Which section is populated right now. 445 * @return array 446 * @since 1.0 447 */ 448 public function general_options( $settings, $current_section ) { 449 if ( 'mcmp_price_pu' == $current_section ) { 450 $cust_settings = include MCMP_PPU_FREE_PLUGIN_DIR . 'includes/general-settings.php'; 451 return $cust_settings; 452 // If not, return the standard settings. 453 } else { 454 return $settings; 455 } 456 } 457 458 /** 459 * Saves product id from single product view 460 * needed for determining if not running from widget on single page 461 * 462 * @return void 463 * @since 1.0 464 */ 465 public function get_single_id() { 466 global $product; 467 if ( is_object( $product ) ) { 468 $this->single_pr_id = $product->get_id(); 469 } 470 } 471 472 /** 473 * Checks if the product is valid and then returns it's ID 474 * 475 * @since 2.0 476 * @param mixed $product_to_inspect which product to check. 477 * @param boolean $get_parent whether to get parent product ID. 478 * @return mixed ID of the verified product of false when wrong Product 479 */ 480 public function check_product_id( $product_to_inspect, $get_parent = false ) { 481 $product_id = false; 482 if ( ! empty( $product_to_inspect ) ) { 483 if ( is_numeric( $product_to_inspect ) ) { 484 $product_to_inspect = wc_get_product( $product_to_inspect ); 485 } 486 if ( is_object( $product_to_inspect ) ) { 487 $product_id = $product_to_inspect->get_id(); 488 if ( true == $get_parent && 'variation' === $product_to_inspect->get_type() ) { 489 $product_id = $product_to_inspect->get_parent_id(); 490 } 491 } 492 } 493 return $product_id; 494 } 495 496 /** 497 * Gets option with product option overrides 498 * Works with product meta to check for option, if value is empty proceed to general options 499 * 500 * @since 1.6 501 * @param string $option which option to check. 502 * @param integer $product_id_to_inspect which product to check - supposed to be checked first. 503 * @param mixed $def value which should be passed if nothing is found. 504 * @return string 505 */ 506 public function get_option_override( $option, $product_id_to_inspect, $def = '' ) { 507 $product_override = $option . '_override'; 508 $option_val = ''; 509 // Getting parent product ID of $product_id_to_inspect. 510 $product_id = $this->check_product_id( $product_id_to_inspect, true ); 511 // Product options. 512 if ( is_numeric( $product_id ) ) { 513 $option_val = get_post_meta( $product_id, $product_override, true ); 514 } 515 // General options. 516 if ( empty( $option_val ) ) { 517 $option_val = get_option( $option ); 518 } 519 // Everything failed and we have default? Place it there. The ifs order is this because default is rarely used. 520 if ( ! empty( $def ) && empty( $option_val ) ) { 521 $option_val = $def; 522 } 523 return $option_val; 524 } 525 526 /** 527 * Gets behaviour of recalculation 528 * The product is checked - on problems returns false 529 * 530 * @since 1.6 531 * @param mixed $product_to_inspect product id of product object. 532 * @param string $special_case Alter the behaviour on special occasion. 533 * @return mixed false if should not recalculate or string type of behaviour for recalculation 534 */ 535 public function get_recalc_behaviour( $product_to_inspect, $special_case = false ) { 536 $behav = ''; 537 $product_id = $this->check_product_id( $product_to_inspect, true ); 538 if ( empty( $product_id ) ) { 539 return false; 540 } 541 switch ( $special_case ) { 542 case 'cart': 543 $option = get_option( '_mcmp_ppu_cart_page' ); 544 switch ( $option ) { 545 case 'single': 546 $option = '_mcmp_ppu_single_page'; 547 break; 548 case 'shop': 549 $option = '_mcmp_ppu_general'; 550 break; 551 default: 552 $behav = $option; 553 break; 554 } 555 break; 556 557 default: 558 $option = '_mcmp_ppu_general'; 559 // Determine whether to recalculate or not - depending also on override. 560 // Single product page. 561 if ( is_product() ) { 562 // Limit the archive filter. 563 if ( ! doing_filter( 'woocommerce_after_shop_loop_item_title' ) ) { 564 // Do we have memorized the id? If not ignore it - might also be missing hook in the theme. 565 // Is it That product or some widget product? 566 if ( empty( $this->single_pr_id ) || $product_id === $this->single_pr_id ) { 567 $option = '_mcmp_ppu_single_page'; 568 } 569 } 570 } 571 break; 572 } 573 $behav = empty( $behav ) ? $this->get_option_override( $option, $product_id ) : $behav; 574 $behav = ( 'not' === $behav ) ? false : $behav; 575 return $behav; 576 } 577 578 /** 579 * Render additional recalculated text and wrap it around the original price 580 * 581 * @param integer $product_id_to_inspect Product which will receive the additional text - supposed to be checked first. 582 * @param mixed $price_text Recalculated price. 583 * @param boolean $row_wrapper Should be a recalc row wrapper?. 584 * @return string Automatic additional text 585 * @since 1.9.3 586 */ 587 public function render_recalc_text( $product_id_to_inspect, $price_text = '', $row_wrapper = false ) { 588 589 $pre_text = $this->get_option_override( '_mcmp_ppu_recalc_text_prefix', $product_id_to_inspect ); 590 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 591 $pre_text = empty( $pre_text ) ? '' : esc_html_x( $pre_text, 'Recalculated price prefix text', 'woo-price-per-unit' ); 592 $suf_text = $this->get_option_override( '_mcmp_ppu_recalc_text', $product_id_to_inspect ); 593 $suf_text = ( empty( $suf_text ) || ' ' == $suf_text ) ? '' : $suf_text; 594 if ( '-automatic-' == $suf_text ) { 595 $suf_text = get_option( '_mcmp_ppu_recalc_text_automatic_preposition', '/' ); 596 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 597 $suf_text = _x( $suf_text, 'Preposition for weight unit when using automatic text', 'woo-price-per-unit' ); 598 $suf_text = ! empty( $suf_text ) ? '<span class="mcmp-recalc-price-suffix-preposition">' . esc_html( str_replace( '%', ' ', $suf_text ) ) . '</span>' : ''; 599 $recalc_per_units = $this->get_option_override( '_mcmp_ppu_recalc_per_units', $product_id_to_inspect, 1 ); 600 if ( 1 != $recalc_per_units ) { 601 $suf_text .= $recalc_per_units . ' '; 602 } 603 $ratio_unit = $this->get_option_override( '_mcmp_ppu_ratio_unit', $product_id_to_inspect ); 604 if ( empty( $ratio_unit ) ) { 605 $ratio_unit = get_option( 'woocommerce_weight_unit' ); 606 } 607 switch ( $ratio_unit ) { 608 case 'kg': 609 $ratio_unit = esc_html( _nx( 'kg', 'kg', $recalc_per_units, 'weight unit', 'woo-price-per-unit' ) ); 610 break; 611 case 'g': 612 $ratio_unit = esc_html( _nx( 'g', 'g', $recalc_per_units, 'weight unit', 'woo-price-per-unit' ) ); 613 break; 614 case 'oz': 615 $ratio_unit = esc_html( _nx( 'oz', 'oz', $recalc_per_units, 'weight unit', 'woo-price-per-unit' ) ); 616 break; 617 case 'lbs': 618 $ratio_unit = esc_html( _nx( 'lb', 'lbs', $recalc_per_units, 'weight unit', 'woo-price-per-unit' ) ); 619 break; 620 default: 621 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 622 $ratio_unit = esc_html_x( $ratio_unit, 'Custom unit name', 'woo-price-per-unit' ); 623 } 624 $suf_text .= $ratio_unit; 625 } elseif ( ! empty( $suf_text ) ) { 626 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 627 $suf_text = esc_html_x( $suf_text, 'Recalculated price suffix text', 'woo-price-per-unit' ); 628 } 629 if ( ! empty( $pre_text ) ) { 630 $separator = ' '; 631 $pre_text = '<span class="woocommerce-Price-currencySymbol amount mcmp-recalc-price-prefix">' . $pre_text . '</span>' . $separator; 632 } 633 if ( ! empty( $suf_text ) ) { 634 $separator = get_option( '_mcmp_ppu_recalc_text_separate' ); 635 $separator = ( 'no' == $separator ) ? '' : ' '; 636 $suf_text = $separator . '<span class="woocommerce-Price-currencySymbol amount mcmp-recalc-price-suffix">' . $suf_text . '</span>'; 637 } 638 if ( true == $row_wrapper ) { 639 $pre_text = '<br><span class="mcmp_recalc_price_row">' . $pre_text; 640 $suf_text .= '</span>'; 641 } 642 643 return $pre_text . $price_text . $suf_text; 644 } 645 646 /** 647 * Render cart and mini-cart price. 648 * Filter woocommerce_cart_item_price 649 * 650 * @param string $price_text Original text. 651 * @param array $product_data Information about the product in the cart. 652 * @param integer $cart_key Id of the cart. 653 * @since 1.6 654 * @return string recalculated $price + custom string 655 */ 656 public function custom_cart_price( $price_text, $product_data, $cart_key ) { 589 657 global $woocommerce; 590 658 591 if (is_null($product_data)){ 592 return $price_text; 593 } 594 $product_id = (empty($product_data['variation_id'])) ? $product_data['product_id'] : $product_data['variation_id']; 595 //get_recalc_behaviour also checks the product ID for validity - no need to check it again 596 if (empty($this->get_recalc_behaviour($product_id,'cart'))) { 597 return $price_text; 598 } 599 $product = $product_data['data']; 600 $weight = $this->get_option_override('_mcmp_ppu_cust_num_of_units', $product_id); 601 if (empty($weight)) { 602 $weight = $product->get_weight(); //$product_data[data]->get_weight() 603 } 604 $weight = floatval($weight); 605 $normal_price = floatval($product->get_price()); 606 if (empty($weight) || empty($normal_price)) { 607 return $price_text; 608 } 609 $round_prices = get_option('_mcmp_ppu_disable_price_rounding') == 'yes' ? false : true; 610 //Pre Woo 3.3.0 compatibility - display_prices_including_tax is declared there. 611 if (method_exists($woocommerce->cart,'display_prices_including_tax')) { 659 if ( is_null( $product_data ) ) { 660 return $price_text; 661 } 662 $product_id = ( empty( $product_data['variation_id'] ) ) ? $product_data['product_id'] : $product_data['variation_id']; 663 // get_recalc_behaviour also checks the product ID for validity - no need to check it again. 664 $behav = $this->get_recalc_behaviour( $product_id, 'cart' ); 665 if ( empty( $behav ) ) { 666 return $price_text; 667 } 668 $product = $product_data['data']; 669 $weight = $this->get_option_override( '_mcmp_ppu_cust_num_of_units', $product_id ); 670 if ( empty( $weight ) ) { 671 $weight = $product->get_weight(); 672 } 673 $weight = floatval( $weight ); 674 $normal_price = floatval( $product->get_price() ); 675 if ( empty( $weight ) || empty( $normal_price ) ) { 676 return $price_text; 677 } 678 $round_prices = get_option( '_mcmp_ppu_disable_price_rounding' ) == 'yes' ? false : true; 679 // Pre Woo 3.3.0 compatibility - display_prices_including_tax is declared there. 680 if ( method_exists( $woocommerce->cart, 'display_prices_including_tax' ) ) { 612 681 $incl_tax = $woocommerce->cart->display_prices_including_tax(); 613 682 } else { … … 615 684 } 616 685 if ( $incl_tax ) { 617 $normal_price = wc_get_price_including_tax( $product, array( 'price' => $normal_price) );686 $normal_price = wc_get_price_including_tax( $product, array( 'price' => $normal_price ) ); 618 687 } else { 619 $normal_price = wc_get_price_excluding_tax( $product, array('price' => $normal_price) ); 620 } 621 //$normal_price = wc_get_price_to_display($product, array('price' => $normal_price)); 622 $normal_price = $normal_price / $weight; 623 $normal_price = $this->price_ratio_calc($normal_price, $product_id); 624 if ($round_prices == false){ 625 $wc_decimals=wc_get_price_decimals(); 626 $normal_price = $this->truncate_number($normal_price, $wc_decimals); 627 } 628 $recalc = wc_price($normal_price); 629 if('yes' == get_option('_mcmp_ppu_cart_show_sale_price')){ 630 if ($product->is_on_sale()) { 631 $regular_price = floatval($product->get_regular_price()); 688 $normal_price = wc_get_price_excluding_tax( $product, array( 'price' => $normal_price ) ); 689 } 690 $normal_price = $normal_price / $weight; 691 $normal_price = $this->price_ratio_calc( $normal_price, $product_id ); 692 if ( false == $round_prices ) { 693 $wc_decimals = wc_get_price_decimals(); 694 $normal_price = $this->truncate_number( $normal_price, $wc_decimals ); 695 } 696 $recalc = wc_price( $normal_price ); 697 if ( 'yes' == get_option( '_mcmp_ppu_cart_show_sale_price' ) ) { 698 if ( $product->is_on_sale() ) { 699 $regular_price = floatval( $product->get_regular_price() ); 632 700 if ( $incl_tax ) { 633 $regular_price = wc_get_price_including_tax( $product, array( 'price' => $regular_price) );701 $regular_price = wc_get_price_including_tax( $product, array( 'price' => $regular_price ) ); 634 702 } else { 635 $regular_price = wc_get_price_excluding_tax( $product, array( 'price' => $regular_price) );703 $regular_price = wc_get_price_excluding_tax( $product, array( 'price' => $regular_price ) ); 636 704 } 637 705 $regular_price = $regular_price / $weight; 638 $regular_price = $this->price_ratio_calc( $regular_price, $product_id);639 if ( $round_prices == false){640 $regular_price = $this->truncate_number( $regular_price, $wc_decimals);641 } 642 $recalc = '<del>' . wc_price( $regular_price) . '</del> <ins>' . $recalc . '</ins>';706 $regular_price = $this->price_ratio_calc( $regular_price, $product_id ); 707 if ( false == $round_prices ) { 708 $regular_price = $this->truncate_number( $regular_price, $wc_decimals ); 709 } 710 $recalc = '<del>' . wc_price( $regular_price ) . '</del> <ins>' . $recalc . '</ins>'; 643 711 } 644 712 } 645 $recalc = $this->render_recalc_text($product_id, $recalc, true); 646 return $price_text . $recalc; 647 } 648 649 /** 650 * Price ratio calculation - product id is not verified, supposedly it should be already verified 651 * takes custom ratio and calculate it in - the price should be already divided by weight(cannot be here because of varible products calculation) 652 * @since 1.7 653 * @param float $price - price which should be recalculated 654 * @param integer $product_id_to_inspect - id of the product - supposed to be checked first 655 * @return float recalculated price 656 */ 657 public function price_ratio_calc($price, $product_id_to_inspect) 658 { 659 $cust_ratio = 1; 660 $recalc_per_units = $this->get_option_override('_mcmp_ppu_recalc_per_units', $product_id_to_inspect, 1); 661 $recalc_per_units = floatval($recalc_per_units); 662 $ratio_unit = $this->get_option_override('_mcmp_ppu_ratio_unit', $product_id_to_inspect); 663 if (!empty($ratio_unit)) { 664 $current_unit = get_option('woocommerce_weight_unit'); 665 $cust_ratio = wc_get_weight(1, $current_unit, $ratio_unit); 666 } 667 $price *= $cust_ratio * $recalc_per_units; 668 return $price; 669 } 670 671 /** 672 * Modifies the general price text 673 * @param integer $product_id_to_inspect Product for which the text will be altered - supposed to be checked first 674 * @param mixed $price_text Recalculated price 675 * @return string Altered general price text 676 * @since 2.0.0 677 */ 678 public function general_price_manipulation($product_id_to_inspect , $price_text = '') 679 { 680 $product = wc_get_product($product_id_to_inspect); 681 $product_type = $product->get_type(); 682 $var_prefix_text = ''; 683 switch ($product_type) { 684 case 'simple': 685 $hide_sale = get_option('_mcmp_ppu_hide_sale_price') == 'yes' ? true : false; 686 if ($hide_sale == true && $product->is_on_sale()) { 687 $price_text = floatval($product->get_price()); 688 if (!empty($price_text)) { 689 $price_text = wc_get_price_to_display($product, array('price' => $price_text)); 690 } 691 $price_text = wc_price($price_text); 692 } 693 break; 694 case 'variable': 695 //hide variable max price? 696 $hide_max = get_option('_mcmp_ppu_var_hide_max_price') == 'yes' ? true : false; 697 if ($hide_max == true) { 698 //needles to remake the price? 699 $variable_price_min = floatval($product->get_variation_price('min',true)); 700 $price_text = wc_price($variable_price_min); 701 } 702 if ($product->is_on_sale()){ 703 $show_sale_price = get_option('_mcmp_ppu_var_show_sale_price') == 'yes' ? true : false; 704 if ($show_sale_price == true){ 705 $price_text = '<ins>' . $price_text . '</ins>'; 706 $variable_regular_price_min = floatval($product->get_variation_regular_price('min',true)); 707 $price_regular = '<del>' . wc_price($variable_regular_price_min); 708 if ($hide_max == false){ 709 $variable_regular_price_max = floatval($product->get_variation_regular_price('max',true)); 710 if ($variable_regular_price_min !== $variable_regular_price_max){ 711 $price_regular .= '–' . wc_price($variable_regular_price_max); 712 } 713 } 714 $price_regular .= '</del>'; 715 $price_text = $price_regular . $price_text; 716 } 717 } 718 //fill prefix text for variables 719 $var_prefix_text = get_option('_mcmp_ppu_var_prefix_text'); 720 $var_prefix_text = (empty($var_prefix_text)) ? '' : '<span class="woocommerce-Price-currencySymbol amount mcmp-variable-price-prefix">' . esc_html__($var_prefix_text, 'woo-price-per-unit') . ' ' . '</span>'; 721 $price_text = $var_prefix_text . $price_text; 722 break; 723 } 724 $add_text = $this->get_option_override('_mcmp_ppu_additional_text', $product_id_to_inspect); 725 $separator = get_option('_mcmp_ppu_recalc_text_separate') == 'no' ? '' : ' '; 726 $add_text = (empty($add_text)) ? '' : '<span class="woocommerce-Price-currencySymbol amount mcmp-general-price-suffix">' . $separator . esc_html__($add_text, 'woo-price-per-unit') . '</span>'; 727 return $price_text . $add_text; 728 } 729 730 /** 731 * Render the output - called from filter woocommerce_get_price_html 732 * @param string $price Original text 733 * @param object $instance Product for which to recalculate 734 * @since 1.0 735 * @return string recalculated $price + custom string 736 */ 737 public function custom_price($price, $instance) 738 { 739 global $woocommerce, $page; 740 if (is_null($instance)){ 713 $recalc = $this->render_recalc_text( $product_id, $recalc, true ); 714 return $price_text . $recalc; 715 } 716 717 /** 718 * Price ratio calculation - product id is not verified, supposedly it should be already verified 719 * takes custom ratio and calculate it in - the price should be already divided by weight(cannot be here because of variable products calculation) 720 * 721 * @since 1.7 722 * @param float $price - price which should be recalculated. 723 * @param integer $product_id_to_inspect - id of the product - supposed to be checked first. 724 * @return float recalculated price 725 */ 726 public function price_ratio_calc( $price, $product_id_to_inspect ) { 727 $cust_ratio = 1; 728 $recalc_per_units = $this->get_option_override( '_mcmp_ppu_recalc_per_units', $product_id_to_inspect, 1 ); 729 $recalc_per_units = floatval( $recalc_per_units ); 730 $ratio_unit = $this->get_option_override( '_mcmp_ppu_ratio_unit', $product_id_to_inspect ); 731 if ( ! empty( $ratio_unit ) ) { 732 $current_unit = get_option( 'woocommerce_weight_unit' ); 733 $cust_ratio = wc_get_weight( 1, $current_unit, $ratio_unit ); 734 } 735 $price *= $cust_ratio * $recalc_per_units; 736 return $price; 737 } 738 739 /** 740 * Modifies the general price text 741 * 742 * @param integer $product_id_to_inspect Product for which the text will be altered - supposed to be checked first. 743 * @param mixed $price_text Recalculated price. 744 * @return string Altered general price text 745 * @since 2.0.0 746 */ 747 public function general_price_manipulation( $product_id_to_inspect, $price_text = '' ) { 748 $product = wc_get_product( $product_id_to_inspect ); 749 $product_type = $product->get_type(); 750 $var_prefix_text = ''; 751 switch ( $product_type ) { 752 case 'simple': 753 $hide_sale = get_option( '_mcmp_ppu_hide_sale_price' ) == 'yes' ? true : false; 754 if ( true == $hide_sale && $product->is_on_sale() ) { 755 $price_text = floatval( $product->get_price() ); 756 if ( ! empty( $price_text ) ) { 757 $price_text = wc_get_price_to_display( $product, array( 'price' => $price_text ) ); 758 } 759 $price_text = wc_price( $price_text ); 760 } 761 break; 762 case 'variable': 763 // hide variable max price? 764 $hide_max = get_option( '_mcmp_ppu_var_hide_max_price' ) == 'yes' ? true : false; 765 if ( true == $hide_max ) { 766 // needles to remake the price? 767 $variable_price_min = floatval( $product->get_variation_price( 'min', true ) ); 768 $price_text = wc_price( $variable_price_min ); 769 } 770 if ( $product->is_on_sale() ) { 771 $show_sale_price = get_option( '_mcmp_ppu_var_show_sale_price' ) == 'yes' ? true : false; 772 if ( true == $show_sale_price ) { 773 $sale_price_present = strpos( $price_text, '<del' ); 774 // is sale price already present? 775 if ( false !== $sale_price_present ) { 776 $show_sale_price = false; 777 } 778 } 779 if ( true == $show_sale_price ) { 780 $price_text = '<ins>' . $price_text . '</ins>'; 781 $variable_regular_price_min = floatval( $product->get_variation_regular_price( 'min', true ) ); 782 $price_regular = '<del>' . wc_price( $variable_regular_price_min ); 783 if ( false == $hide_max ) { 784 $variable_regular_price_max = floatval( $product->get_variation_regular_price( 'max', true ) ); 785 if ( $variable_regular_price_min !== $variable_regular_price_max ) { 786 $price_regular .= '–' . wc_price( $variable_regular_price_max ); 787 } 788 } 789 $price_regular .= '</del>'; 790 $price_text = $price_regular . $price_text; 791 } 792 } 793 // fill prefix text for variables. 794 $var_prefix_text = get_option( '_mcmp_ppu_var_prefix_text' ); 795 if ( ! empty( $var_prefix_text ) ) { 796 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 797 $var_prefix_text = esc_html_x( $var_prefix_text, 'Variations - variable price prefix', 'woo-price-per-unit' ); 798 $var_prefix_text = '<span class="woocommerce-Price-currencySymbol amount mcmp-variable-price-prefix">' . $var_prefix_text . ' </span>'; 799 $price_text = $var_prefix_text . $price_text; 800 } 801 break; 802 } 803 $add_text = $this->get_option_override( '_mcmp_ppu_additional_text', $product_id_to_inspect ); 804 if ( ! empty( $add_text ) ) { 805 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 806 $add_text = esc_html_x( $add_text, 'General price suffix text', 'woo-price-per-unit' ); 807 $separator = get_option( '_mcmp_ppu_recalc_text_separate' ) == 'no' ? '' : ' '; 808 $add_text = '<span class="woocommerce-Price-currencySymbol amount mcmp-general-price-suffix">' . $separator . $add_text . '</span>'; 809 } else { 810 $add_text = ''; 811 } 812 return $price_text . $add_text; 813 } 814 815 /** 816 * Render the output - called from filter woocommerce_get_price_html 817 * 818 * @param string $html_price Original text. 819 * @param object $instance Product for which to recalculate. 820 * @since 1.0 821 * @return string|bool recalculated $html_price + custom string 822 */ 823 public function custom_price( $html_price, $instance ) { 824 if ( is_null( $instance ) ) { 741 825 global $product; 742 }else{ 743 $product=$instance; 744 } 745 //Product validity check 746 $prod_id = $this->check_product_id($product); 747 if($prod_id == false){ 748 return false; 749 } 750 $product_type = $product->get_type(); 751 //Do not recalculate single variation - it's not displayed anywhere 752 if ($product_type == 'variation') { 753 return $price; 754 } 755 $behav = $this->get_recalc_behaviour($prod_id); 756 // Recalculate price 757 if (!empty($behav)) { 758 //Price recalculation 759 $round_prices = get_option('_mcmp_ppu_disable_price_rounding') == 'yes' ? false : true; 760 $wc_decimals=wc_get_price_decimals(); 761 $recalc_price = ''; 762 switch ($product_type) { 763 case 'simple': 764 $units = floatval($this->get_option_override('_mcmp_ppu_cust_num_of_units', $prod_id)); 765 if (empty($units) && $product->has_weight()) { 766 $units = $product->get_weight(); 767 } 768 $units = floatval( $units ); 769 $normal_price = floatval($product->get_price()); 770 if ($units > 0 && !empty($normal_price)) { 771 $hide_sale = get_option('_mcmp_ppu_hide_sale_price') == 'yes' ? true : false; 772 $normal_price = wc_get_price_to_display($product, array('price' => $normal_price)); 773 $normal_price = $normal_price / $units; 774 $normal_price = $this->price_ratio_calc($normal_price, $prod_id); 775 if ($round_prices == false){ 776 $normal_price = $this->truncate_number($normal_price, $wc_decimals); 777 } 778 if ($product->is_on_sale() && $hide_sale == false) { 779 $regular_price = floatval($product->get_regular_price()); 780 $regular_price = wc_get_price_to_display($product, array('price' => $regular_price)); 781 $regular_price = $regular_price / $units; 782 $regular_price = $this->price_ratio_calc($regular_price, $prod_id); 783 if ($round_prices == false){ 784 $regular_price = $this->truncate_number($regular_price, $wc_decimals); 785 } 786 $recalc_price = '<del>' . wc_price($regular_price) . '</del><ins>' . wc_price($normal_price) . '</ins>'; 787 } else { 788 $recalc_price = wc_price($normal_price); 789 } 790 } 791 break; 792 case 'variable': 793 //When getting variants the filter will fire this again - this is to speed up the process 794 remove_filter('woocommerce_get_price_html', array($this, 'custom_price'), 10); 795 $variations = $product->get_available_variations(); 796 add_filter('woocommerce_get_price_html', array($this, 'custom_price'), 10, 2); 797 $num_of_variants = count($variations); 798 if ($num_of_variants > 0) { 799 $parent_prod_weight = $product->get_weight(); 800 foreach($variations as $value){ 801 $var_id = $value['variation_id']; 802 $units = $this->get_option_override('_mcmp_ppu_cust_num_of_units', $var_id); 803 if (empty($units)) { 804 $units=!empty($value['weight']) ? $value['weight'] : $parent_prod_weight; 805 } 806 if(!empty($units) && !empty($value['display_price'])){ 807 $var_recalc_prices[]= $value['display_price'] / floatval($units); 808 } 809 } 810 if (isset($var_recalc_prices) && !empty($var_recalc_prices)) { 811 $hide_max = get_option('_mcmp_ppu_var_hide_max_price') == 'yes' ? true : false; 812 asort($var_recalc_prices); 813 $variable_price_min = reset($var_recalc_prices); 814 $variable_price_min = $this->price_ratio_calc($variable_price_min, $prod_id); 815 if ($round_prices == true){ 816 $variable_price_min = round($variable_price_min,$wc_decimals); 817 } else { 818 $variable_price_min = $this->truncate_number($variable_price_min, $wc_decimals); 819 } 820 $recalc_price = wc_price($variable_price_min); 821 if ($hide_max == false) { 822 $variable_price_max = end($var_recalc_prices); 823 $variable_price_max = $this->price_ratio_calc($variable_price_max, $prod_id); 824 if ($round_prices == true){ 825 $variable_price_max = round($variable_price_max,$wc_decimals); 826 } else { 827 $variable_price_max = $this->truncate_number($variable_price_max, $wc_decimals); 828 } 829 if ($variable_price_min !== $variable_price_max) { 830 $recalc_price .= '–' . wc_price($variable_price_max); 831 } 832 } 833 } 834 } 835 break; 836 } 837 } 838 switch ($behav) { 839 case 'replace': 840 //Recalc happened - let's replace 841 //otherwise render normal text 842 if(!empty($recalc_price)){ 843 $price = $this->render_recalc_text($prod_id, $recalc_price); 844 if ($product_type == 'variable'){ 845 //The _mcmp_ppu_var_prefix_text needs to be displayed even for the replaced price text 846 $var_prefix_text = get_option('_mcmp_ppu_var_prefix_text'); 847 $var_prefix_text = (empty($var_prefix_text)) ? '' : '<span class="woocommerce-Price-currencySymbol amount mcmp-variable-price-prefix">' . esc_html__($var_prefix_text, 'woo-price-per-unit-pro') . ' ' . '</span>'; 848 $price = $var_prefix_text . $price; 849 } 850 }else{ 851 $price = $this->general_price_manipulation($prod_id, $price); 852 } 853 break; 854 case 'add': 855 if(!empty($price)){ 856 $price = $this->general_price_manipulation($prod_id, $price); 857 } 858 if(!empty($recalc_price)){ 859 $price .= $this->render_recalc_text($prod_id, $recalc_price, true); 860 } 861 break; 862 default: 863 if(!empty($price)){ 864 $price = $this->general_price_manipulation($prod_id, $price); 826 } else { 827 $product = $instance; 828 } 829 // Product validity check. 830 $prod_id = $this->check_product_id( $product ); 831 if ( false == $prod_id ) { 832 return false; 833 } 834 $product_type = $product->get_type(); 835 // Do not recalculate single variation - it's not displayed anywhere. 836 if ( 'variation' == $product_type ) { 837 return $html_price; 838 } 839 $behav = $this->get_recalc_behaviour( $prod_id ); 840 // Recalculate price. 841 if ( ! empty( $behav ) ) { 842 // Price recalculation. 843 $round_prices = get_option( '_mcmp_ppu_disable_price_rounding' ) == 'yes' ? false : true; 844 $wc_decimals = wc_get_price_decimals(); 845 $recalc_price = ''; 846 switch ( $product_type ) { 847 case 'simple': 848 $units = floatval( $this->get_option_override( '_mcmp_ppu_cust_num_of_units', $prod_id ) ); 849 if ( empty( $units ) && $product->has_weight() ) { 850 $units = $product->get_weight(); 851 } 852 $units = floatval( $units ); 853 $normal_price = floatval( $product->get_price() ); 854 if ( $units > 0 && ! empty( $normal_price ) ) { 855 $hide_sale = get_option( '_mcmp_ppu_hide_sale_price' ) == 'yes' ? true : false; 856 $normal_price = wc_get_price_to_display( $product, array( 'price' => $normal_price ) ); 857 $normal_price = $normal_price / $units; 858 $normal_price = $this->price_ratio_calc( $normal_price, $prod_id ); 859 if ( false == $round_prices ) { 860 $normal_price = $this->truncate_number( $normal_price, $wc_decimals ); 861 } 862 if ( $product->is_on_sale() && false == $hide_sale ) { 863 $regular_price = floatval( $product->get_regular_price() ); 864 $regular_price = wc_get_price_to_display( $product, array( 'price' => $regular_price ) ); 865 $regular_price = $regular_price / $units; 866 $regular_price = $this->price_ratio_calc( $regular_price, $prod_id ); 867 if ( false == $round_prices ) { 868 $regular_price = $this->truncate_number( $regular_price, $wc_decimals ); 869 } 870 $recalc_price = '<del>' . wc_price( $regular_price ) . '</del><ins>' . wc_price( $normal_price ) . '</ins>'; 871 } else { 872 $recalc_price = wc_price( $normal_price ); 873 } 874 } 875 break; 876 case 'variable': 877 // When getting variants the filter will fire this again - this is to speed up the process. 878 $had_filter = remove_filter( 'woocommerce_get_price_html', array( $this, 'custom_price' ), $this->hook_priority ); 879 $variations = $product->get_available_variations( 'objects' ); 880 $num_of_variants = count( $variations ); 881 if ( $num_of_variants > 0 ) { 882 $parent_prod_weight = $product->get_weight(); 883 foreach ( $variations as $variation ) { 884 $var_id = $variation->get_id(); 885 $units = $this->get_option_override( '_mcmp_ppu_cust_num_of_units', $var_id ); 886 if ( empty( $units ) ) { 887 $units = $variation->get_weight(); 888 $units = ! empty( $units ) ? $units : $parent_prod_weight; 889 } 890 $var_price = wc_get_price_to_display( $variation ); 891 if ( ! empty( $units ) && ! empty( $var_price ) ) { 892 $var_recalc_prices[] = $var_price / floatval( $units ); 893 } 894 } 895 if ( isset( $var_recalc_prices ) && ! empty( $var_recalc_prices ) ) { 896 $hide_max = get_option( '_mcmp_ppu_var_hide_max_price' ) == 'yes' ? true : false; 897 asort( $var_recalc_prices ); 898 $variable_price_min = reset( $var_recalc_prices ); 899 $variable_price_min = $this->price_ratio_calc( $variable_price_min, $prod_id ); 900 if ( true == $round_prices ) { 901 $variable_price_min = round( $variable_price_min, $wc_decimals ); 902 } else { 903 $variable_price_min = $this->truncate_number( $variable_price_min, $wc_decimals ); 904 } 905 $recalc_price = wc_price( $variable_price_min ); 906 if ( false == $hide_max ) { 907 $variable_price_max = end( $var_recalc_prices ); 908 $variable_price_max = $this->price_ratio_calc( $variable_price_max, $prod_id ); 909 if ( true == $round_prices ) { 910 $variable_price_max = round( $variable_price_max, $wc_decimals ); 911 } else { 912 $variable_price_max = $this->truncate_number( $variable_price_max, $wc_decimals ); 913 } 914 if ( $variable_price_min !== $variable_price_max ) { 915 $recalc_price .= '–' . wc_price( $variable_price_max ); 916 } 917 } 918 } 919 } 920 if ( $had_filter ) { 921 add_filter( 'woocommerce_get_price_html', array( $this, 'custom_price' ), $this->hook_priority, 2 ); 922 } 923 break; 865 924 } 866 break; 867 } 868 return $price; 869 } 870 } 871 // END class mcmp_ppu 872 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || (is_multisite() && array_key_exists( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_site_option( 'active_sitewide_plugins' ) ) ) ) ) { 873 // Instantiate the class 874 $mcmp_ppu_obj = mcmp_PPU::get_instance(); 925 } 926 switch ( $behav ) { 927 case 'replace': 928 // Recalc happened - let's replace, otherwise render normal text. 929 if ( ! empty( $recalc_price ) ) { 930 $html_price = $this->render_recalc_text( $prod_id, $recalc_price ); 931 if ( 'variable' == $product_type ) { 932 // The _mcmp_ppu_var_prefix_text needs to be displayed even for the replaced price text. 933 $var_prefix_text = get_option( '_mcmp_ppu_var_prefix_text' ); 934 if ( ! empty( $var_prefix_text ) ) { 935 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText 936 $var_prefix_text = esc_html_x( $var_prefix_text, 'Variations - variable price prefix', 'woo-price-per-unit' ); 937 $var_prefix_text = '<span class="woocommerce-Price-currencySymbol amount mcmp-variable-price-prefix">' . $var_prefix_text . ' </span>'; 938 } else { 939 $var_prefix_text = ''; 940 } 941 $html_price = $var_prefix_text . $html_price; 942 } 943 } else { 944 $html_price = $this->general_price_manipulation( $prod_id, $html_price ); 945 } 946 break; 947 case 'add': 948 if ( ! empty( $html_price ) ) { 949 $html_price = $this->general_price_manipulation( $prod_id, $html_price ); 950 } 951 if ( ! empty( $recalc_price ) ) { 952 $html_price .= $this->render_recalc_text( $prod_id, $recalc_price, true ); 953 } 954 break; 955 default: 956 if ( ! empty( $html_price ) ) { 957 $html_price = $this->general_price_manipulation( $prod_id, $html_price ); 958 } 959 break; 960 } 961 return $html_price; 962 } 875 963 } 964 // END class mcmp_ppu. 965 966 if ( in_array( 'woocommerce/woocommerce.php', (array) get_option( 'active_plugins' ), true ) || ( is_multisite() && array_key_exists( 'woocommerce/woocommerce.php', (array) get_site_option( 'active_sitewide_plugins' ) ) ) ) { 967 // Instantiate the class. 968 $mcmp_ppu_obj = MCMP_PPU::get_instance(); 969 } else { 970 add_action( 971 'admin_notices', 972 function () { 973 /* translators: 1. URL link. */ 974 echo '<div class="notice notice-error is-dismissible"><p><strong>' . sprintf( esc_html__( 'Price per Unit requires WooCommerce to be installed and active. You can download %s here.', 'woo-price-per-unit' ), '<a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' ) . '</strong></p></div>'; 975 } 976 ); 977 }
Note: See TracChangeset
for help on using the changeset viewer.