Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Plugin Contributions

    Default Length calculator???

    I have a product of fence screen that has price by foot.
    The customer has to add the length in feet and inches into a text box and when they hit submit it must be figured into the price output.
    Is there a module that might do this?

    Also they must be able to add new sections of length.

    All this was working on a previous site before I took it over and it seems to be using this code. Does anyone know what module this might be? How would I set it up? (all the old files are still on the old server which I have access to, but I can't seem to figure which go to what.)
    Thanks in advance.
    (this was in head)
    <script type="text/javascript" language="javascript">
    var optionPrices = new Array();
    $(document).ready(function () {
    var productsId = $('#productsId').val();
    var nextSection = parseInt($('#totalSections').val()) + 1;
    $('#fenceSections').append('<tr class="widthEntry"><td><input type="text" name="widthFeet['+nextSection+']" size="3" onkeyup="calculateTotal()" class="widthFeet" /></td><td><input type="text" name="widthInches['+nextSection+']" size="3" onkeyup="calculateTotal()" class="widthInches" /></td></tr>');
    $('.wrapperAttribsOptions').find("select").each(function() {
    $(this).change( function () {calculateTotal();} );

    $('option', $(this)).each(function(){
    // loop thru options
    var optionValue = $(this).val();
    $.get("ajax.php", { action: 'get.option.price',
    products_id: productsId,
    options_values_id: optionValue },
    function(data, textStatus){
    if (data['price'] != undefined) {
    optionPrices[data['options_values_id']] = parseFloat(data['price']);

    function calculateTotal() {
    var pricePerFoot = parseFloat(optionPrices[$('#attrib-9').val()]);
    var totalFeet = 0;
    var cutChargeAdded = false;
    if ($(this).val() != '') {
    var currentTotal = parseFloat($('#total').val());
    var currentLength = parseInt($('#totalLength').val());
    if (parseInt($(this).val()) % 50 != 0) {
    if (cutChargeAdded == false) { cutChargeAdded = true; currentTotal += 20; }
    $('#customCutText').show(); $('#customCut').val(1);
    var newTotal = currentTotal + parseFloat(pricePerFoot * parseInt($(this).val()));
    var newLength = currentLength + (parseInt($(this).val())*12);
    //alert(pricePerFoot + ': ' + currentTotal + ': ' + newTotal);
    if ($(this).val() != '') {
    var currentTotal = parseFloat($('#total').val());
    var currentLength = parseInt($('#totalLength').val());
    if (cutChargeAdded == false) { cutChargeAdded = true; currentTotal += 20; }
    var newTotal = currentTotal + parseFloat((pricePerFoot/12) * parseInt($(this).val()));
    var newLength = currentLength + (parseInt($(this).val()));


    var curTxt = $('#attrib-6-0').val();
    curTxt += $('.widthFeet',this).val()+'FT '+$('.widthInches',this).val()+'IN, ';
    (this in body)

    <div class="wrapperAttribsOptions">
    <h4 class="optionName back">Length Options</h4>
    <div class="back">
    <input type="radio" name="id[8]" value="31" id="attrib-8-31" /><label class="attribsRadioButton zero" for="attrib-8-31">Custom Length - Cut Charge ( $20.00 )</label><br />
    <input type="radio" name="id[8]" value="32" id="attrib-8-32" /><label class="attribsRadioButton zero" for="attrib-8-32">Standard 50' Rolls - No Cut Charge</label><br />

    <br class="clearBoth" />

    <br class="clearBoth" />

    </div><div id="lengthname">Enter Your Fencing Widths</div>
    <div id="lengthdescription">Enter the feet and inches of each section you require for your project. You can add as many new sections as you need. </div>
    <input type="hidden" name="totalSections" id="totalSections" value="1" />
    <input type="hidden" name="totalLength" id="totalLength" value="0" />
    <table id="fenceSections">
    <tr class="widthEntry"><td><input type="text" name="widthFeet[1]" size="3" onkeyup="javascript:calculateTotal()" class="widthFeet" /></td><td><input type="text" name="widthInches[1]" size="3" onkeyup="javascript:calculateTotal()" class="widthInches" /></td></tr>
    <a href="#" onclick="return false;" id="addSectionLink"><u>click here to add a new section</u></a>
    <br /><br />

    <span id="customCutText" style="display:none;">Custom Cut Charge: $20.00<br /></span>
    <input type="hidden" name="customCut" value="0" id="customCut" />

    <b>Total Price: $<span id="totalText">0.00</span></b>
    <input type="hidden" name="total" value="0.00" id="total" />
    <br />
    <br />
    <!--eof Attributes Module -->

    <!--bof Quantity Discounts table -->
    <!--eof Quantity Discounts table -->

    <div id="cartAdd">
    <input type="hidden" name="cart_quantity" value="1" /><input type="hidden" name="products_id" value="87" id="productsId" /><input type="image" src="includes/templates/eprivacy/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " /> </div>
    <!--eof Add to Cart Box-->


  2. #2
    Join Date
    Jun 2005
    Hertfordshire, UK
    Plugin Contributions

    Default Re: Length calculator???

    I know that Scott Wilson (SWGUY) has worked on things like this. He's probably the best person to deal with your request.
    We host with Terranetwork.



Similar Threads

  1. v151 Pricing calculator?
    By tauro91 in forum General Questions
    Replies: 1
    Last Post: 19 Apr 2013, 10:14 PM
  2. v139h Shipping Calculator
    By aditya369 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 3 Feb 2012, 10:51 AM
  3. Shipping Calculator
    By Kalebsands in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 7 May 2009, 09:08 PM
  4. Distance Calculator?
    By Astarkley in forum General Questions
    Replies: 0
    Last Post: 23 Nov 2007, 11:24 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Zen-Cart, Internet Selling Services, Klamath Falls, OR