Forum
Adding the quantity of an individual item to the quantity_max attribute - FoxyCa...
Hi,
I have a shop that has products where stock is tracked on a option level (in this case "size").
I want to pass the quanity level of that individual item into the value of the quantity_max attribute, so when the user enters the FoxyCart payment process, they can not increase the stock level by more than what is available.
Is this possible?
How is it passed? As a hidden field?
I would like to pass it as a hidden field. Is there a tag for pulling all the option quantities?
What does the template look like at the moment? I can help you work from there.
Hey,
Ok - so this is the "product" template - specifically the perch form:
This piece of code brings up a series of size options
Essentially, I want to stop people from adding more to the cart than is actually in stock - so if a t-shirt in size 8 has a qty of 5, I want to pass through that number into a attribute called "quantity_max". This will restrict the user once they are in foxycart from increasing the QTY to more than the number passed.
The issue is, I need to get the QTY for ALL options, and then based on what they select, populate the field attribute quantity_max using JS I'm guessing?
Thank you for your help! (majorly lost here).
So that's usin the
shop/product_options.html
template, which looks like this:You should be able to test for the qty field you're looking for and then add your additional hidden input.
How do you "see" the qty field?
optionValue is the size (S,M,L etc)
Is there a tag I can use that will show me:
S - QTY 3 M - QTY 8 L - QTY 10
I'm not sure what you mean by how do I see it.
Are the options not being output?
The only output is the Option Value - e.g. "S" or "M" or "L" - not the quantity associated with each option.
Is there an equivalent tag for "<perch:shop id="optionValue" />" to show the quantity associated with a option? Something like e.g. "<perch:shop id="optionCount" />"?
It looks like this guy was having the same issue - https://support.grabaperch.com/index.php?pg=forums.posts&id=6583&pc=2 (have a look towards the end of the conversation).
I'm a bit apprehensive about using his solution at the end before checking that there is no other (better) approach first...
No please don't use anything dug up from the old forum. That is a very old thread about a previous version of the shop.
To see what is available use you can use the following: https://solutions.grabaperch.com/development/using-perch-showall
Hi Rachel,
I had a look and the closest thing I could see was "<perch:shop id="productCountByOptions" />" which doesn't return a value that makes any sense.
I'm guessing then that there isn't a solution? I feel like I am missing something... is it possible to display to quantity of a option, not just the "name" of that option?
Hamish
I really don't know. I'll have to get a copy installed and set up in the same way and have a look.