I am having some difficulty limiting the datastore quantity based on the value in the database.
As you can see in the video below, I have set up a page that has the cart and the add quantity and subtract quantity buttons show as intended. The issue is stopping the add quantity button from showing once the quantity in the database has been reached.
Product Test has a database quantity of 1, so no add or subtract buttons are shown.
Product Test2 has a database quantity of 10, so the add button should only be shown once the datastore quantity reaches 10.
Screen Recording 2024-03-02 at 3.03.37 AM
I have a server connect on the page that retrieves the quantity from the database. It returns the values of “prd_id” and “quantity”.
For the add quantity button, I have set up a Dynamic Attribute “Hide” with the following:
The “Hide” looks at the “prd_id” from the datastore to the “prd_id” from the server connect and if they are equal THEN looks at the “quantity” from the datastore to see if it is less than or equal to the “quantity” from the database.
I feel like there should be some sort of refresh for the button, I am just not sure how to go about it.
I realize that right now with there only being a couple entries in the products table, the server connect is not an issue, but as the list grows, this could become a problem. However, I am not sure if there is a better way to go about doing it.