Saturday 15 June 2013

html - How to add an input field for an add to cart button? -


I am trying to create an e-commerce site on bigcartel. There is not a quantity field in the product page and I want to add one. Limited backend is accessible, but I can modify HTML and add javascript.

Without too much trouble, is there any way to add a volume area connected to the cart button?

Here is the code from the cart button area:

  & lt; Div id = "variations" & gt; {% If the product. is available? %} & Lt; P & gt; & Lt; Select id = "cart_variation_id" & gt; & Lt; Options & gt; Select the option ... & lt; / Options & gt; {% Variation.available for changes in {% For product.variations%}? %} & Lt; Option value = "{{variation.id}}" & gt; {{Variation.name}} - {{variation.price | Money}} & lt; / Options & gt; {% Else%} & lt; Option disabled = "disabled" & gt; {{Variation.name}} - {{variation.price | Money}} (out of stock) & lt; / Option & gt; {% Endif%} {% endfor%} & lt; / Select & gt; & Lt; Button class = "btn" onclick = "javascript: Store.cart.add (. Document.getElementById ('cart_variation_id') option [. Document.getElementById ('cart_variation_id') SelectedIndex] .Value); return false;" & Gt; Add to Cart & lt; / Button & gt;    

you have a own button which is attached to a HTML & lt Can be added; Input & gt; The field is called volume, and javascript is used to call Store.cart.add ... The amount of times you only allow the number in the input to add additional JS

Currently adding code to onclick = "Javascript looks like: Store.cart.add (document.getElementById ('cart_variation_id') .options [document.getElementById ('Cart_variation_id'). SelectedIndex] .Value)

So if you add a volume, a 'ghetto' fix will be feature Call the amount number of this method that you wanted to do for the loop, suppose it updates your cart quantity.

No comments:

Post a Comment