Html - CSS - XML - JavaScript - Ajax
Javascript Ürün Arttırma-Fiyat Katlama Sorunu
Javascript Ürün Arttırma-Fiyat Katlama Sorunu
-
Hocalar iyi akşamlar. Elimde bir iş var. Bir mobilya mağazası web sitesi yapıyorum ancak bir konuda ufak bir sorunum var.
Ürünler paket halinde satılıyor ( 3lü koltuk+televizyon sehpası+dolap gibi)
Her ürünün asıl fiyatı ve indirimli halleri var girilmiş durumda.
3lü koltuk 3000
Televizyon sehpası 2000
dolap 1000 iken
üçünü paket halinde alırsanız 5500 tl yapıyor mesela. Her ürüne belli bir % ile indirim uygulanıyor.
Siteye kullanan kişi 2 adet sehpa almak istiyorum diye +'ya tıkladığı zaman aşağıdaki toplam fiyat etiketi cortluyor. Script kısmını buraya ekledim. Görsel isteyen olursa site arayüzü için onu da paylaşabilirim. Sorunu nasıl aratacağımı bilemediğim için çözümü de bulamadım. Kodların çoğunu benzer bir siteden çektim yerel bir firma olduğu için işini yaptığım firma. Çok anlamıyorum yani :)
<script> (function(n,t,i,r,u){n[r]=n[r]||[];n[r].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var e=t.getElementsByTagName(i)[0],f=t.createElement(i),o=r!="dataLayer"?"&l="+r:"";f.async=!0;f.src="https://www.googletagmanager.com/gtm.js?id="+u+o;e.parentNode.insertBefore(f,e)})(window,document,"script","dataLayer","GTM-NVL6GHP") </script> <script type="text/javascript"> var ts = 1; function incBinary(){ quantity = document.getElementById("tripleQuantity"); quantity.value = ts; ts++; price = document.getElementById("triplePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value + (quantity.value * price.value); } function decBinary(){ quantity = document.getElementById("tripleQuantity"); quantity.value = ts; ts--; price = document.getElementById("triplePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value - (quantity.value * price.value); } </script> <script type="text/javascript"> var bs = 1; function incBinary(){ quantity = document.getElementById("binaryQauntity"); quantity.value = bs; bs++; price = document.getElementById("binaryPrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value + (quantity.value * price.value); } function decBinary(){ quantity = document.getElementById("binaryQauntity"); quantity.value = bs; bs--; price = document.getElementById("binaryPrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value - (quantity.value * price.value); } </script> <script type="text/javascript"> var ss = 1; function incSingle(){ quantity = document.getElementById("singleQuantity"); quantity.value = ss; ss++; price = document.getElementById("singlePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value + (quantity.value * price.value); } function decSingle(){ quantity = document.getElementById("singleQuantity"); quantity.value = ss; ss--; price = document.getElementById("singlePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value - (quantity.value * price.value); } </script>
Şimdiden teşekkür ediyorum herkeseEdit. Görünümü fotoğraf linki olarak bıraktım aşağıya. Butona tıklayınca cortluyor aşağıdaki toplamların hepsi 0 oluyor
https://hizliresim.com/mBUM8t
Mutubilir tarafından 20/May/20 04:02 tarihinde düzenlenmiştir -
resim bulunamadi diyor.
-
toplam fiyat nerede cortluyor baktım baktım göremedim hocam :/
-
<script type="text/javascript"> var ts = 1; function incBinary(){ quantity = document.getElementById("tripleQuantity"); ts++; quantity.value = ts; price = document.getElementById("triplePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value + (quantity.value * price.value); } function decBinary(){ quantity = document.getElementById("tripleQuantity"); ts--; quantity.value = ts; price = document.getElementById("triplePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value - (quantity.value * price.value); } </script> <script type="text/javascript"> var bs = 1; function incBinary(){ quantity = document.getElementById("binaryQauntity"); bs++; quantity.value = bs; price = document.getElementById("binaryPrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value + (quantity.value * price.value); } function decBinary(){ quantity = document.getElementById("binaryQauntity"); bs--; quantity.value = bs; price = document.getElementById("binaryPrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value - (quantity.value * price.value); } </script> <script type="text/javascript"> var ss = 1; function incSingle(){ quantity = document.getElementById("singleQuantity"); quantity.value = ss; ss++; price = document.getElementById("singlePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value + (quantity.value * price.value); } function decSingle(){ quantity = document.getElementById("singleQuantity"); ss--; quantity.value = ss; price = document.getElementById("singlePrice"); totalPrice = document.getElementById("totalDiscountPrice"); totalPrice.value = totalPrice.value - (quantity.value * price.value); } </script>
dener misin hocam bi?
-
deneyip döneceğim hocam