Changeset 3321574
- Timestamp:
- 07/03/2025 07:18:57 AM (8 months ago)
- Location:
- inpost-international/trunk
- Files:
-
- 4 edited
-
changelog.txt (modified) (1 diff)
-
inpost-international.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
src/Helpers/Helper.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inpost-international/trunk/changelog.txt
r3291728 r3321574 3 3 ## [1.0.0] - 2025-05-12 4 4 ### Initial commit 5 - 5 6 7 ## [1.0.1] - 2025-07-03 8 ### Fix 9 - calculating of product dimensions -
inpost-international/trunk/inpost-international.php
r3291728 r3321574 5 5 * Description: InPost International to oficjalna bezpłatna aplikacja InPost dla obsługi międzynarodowej dostawy 6 6 * Tags: woocommerce, inpost, shipments 7 * Version: 1.0. 07 * Version: 1.0.1 8 8 * Tested up to: 6.8 9 9 * Requires PHP: 7.4 … … 36 36 } 37 37 38 define( 'INPOST_INTL_PLUGIN_VERSION', '1.0. 0' );38 define( 'INPOST_INTL_PLUGIN_VERSION', '1.0.1' ); 39 39 define( 'INPOST_INTL_PLUGIN_SLUG', 'inpost_international' ); 40 40 define( 'INPOST_INTL_PLUGIN_FILE', __FILE__ ); -
inpost-international/trunk/readme.txt
r3291728 r3321574 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 Requires PHP: 7.4 8 8 License: GPLv3 or later … … 73 73 == Changelog == 74 74 75 = 1.0.1 = 76 * Fix: calculating of product dimensions 77 75 78 = 1.0.0 = 76 79 * wstępne wydanie. -
inpost-international/trunk/src/Helpers/Helper.php
r3291728 r3321574 617 617 public function calculate_multiple_products_dimensions( $items ) { 618 618 619 $calculated_length = 0; 620 $calculated_width = 0; 621 $calculated_height = 0; 622 619 623 $total_weight = 0; 620 624 $total_volume = 0; … … 640 644 641 645 // Calculate dimensions to fit within 64x41x38 cm box. 642 $box_volume = 64 * 39 * 38; 643 $scale_factor = min( 1, $box_volume / $total_volume ); 644 645 $calculated_length = min( 64, $max_length * $scale_factor ); 646 $calculated_width = min( 41, $max_width * $scale_factor ); 647 $calculated_height = $total_volume / ( $calculated_length * $calculated_width ); 648 649 // Ensure height doesn't exceed 38 cm. 650 if ( $calculated_height > 38 ) { 651 $calculated_height = 38; 652 $calculated_width = min( 39, sqrt( $total_volume / ( 38 * $calculated_length ) ) ); 653 $calculated_length = $total_volume / ( 38 * $calculated_width ); 646 $box_volume = 64 * 39 * 38; 647 if ( $total_volume > 0 ) { 648 $scale_factor = min( 1, $box_volume / $total_volume ); 649 650 $calculated_length = min( 64, $max_length * $scale_factor ); 651 $calculated_width = min( 41, $max_width * $scale_factor ); 652 653 if ( $calculated_length > 0 && $calculated_width > 0 ) { 654 $calculated_height = $total_volume / ( $calculated_length * $calculated_width ); 655 656 // Ensure height doesn't exceed 38 cm. 657 if ( $calculated_height > 38 ) { 658 $calculated_height = 38; 659 $calculated_width = min( 39, sqrt( $total_volume / ( 38 * $calculated_length ) ) ); 660 $calculated_length = $total_volume / ( 38 * $calculated_width ); 661 } 662 } 654 663 } 655 664
Note: See TracChangeset
for help on using the changeset viewer.