The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Is quantity_max in select options possible?

flinx777flinx777 Member
in Help edited November 2011
I have a site using Foxy Cart 0.7.2 with options for the products with size modifiers like so:
<select id="product_size" name="Size">
<option value="">Please select a size</option>
<option value="Medium">Medium</option>
<option value="Large">Large</option>
<option value="XL">XL</option>
</select>

I'm using a CMS (MODx) to control inventory. Is it possible to control the maximum allowed for the number of any size modifier? For example, if we only have 4 medium products, is it possible to pass that quantity_max into that size modifier? Is something like this possible?
<select id="product_size" name="Size">
<option value="">Please select a size</option>
<option value="Medium{quantity_max:4}">Medium</option>
<option value="Large{quantity_max:6}">Large</option>
<option value="XL{quantity_max:8}">XL</option>
</select>
Comments
  • lukeluke FoxyCart Team
    Not currently, but you could write some JavaScript as a preprocess method which could update a hidden field quantity_max based on which product_size is selected. I've had this situation come up frequently with HTML forms. I often want to stuff more data in a select box than just one thing... the only way I've ever had to work around it is to either parse the data on the server side to strip out the multiple values you intend or to build up some kind of array you can use with some JavaScript to set the corresponding value from a hidden field every time the select box changes.
    Hope that helps.
  • Hey Luke,

    Thanks for the response...appreciate it. Let me look at a few different options and I'll post what I did here.
Sign In or Register to comment.