Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: min/max display function

    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

  2. #12
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: min/max display function

    (this is my 1.56 site a work in progress) http://1stchoiceflooringservice.com/...&products_id=2
    you can see how it acts here

  3. #13
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: min/max display function

    Quote Originally Posted by jimmie View Post
    that site calculator rounds to nearest box if you put in 76 in you got 51.33, i havent found a way to make the calculator round up no matter what. it suppose to be 101.66 you have to buy by the box, and max when set still allows a customer to add more than max? from site link i sent earlier
    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...

  4. #14
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: min/max display function

    Quote Originally Posted by jimmie View Post
    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
    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...

  5. #15
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: min/max display function

    this is the calculator code from tpl_product info
    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"/>
    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.
    Last edited by jimmie; 10 Oct 2019 at 11:20 PM.

  6. #16
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: min/max display function

    Change
    Code:
    var rounded_cartons = Math.round((sqft / sold_by_sqft), 2);
    To at least:
    Code:
    var rounded_cartons = Math.ceil(sqft / sold_by_sqft);
    May need to round later if your sold by amounts are 3 or more decimals.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #17
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: min/max display function

    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...

  8. #18
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: min/max display function

    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);

  9. #19
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: min/max display function

    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

  10. #20
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: min/max display function

    Quote Originally Posted by jimmie View Post
    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);
    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...

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. v153 Styleable Min/Max/Unit/Mixed Display
    By lat9 in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 5 Aug 2017, 12:38 PM
  2. Min Unit Max alignment
    By dw08gm in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 19 Oct 2010, 03:09 PM

Bookmarks

Posting Permissions

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