im sorry i just looked again and my settings are min is set at 14.33 and units are set at 14.33 and max is set at 0 but when they click up goes to 15
im sorry i just looked again and my settings are min is set at 14.33 and units are set at 14.33 and max is set at 0 but when they click up goes to 15
(this is my 1.56 site a work in progress) http://1stchoiceflooringservice.com/...&products_id=2
you can see how it acts here
If I picked a quantity of say 80, then it did round up.
Note that as a result of this discussion, I've opened an issue on GitHub to address such a rounding issue. In PHP I found that it was possible to identify the next value that fit the units requirement by the following "math": unit * ceil(min/unit) where the minimum exceeded the units. In this situation minimum would be replaced with the square footage entered by the purchaser.
A similar function exists in javascript as well.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Part of the issue with the rounding may have to do with the number of decimals allowed for product which is a setting in the admin configuration section. I don't recall if it is in the stock section or my store section... it may also have to do with whatever incremental unit is applied to the arrow button(s). I haven't yet looked at the page link that was provided.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
this is the calculator code from tpl_product info
but this isnt quite working yet on new site, since css/jloader modified my html it nolonger functions with java script, where im stuck, only two mods left to install out of 25 total, just got to get past this calculator not working.Code:<?php } else if ($calculator == 2) { ?> <script> $(function () { $("#SquareFeetInput").keyup(function () { var sqft = $(this).val(); var sold_by = $('#sol_by').val(); if (sold_by == '' || sold_by == 'NaN' || sold_by == '1') { var sold_by_sqft = 27.64; } else { var sold_by_sqft = sold_by; } var rounded_cartons = Math.round((sqft / sold_by_sqft), 2); var total_sqft = rounded_cartons * sold_by_sqft; $('#ho_cartons').text(rounded_cartons); $('#cart_val').val(total_sqft.toFixed(2)); $('#sqft_val').val(total_sqft.toFixed(2)); $('#needed_sqft').text(total_sqft.toFixed(2)); var cart_price = sold_by_sqft * $('#price_ori').val(); $('#carton_price').text("$" + cart_price.toFixed(2)); var total_price = total_sqft * $('#price_ori').val(); var total_price = total_price.toFixed(2); $('.t_price').html('$' + total_price); }); }) </script> <span class="half-width"><b>Enter Square Feet Needed:</b></span> <input type="text" id="SquareFeetInput" required="" class="input-text" name="sqft_v" autocomplete="off" maxlength="8" size="25"/><input type="hidden" id="sqft_val" required="" class="input-text" name="sqft" autocomplete="off"/></span><br><br> <span class="half-width"><b>Sq. Ft. Required:</b></span><span id="needed_sqft" class="pull-right">0</span><br><br> <span class="half-width"><b>Cartons Needed:</b></span> <span class="pull-right" id="ho_cartons"></span><br><br> <input type="hidden" value="<?php echo zen_get_buy_now_qty($_GET['products_id']) ?>" id="sol_by"/>
Last edited by jimmie; 10 Oct 2019 at 11:20 PM.
Change
To at least:Code:var rounded_cartons = Math.round((sqft / sold_by_sqft), 2);
May need to round later if your sold by amounts are 3 or more decimals.Code:var rounded_cartons = Math.ceil(sqft / sold_by_sqft);
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
As far as the +/- thing, I can't from my cell phone right now figure out what is providing the increase/decrease functionality to be able to advise on what to change/adjust. I don't see any specific javascript or jQuery that is affecting the numbers. Perhaps someone at a computer could follow the javascript bouncing ball...
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Code:// show the quantity box $the_button = ' <div class="max-qty">' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '</div> <div class="crt-rw"> <div class="qty-input-wra"> <span class="qty-text">' . PRODUCTS_QTY_TEXT . '</span> <div class="qty-wra spplus-minus"> <span class="spplus-minus sp-minus"><i class="material-icons">remove</i></span> <span class="qty-input cart-box"> <input type="text" name="cart_quantity" value="' . $products_get_buy_now_qty . '" maxlength="6" size="4" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']).' </span> <span class="sp-plus"><i class="material-icons">add</i></span> </div> </div>'. '<div class="cart-btn"> <button class="submit_button button btn button2"><i class="material-icons">shopping_cart</i><span class="text">'.BUTTON_IN_CART_ALT.'</span></button> </div> <div class="product-extra-link">'.(($wishlist_link!='' || $compare_link!='')? '<ul class="product-link">'.$wishlist_link.$compare_link.'</ul>' : '').'</div> </div> '; } $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
when i replace html file with original than calculator works again but css is mess up, how do i find what is running that function, to make a loader
That's the PHP code that generates the html; however, not specifically the code that gets executed when clicking on the plus or minus buttons that cause the addition/subtraction of a quantity of 1 from the total.
As far as the page properly responding to actions, there does seem to be a few likely pertinent html validation errors which could contribute to why the calculator is not operating. Here is the link to the validator: https://validator.w3.org/nu/?doc=htt...roducts_id%3D2
There are some tags that are not closed in the proper sequence.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Bookmarks