Changeset 3147354
- Timestamp:
- 09/06/2024 05:38:13 AM (19 months ago)
- Location:
- weight-based-pricing-for-woocommerce/trunk
- Files:
-
- 5 edited
-
App/Controllers/Frontend/CartAdjustments.php (modified) (2 diffs)
-
App/Views/Admin/PricingRule.php (modified) (2 diffs)
-
i18n/languages/weight-based-pricing-woocommerce.pot (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
weight-based-pricing-woocommerce.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
weight-based-pricing-for-woocommerce/trunk/App/Controllers/Frontend/CartAdjustments.php
r2972088 r3147354 168 168 { 169 169 $data = get_post_meta($product_id, 'wwbp_pricing_rule', false); 170 if(isset($data[0]) && !empty($data[0])){ 171 $pricing_rules = $data[0]; 172 }else { 173 $pricing_rules = []; 174 } 175 176 $i = 0; 177 $rules = []; 178 foreach ($pricing_rules as $pricing_rule) { 179 $rules[$i] = $pricing_rule; 180 $i++; 181 } 182 183 $special_price = 0; 184 for ($i = 0; $i < count($rules); $i++) { 170 if (isset($data[0]) && !empty($data[0])) { 171 $pricing_rules = $data[0]; 172 } else { 173 $pricing_rules = []; 174 } 175 176 $i = 0; 177 $rules = []; 178 foreach ($pricing_rules as $pricing_rule) { 179 $rules[$i] = $pricing_rule; 180 $i++; 181 } 182 183 $special_price = 0; 184 for ($i = 0; $i < count($rules); $i++) { 185 // Ensure 'wwbp_to_weight' and 'wwbp_from_weight' are present 186 if (isset($rules[$i]['wwbp_from_weight']) && isset($rules[$i]['wwbp_to_weight'])) { 185 187 $from_weight = (float) $rules[$i]['wwbp_from_weight']; 186 188 $to_weight = (float) $rules[$i]['wwbp_to_weight']; … … 190 192 } 191 193 } 192 193 if (0 < $special_price && $special_price < $product_price) { 194 $custom_price = $special_price * $weight_qty; 195 } else { 196 $custom_price = $product_price * $weight_qty; 197 } 198 199 return (float) number_format($custom_price, wc_get_price_decimals(), '.', ''); 194 } 195 196 if (0 < $special_price && $special_price < $product_price) { 197 $custom_price = $special_price * $weight_qty; 198 } else { 199 $custom_price = $product_price * $weight_qty; 200 } 201 202 return (float) number_format($custom_price, wc_get_price_decimals(), '.', ''); 200 203 } 201 204 -
weight-based-pricing-for-woocommerce/trunk/App/Views/Admin/PricingRule.php
r2972088 r3147354 114 114 { 115 115 $range_datas = $measure_ranges["$row_unique_id"]; 116 $from_range = $range_datas['wwbp_from_weight']; 117 $to_range = $range_datas['wwbp_to_weight']; 118 $unit_price = $range_datas['wwbp_unit_price']; 119 $sale_price = $range_datas['wwbp_sale_price']; 116 $from_range = isset($range_datas['wwbp_from_weight']) ? $range_datas['wwbp_from_weight'] : ''; 117 $to_range = isset($range_datas['wwbp_to_weight']) ? $range_datas['wwbp_to_weight'] : ''; 118 $unit_price = isset($range_datas['wwbp_unit_price']) ? $range_datas['wwbp_unit_price'] : ''; 119 $sale_price = isset($range_datas['wwbp_sale_price']) ? $range_datas['wwbp_sale_price'] : ''; 120 120 121 } 121 122 } … … 158 159 { 159 160 $range_datas = $measure_ranges["$row_unique_id"]; 160 $from_range = $range_datas['wwbp_from_weight']; 161 $to_range = $range_datas['wwbp_to_weight']; 162 $unit_price = $range_datas['wwbp_unit_price']; 163 $sale_price = $range_datas['wwbp_sale_price']; 161 $from_range = isset($range_datas['wwbp_from_weight']) ? $range_datas['wwbp_from_weight'] : ''; 162 $to_range = isset($range_datas['wwbp_to_weight']) ? $range_datas['wwbp_to_weight'] : ''; 163 $unit_price = isset($range_datas['wwbp_unit_price']) ? $range_datas['wwbp_unit_price'] : ''; 164 $sale_price = isset($range_datas['wwbp_sale_price']) ? $range_datas['wwbp_sale_price'] : ''; 165 164 166 } 165 167 } -
weight-based-pricing-for-woocommerce/trunk/i18n/languages/weight-based-pricing-woocommerce.pot
r2808455 r3147354 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Weight Based Pricing for WooCommerce 1.1. 4\n"5 "Project-Id-Version: Weight Based Pricing for WooCommerce 1.1.6\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/weight-based-pricing-for-woocommerce\n" 7 7 "Last-Translator: Anantharaj <anantharaj@w3cert.in>\n" -
weight-based-pricing-for-woocommerce/trunk/readme.txt
r2972088 r3147354 5 5 Requires at least: 4.9.0 6 6 Requires PHP: 5.6 7 Tested up to: 6. 38 Stable tag: 1.1. 57 Tested up to: 6.6.1 8 Stable tag: 1.1.6 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 58 58 == Changelog == 59 59 60 = 1.1.6 - 05/09/2024 61 * Improvement - HPOS Compatibility added 62 * Fix - Undefined Variable Errors 63 60 64 = 1.1.5 - 25/09/2023 = 61 * Fix -PHP Deprecated Function Errors and Functional Improvements65 * Fix – PHP Deprecated Function Errors and Functional Improvements 62 66 63 67 = 1.1.4 - 31/10/2022 = -
weight-based-pricing-for-woocommerce/trunk/weight-based-pricing-woocommerce.php
r2972088 r3147354 4 4 * Plugin URI: https://www.themeparrot.com/ 5 5 * Description: Weight Based Product Pricing for WooCommerce helps you to set product price based on the weight. 6 * Version: 1.1. 56 * Version: 1.1.6 7 7 * Author: Themeparrot 8 8 * Author URI: https://themeparrot.com/ … … 12 12 * Requires PHP: 5.6 13 13 * WC requires at least: 3.0.0 14 * WC tested up to: 8.1.114 * WC tested up to: 9.2.3 15 15 * License: GNU General Public License v3.0 16 16 * License URI: http://www.gnu.org/licenses/gpl-3.0.html 17 * 18 * WC HPOS Compatibility: yes 17 19 */ 18 20 … … 21 23 // This plugin constants 22 24 defined('WWBP_PLUGIN_NAME') or define('WWBP_PLUGIN_NAME', 'Weight Based Pricing for WooCommerce'); 23 defined('WWBP_PLUGIN_VERSION') or define('WWBP_PLUGIN_VERSION', '1.1. 5');25 defined('WWBP_PLUGIN_VERSION') or define('WWBP_PLUGIN_VERSION', '1.1.6'); 24 26 25 27 defined('WWBP_PLUGIN_FILE') or define('WWBP_PLUGIN_FILE', __FILE__); … … 40 42 require_once WWBP_PLUGIN_PATH . '/vendor/autoload.php'; 41 43 new WWBP\App\Boot(); // Start Plugin 44 45 add_action( 'before_woocommerce_init', function() { 46 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 47 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 48 } 49 } );
Note: See TracChangeset
for help on using the changeset viewer.