Announcement

Collapse
No announcement yet.

Plus & Minus on Quantity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Plus & Minus on Quantity

    I've been asked about adding + and - buttons for quantity changes.

    I can see a posting for this from 2003 that includes details on the implementation, though I suspect that this might not be valid for v11.

    There is a request for information on this from 2010, though there was no follow up.

    I can't see anything else in the Forums and nothing in the AUG, Help or Knowledge Base.

    Could anyone advise on whether there is already some code around to do this or whether I should start from first principles?

    Many Thanks,

    Alan
    Alan Morris
    OakRidge Internet Ltd

    #2
    Try this:

    Go to Design / Library / Layouts / Javascript Header Functions / Standard JavaScript Header Functions.

    Paste the following into the bottom after everything else:
    Code:
    <script type="text/javascript">
    function incqty(pid){
    	var qf = document.getElementById('Q_' + pid);
    	qf.value++;
    }	
    function decqty(pid){
    	var qf = document.getElementById('Q_' + pid);
    	if ( qf.value > 0 ) qf.value--;
    }
    </script>
    In your Products Layout(s) replace the Quantity field which is usually:
    Code:
    <input type="text" name="Q_<actinic:variable Name="ProductID"/>" size="4" value="<Actinic:Variable Name="DefaultQuantity"/>" class="form_input_general" />
    With:
    Code:
    <input type="button" value="-" onclick="decqty('<actinic:variable Name="ProductID"/>')" />
    <input type="text" id="Q_<actinic:variable Name="ProductID"/>" name="Q_<actinic:variable Name="ProductID"/>" size="4" value="<Actinic:Variable Name="DefaultQuantity"/>" class="form_input_general" />
    <input type="button" value="+" onclick="incqty('<actinic:variable Name="ProductID"/>')" />
    You could use images instead of buttons by replacing:

    <input type="button" value="-"

    with

    <img src="myminus.gif"

    And

    <input type="button" value="+"

    with

    <img src="myplus.gif"
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks!

      Norman,

      Thanks for the quick and detailed reply to the question on the + & - options for quantities.

      Very much appreciated.

      Regards,

      Alan
      Alan Morris
      OakRidge Internet Ltd

      Comment

      Working...
      X