Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function priceUpdate() {
- var varations = JSON.parse( $( '.variations_form' ).attr( 'data-product_variations' ) );
- var selectedMaterialName = $('.tpk-material-icons li.selected').data().material
- var pricePerMeter = varations.find(el => el.attributes['attribute_rodzaj-materialu'] === selectedMaterialName).display_price;
- var photoPrice = $( '#fotolia-photo-price' ).val();
- var $price = $( '.tpk-single-price-span' );
- var widthVal = $( '#single-product-img-dim-w' ).val();
- var heightVal = $( '#single-product-img-dim-h' ).val();
- // var area = Math.round( ( widthVal * heightVal ) / 100 ) / 100;
- var area = (widthVal * heightVal / 10000 );
- $( '#image-area' ).val( area );
- var newPrice = Math.round( ( area * pricePerMeter + parseFloat( photoPrice ) ) * 100 ) / 100;
- if(area < 1) {
- newPrice = pricePerMeter;
- }
- $price.html( newPrice + ' zł' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement