@@ -1057,22 +1057,31 @@ function updateUpsale($this, event) {
10571057 const $soloSelect = $ ( `select.parameter-id-${ soloId } .surcharge-parameter` ) ;
10581058 let soloPrice = 0 ;
10591059 if ( $soloSelect . length ) {
1060- const $sel = $soloSelect . find ( ' option:selected' ) ;
1061- const raw = String ( $sel . attr ( ' data-surcharge-final-price' ) || $sel . attr ( ' data-surcharge-additional-price' ) || '' ) ;
1062- if ( raw && raw . replace ( / [ ^ 0 - 9 ] / g, '' ) !== '' ) {
1063- soloPrice = Number ( raw . replace ( / [ ^ 0 - 9 ] / g, '' ) ) ;
1060+ const $sel = $soloSelect . find ( " option:selected" ) ;
1061+ const raw = String ( $sel . attr ( " data-surcharge-final-price" ) || $sel . attr ( " data-surcharge-additional-price" ) || "" ) ;
1062+ if ( raw && raw . replace ( / [ ^ 0 - 9 ] / g, "" ) !== "" ) {
1063+ soloPrice = Number ( raw . replace ( / [ ^ 0 - 9 ] / g, "" ) ) ;
10641064 } else {
1065- const $first = $soloSelect . find ( 'option[data-surcharge-final-price]:not([value=""])' ) . filter ( function ( ) {
1066- return Number ( String ( $ ( this ) . attr ( 'data-surcharge-final-price' ) || $ ( this ) . attr ( 'data-surcharge-additional-price' ) || '0' ) . replace ( / [ ^ 0 - 9 ] / g, '' ) ) > 0 ;
1067- } ) . first ( ) ;
1065+ const $first = $soloSelect
1066+ . find ( 'option[data-surcharge-final-price]:not([value=""])' )
1067+ . filter ( function ( ) {
1068+ return (
1069+ Number (
1070+ String ( $ ( this ) . attr ( "data-surcharge-final-price" ) || $ ( this ) . attr ( "data-surcharge-additional-price" ) || "0" ) . replace ( / [ ^ 0 - 9 ] / g, "" ) ,
1071+ ) > 0
1072+ ) ;
1073+ } )
1074+ . first ( ) ;
10681075 if ( $first . length ) {
1069- soloPrice = Number ( String ( $first . attr ( 'data-surcharge-final-price' ) || $first . attr ( 'data-surcharge-additional-price' ) || '0' ) . replace ( / [ ^ 0 - 9 ] / g, '' ) ) ;
1076+ soloPrice = Number (
1077+ String ( $first . attr ( "data-surcharge-final-price" ) || $first . attr ( "data-surcharge-additional-price" ) || "0" ) . replace ( / [ ^ 0 - 9 ] / g, "" ) ,
1078+ ) ;
10701079 }
10711080 }
10721081 }
1073- const $soloPriceEl = $ ( ".parameter-wrap.parameter-" + soloId ) . find ( ' .price.price-standart' ) ;
1074- $soloPriceEl . attr ( ' data-price' , soloPrice ) ;
1075- if ( $soloPriceEl . length ) $soloPriceEl . text ( soloPrice > 0 ? NumToPrice ( soloPrice ) : ' 0 Kč' ) ;
1082+ const $soloPriceEl = $ ( ".parameter-wrap.parameter-" + soloId ) . find ( " .price.price-standart" ) ;
1083+ $soloPriceEl . attr ( " data-price" , soloPrice ) ;
1084+ if ( $soloPriceEl . length ) $soloPriceEl . text ( soloPrice > 0 ? NumToPrice ( soloPrice ) : " 0 Kč" ) ;
10761085 } else if ( value [ 0 ] === "conf2" ) {
10771086 // conf2: hide Solo box, show other box parameters (box1/box2)
10781087 const soloId = 78 ;
@@ -1084,22 +1093,31 @@ function updateUpsale($this, event) {
10841093 const $box1Select = $ ( `select.parameter-id-${ box1 } .surcharge-parameter` ) ;
10851094 let box1Price = 0 ;
10861095 if ( $box1Select . length ) {
1087- const $sel = $box1Select . find ( ' option:selected' ) ;
1088- const raw = String ( $sel . attr ( ' data-surcharge-final-price' ) || $sel . attr ( ' data-surcharge-additional-price' ) || '' ) ;
1089- if ( raw && raw . replace ( / [ ^ 0 - 9 ] / g, '' ) !== '' ) {
1090- box1Price = Number ( raw . replace ( / [ ^ 0 - 9 ] / g, '' ) ) ;
1096+ const $sel = $box1Select . find ( " option:selected" ) ;
1097+ const raw = String ( $sel . attr ( " data-surcharge-final-price" ) || $sel . attr ( " data-surcharge-additional-price" ) || "" ) ;
1098+ if ( raw && raw . replace ( / [ ^ 0 - 9 ] / g, "" ) !== "" ) {
1099+ box1Price = Number ( raw . replace ( / [ ^ 0 - 9 ] / g, "" ) ) ;
10911100 } else {
1092- const $first = $box1Select . find ( 'option[data-surcharge-final-price]:not([value=""])' ) . filter ( function ( ) {
1093- return Number ( String ( $ ( this ) . attr ( 'data-surcharge-final-price' ) || $ ( this ) . attr ( 'data-surcharge-additional-price' ) || '0' ) . replace ( / [ ^ 0 - 9 ] / g, '' ) ) > 0 ;
1094- } ) . first ( ) ;
1101+ const $first = $box1Select
1102+ . find ( 'option[data-surcharge-final-price]:not([value=""])' )
1103+ . filter ( function ( ) {
1104+ return (
1105+ Number (
1106+ String ( $ ( this ) . attr ( "data-surcharge-final-price" ) || $ ( this ) . attr ( "data-surcharge-additional-price" ) || "0" ) . replace ( / [ ^ 0 - 9 ] / g, "" ) ,
1107+ ) > 0
1108+ ) ;
1109+ } )
1110+ . first ( ) ;
10951111 if ( $first . length ) {
1096- box1Price = Number ( String ( $first . attr ( 'data-surcharge-final-price' ) || $first . attr ( 'data-surcharge-additional-price' ) || '0' ) . replace ( / [ ^ 0 - 9 ] / g, '' ) ) ;
1112+ box1Price = Number (
1113+ String ( $first . attr ( "data-surcharge-final-price" ) || $first . attr ( "data-surcharge-additional-price" ) || "0" ) . replace ( / [ ^ 0 - 9 ] / g, "" ) ,
1114+ ) ;
10971115 }
10981116 }
10991117 }
1100- const $box1PriceEl = $ ( ".parameter-wrap.parameter-" + box1 ) . find ( ' .price.price-standart' ) ;
1101- $box1PriceEl . attr ( ' data-price' , box1Price ) ;
1102- if ( $box1PriceEl . length ) $box1PriceEl . text ( box1Price > 0 ? NumToPrice ( box1Price ) : ' 0 Kč' ) ;
1118+ const $box1PriceEl = $ ( ".parameter-wrap.parameter-" + box1 ) . find ( " .price.price-standart" ) ;
1119+ $box1PriceEl . attr ( " data-price" , box1Price ) ;
1120+ if ( $box1PriceEl . length ) $box1PriceEl . text ( box1Price > 0 ? NumToPrice ( box1Price ) : " 0 Kč" ) ;
11031121 }
11041122 }
11051123 // Delay for price update
0 commit comments