Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2023
    Location
    UK
    Posts
    27
    Plugin Contributions
    0

    Default Displaying A Plus + and Minus - Button On The Actual Product Page

    Would anybody know how we could apply a plus + and minus - button / box next to the add to cart button on the actual product pages on Zencart, so that customers can easily select the desired quantity for any given product?

    Kind Regards,

    Andy

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

    Default Re: Displaying A Plus + and Minus - Button On The Actual Product Page

    i have this in tpl_product info
    Code:
    if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
    							  // hide the quantity box and default to 1
    							  $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
    							} else {
    							// 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);
    might be more to it than copy and pasting

  3. #3
    Join Date
    Apr 2023
    Location
    UK
    Posts
    27
    Plugin Contributions
    0

    Default Re: Displaying A Plus + and Minus - Button On The Actual Product Page

    Thanks Jimmie,

    I think there's going to be a bit more than cutting and pasting. Out of interest would the theme that your using have a plus and minus feature already built into it? or are you using a customer plugin / module for this?

    Kind Regards,

    Andy

  4. #4
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: Displaying A Plus + and Minus - Button On The Actual Product Page

    it came built in, i can also give you the .css

  5. #5
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Displaying A Plus + and Minus - Button On The Actual Product Page

    I have the plus minus on my website

    includes/modules/pages/shopping_cart/header.php
    Code:
    	// BOF changes using script for min max	//	
    
      $quantityField = '<span style="border-top-left-radius: 2px;border-bottom-left-radius:2px;" class="min_' . str_replace(':', '', $products[$i]['id']) . ' button">-' .'</span>' . zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" name="qty" maxlength="4" id="qty"  class="cart_input_'.str_replace(':', '', $products[$i]['id']).' "'). '<span style="border-top-right-radius: 2px;border-bottom-right-radius:2px;" class="plus_' . str_replace(':', '', $products[$i]['id']) . ' button">+</span>';
    
       // EOF changes using script for min max	//
    includes/templates/theme871/templates/tpl_shopping_cart_default.php

    Code:
    <!-- script for min max -->	
     
    <?php
         for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    ?>
            <script>jQuery(function(){
      var j = jQuery; //Just a variable for using jQuery without conflicts
      var addInput = '.cart_input_<?php echo str_replace(':', '', $products[$i]['id']); ?>'; //This is the unique class identified by product's id of the input you are changing
      var n = <?php echo (empty($products[$i]['quantity']) ? '0' : $products[$i]['quantity']); ?>; //n is equal to the quantity in the cart
      //Set default value to n (n = cart quantity)
      j(addInput).val(n);
      //On click add 1 to n
      j('.plus_<?php echo str_replace(':', '', $products[$i]['id']); ?>').on('click', function(){
        j(addInput).val(++n);
      })
      j('.min_<?php echo str_replace(':', '', $products[$i]['id']); ?>').on('click', function(){
        //If n is bigger or equal to 1 subtract 1 from n
        if (n >= 1) {
          j(addInput).val(--n);
        } else {
          //Otherwise do nothing
        }
      });
    });</script>
    <?php
    }
    ?>
    	
    <!-- eof script for max -->



    includes/templates/your_template/templates/tpl_product_info_display.php
    Code:
    // show the quantity box
      $the_button = '<div class="qty-wrapper">
    
      <div class="qty-box" id="qty-box">
      <a href="#" class="btn btn-descrease" id="btn-descrease"><span class="nmn-icon-minus"></span></a>
      <input type="text" name="cart_quantity" id="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="4" size="2" /><a href="#" class="btn btn-increase" id="btn-increase"><span class="nmn-icon-plus"></span></a></div>' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '
      </div>';
      }

  6. #6
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Displaying A Plus + and Minus - Button On The Actual Product Page

    disregard
    Last edited by chadlly2003; 8 May 2023 at 07:09 PM.

 

 

Similar Threads

  1. v156 Cart Quantity plus and minus buttons on the shopping cart default page.
    By chadlly2003 in forum General Questions
    Replies: 29
    Last Post: 29 Apr 2020, 11:13 PM
  2. Attribute drop down box – RTL and plus/minus signs alignment…
    By eranariel in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 3 Jul 2011, 12:53 PM
  3. Can't take 'add to cart' button off, plus image not appearing on product page
    By Longster in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Oct 2008, 09:09 AM

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