dreampho Posted June 16, 2011 Share Posted June 16, 2011 Hi All. I have a quoter built out of PHP that takes a custom size, and shows a price depending on which of five price groups the print is in. The quoter is finding the custom price, but for example, if I enter 1 x 1, the price should be £9.20, instead the price displays £9.00. For each of the custom prices, it does not show the 'pence' just the 'pound'. If you input a default size instead of custom size A3 you see it displays £9.20. in the database I have checked and both tables have the correct price of £9.20. You can try it yourself here: http://chrisdavieswebdesign.com/ I have attached the document to this thread. I will be very greatful if someone can check my code to see if there is something wrong. Thanks!! Chris [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/239580-quoter-php-problem/ Share on other sites More sharing options...
fugix Posted June 16, 2011 Share Posted June 16, 2011 would you mind posting the code to this thread please Quote Link to comment https://forums.phpfreaks.com/topic/239580-quoter-php-problem/#findComment-1230713 Share on other sites More sharing options...
dreampho Posted June 16, 2011 Author Share Posted June 16, 2011 Yes, no problem, here is the entire document: <?php session_start(); require_once('config.php'); ?> <script language="javascript"> function makeDisable1q(){ if(document.Quoter.print_size.value != "" && document.Quoter.custom_length.value.length == 0 && document.Quoter.custom_width.value.length == 0){ document.Quoter.custom_length.disabled=true; document.Quoter.custom_width.disabled=true; }else if(document.Quoter.print_size.value == ""){ document.Quoter.custom_length.disabled=false; document.Quoter.custom_width.disabled=false; } } function makeDisable2q(){ if(document.Quoter.print_size.value == "" && (document.Quoter.custom_length.value.length > 0 || document.Quoter.custom_width.value.length > 0)){ document.Quoter.print_size.disabled=true; } if(document.Quoter.custom_length.value.length == 0 && document.Quoter.custom_width.value.length == 0){ document.Quoter.print_size.disabled=false; } if(parseInt(document.Quoter.custom_width.value) > 60){ document.Quoter.custom_width.value = 60; } if(parseInt(document.Quoter.custom_width.value) < 1 || isNaN(document.Quoter.custom_width.value)){ document.Quoter.custom_width.value = 1; } if(parseInt(document.Quoter.custom_length.value) > 35){ document.Quoter.custom_length.value = 35; } if(parseInt(document.Quoter.custom_length.value) > 35 || isNaN(document.Quoter.custom_length.value)){ document.Quoter.custom_length.value = 1; } } function getTotalq() { if((document.Quoter.print_size.value != "" || (document.Quoter.custom_length.value.length > 0 && document.Quoter.custom_width.value.length > 0)) && document.Quoter.paper_type.value != "" && document.Quoter.quantity.value != ""){ if(document.Quoter.print_size.value != "") { <?php $sqls = "select * from size"; $rsts = mysql_query($sqls); while($rows = mysql_fetch_object($rsts)): ?> if(document.Quoter.print_size.value == "<?=$rows->name?>") var amount = parseFloat(<?=$rows->price?>); <?php endwhile; ?> } else { <?php $sqls = "select * from custom_size"; $rsts = mysql_query($sqls); $rows = mysql_fetch_object($rsts); ?> if((parseInt(document.Quoter.custom_width.value) >= 1 && parseInt(document.Quoter.custom_width.value) <= 17 && parseInt(document.Quoter.custom_length.value) >= 1 && parseInt(document.Quoter.custom_length.value) <= 12) || (parseInt(document.Quoter.custom_width.value) >= 1 && parseInt(document.Quoter.custom_width.value) <= 12 && parseInt(document.Quoter.custom_length.value) >= 1 && parseInt(document.Quoter.custom_length.value) <= 17)){ var amount = parseInt(<?=$rows->custom_1?>); } if((parseInt(document.Quoter.custom_width.value) >= 18 && parseInt(document.Quoter.custom_width.value) <= 24 && parseInt(document.Quoter.custom_length.value) >= 1 && parseInt(document.Quoter.custom_length.value) <= 17) || (parseInt(document.Quoter.custom_width.value) >= 13 && parseInt(document.Quoter.custom_width.value) <= 24 && parseInt(document.Quoter.custom_length.value) >= 13 && parseInt(document.Quoter.custom_length.value) <= 17) || (parseInt(document.Quoter.custom_width.value) >= 1 && parseInt(document.Quoter.custom_width.value) <= 17 && parseInt(document.Quoter.custom_length.value) >= 18 && parseInt(document.Quoter.custom_length.value) <= 24) || (parseInt(document.Quoter.custom_width.value) >= 13 && parseInt(document.Quoter.custom_width.value) <= 17 && parseInt(document.Quoter.custom_length.value) >= 13 && parseInt(document.Quoter.custom_length.value) <= 24)){ var amount = parseInt(<?=$rows->custom_2?>); } if((parseInt(document.Quoter.custom_width.value) >= 1 && parseInt(document.Quoter.custom_width.value) <= 24 && parseInt(document.Quoter.custom_length.value) >= 25 && parseInt(document.Quoter.custom_length.value) <= 35) || (parseInt(document.Quoter.custom_width.value) >= 18 && parseInt(document.Quoter.custom_width.value) <= 24 && parseInt(document.Quoter.custom_length.value) >= 18 && parseInt(document.Quoter.custom_length.value) <= 35) || (parseInt(document.Quoter.custom_width.value) >= 18 && parseInt(document.Quoter.custom_width.value) <= 34 && parseInt(document.Quoter.custom_length.value) >= 18 && parseInt(document.Quoter.custom_length.value) <= 24) || (parseInt(document.Quoter.custom_width.value) >= 25 && parseInt(document.Quoter.custom_width.value) <= 34 && parseInt(document.Quoter.custom_length.value) >= 1 && parseInt(document.Quoter.custom_length.value) <= 24)){ var amount = parseInt(<?=$rows->custom_3?>); } if((parseInt(document.Quoter.custom_width.value) >= 25 && parseInt(document.Quoter.custom_width.value) <= 47 && parseInt(document.Quoter.custom_length.value) >= 25 && parseInt(document.Quoter.custom_length.value) <= 35) || (parseInt(document.Quoter.custom_width.value) >= 35 && parseInt(document.Quoter.custom_width.value) <= 47 && parseInt(document.Quoter.custom_length.value) >= 1 && parseInt(document.Quoter.custom_length.value) <= 35)){ var amount = parseInt(<?=$rows->custom_4?>); } if((parseInt(document.Quoter.custom_width.value) >= 48 && parseInt(document.Quoter.custom_width.value) <= 60 && parseInt(document.Quoter.custom_length.value) >= 1 && parseInt(document.Form.custom_length.value) <= 35)){ var amount = parseInt(<?=$rows->custom_5?>); } } var quantity = parseInt(document.Quoter.quantity.value); var total = Math.round(quantity*amount*100)/100; <?php if(isset($_SESSION['uid'])): ?> var off = total*0.1; total = total - off; <?php endif; ?> document.getElementById('price').innerHTML = '£' + total.toFixed(2); }else { document.getElementById('price').innerHTML = '£0.00'; } } </script> <div class="quote_text"> <img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/graphics/get_quote.gif" /> </div> <form class="transform" method="post" name="Quoter" id="Quoter"> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <select class="nojavascript_quoter" name="paper_type" id="paper_type" onChange="getTotalq();"> <option value="">Paper Type</option> <?php $sqls = "select * from types"; $rsts = mysql_query($sqls); while($rows = mysql_fetch_object($rsts)): ?> <option value="<?=$rows->name?>"> <?=$rows->name?> </option> <?php endwhile; ?> </select> </td> <td> <select class="nojavascript_quoter" name="print_size" id="print_size" onChange="makeDisable1q(); getTotalq();" > <option value="">Print Size</option> <?php $sqls = "select * from size"; $rsts = mysql_query($sqls); while($rows = mysql_fetch_object($rsts)): ?> <option class="nojavascript_quoter" value="<?=$rows->name?>"> <?=$rows->name?> </option> <?php endwhile; ?> </select> </td> <td> <span class="quoter_text">or</span> </td> <td> <input class="nojavascript_quoter" name="custom_width" type="text" id="custom_width" onblur="makeDisable2q(); getTotalq();" onkeydown="makeDisable2q(); getTotalq();" onkeyup="makeDisable2q(); getTotalq();" size="2" /> </td> <td> <span class="quoter_text">x</span> </td> <td> <input class="nojavascript_quoter" name="custom_length" type="text" id="custom_length" onblur="makeDisable2q(); getTotalq();" onkeydown="makeDisable2q(); getTotalq();" onkeyup="makeDisable2q(); getTotalq();" size="2" /> </td> <td> <span class="quoter_text">inches</span> </td> <td> <select class="nojavascript_quoter" name="quantity" id="quantity" onchange="getTotalq();"> <option value="">Qty</option> <?php for($i=1; $i<10; $i++): ?> <option value="<?=$i?>"><?=$i?></option> <?php endfor; ?> </select> </td> <td><span class="quoter_text" id="price">£0.00</span></td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/239580-quoter-php-problem/#findComment-1230715 Share on other sites More sharing options...
redixx Posted June 16, 2011 Share Posted June 16, 2011 would you mind posting the code to this thread please He did, via attachment. Here: EDIT: nevermind, he just posted it. Quote Link to comment https://forums.phpfreaks.com/topic/239580-quoter-php-problem/#findComment-1230716 Share on other sites More sharing options...
fugix Posted June 16, 2011 Share Posted June 16, 2011 yes, but the majority of people on here dont bother opening attachments, so he has a better chance of getting his question answered if the script is directly on the thread. Quote Link to comment https://forums.phpfreaks.com/topic/239580-quoter-php-problem/#findComment-1230731 Share on other sites More sharing options...
dreampho Posted June 16, 2011 Author Share Posted June 16, 2011 Do anyone have any ideas? I am so stuck! Quote Link to comment https://forums.phpfreaks.com/topic/239580-quoter-php-problem/#findComment-1230764 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.