scott
March 1, 2024, 1:18pm
1
I followed @Teodor ’s tutorial here to create a Shopping Cart.
The shopping cart adds the product correctly, but the quantity field is not showing any data. I checked and double checked to make sure that the quantity + 1
was entered correctly and reviewed various posts , but I can not seem to get this to work correctly.
Here is the data store:
Here is the button action (upsert):
Here is the code view of the button:
Here is the result:
Here is the Chrome Developers view of the local session storage:
This must be the decimal field… Considered as a string by JS.
Add .toNumber() and I think you will be OK
1 Like
scott
March 1, 2024, 1:40pm
3
Hi @famousmag ! Thanks for the assistance!
I tried doing the convert to number with and without the backticks, but I am getting NAN in the modal and still null in the session storage.
scott
March 1, 2024, 1:45pm
5
In addition to doing the data store conversion to number recommended above, I tried with it being the original quantity
and then with the conversion to a number.
does quantity have a default value, eg 1?
quantity.defalut(1)
looks like there is no value for it there…
scott
March 1, 2024, 1:54pm
7
I can try adding that, but would not the button that opens the modal be setting the initial value through the upsert?
Just tried setting the default to 1 and there was no change.
I see quotes in your button upsert action…
Ypu must have missed that my friend
delete the quotes… (Make sure that ONLY quantity turns blue)
scott
March 1, 2024, 2:04pm
9
No those are backticks and @Teodor is very specific that they have to include the quantity and the plus 1.
However I did try the following:
quantity + 1
'quantity' + 1
'quantity + 1'
`quantity` + 1
`quantity + 1` (which is the one indicated to use)
"quantity" + 1
"quantity + 1"
Just checked a old site where I did this.
`quantity+1` works so maybe a bug?
Are you sure that is just quantity?
Bind from the ui for sure…
Apple
March 1, 2024, 4:03pm
12
I’m confused, you guys are talking about quantity+1, but that’s to increase the quantity by clicking the button.
Before you increase the quantity (before you click the button), is the quantity shown?
There’s no point talking about quantity+1 if the problem comes before…
How is the product being added? Have you double-checked the quantity is being set?
1 Like
scott
March 1, 2024, 4:07pm
13
Yes, the product has been added, but the quantity has not.
This is the section where it seems to stop for me.
Teodor
March 1, 2024, 4:08pm
14
It’s an upsert step, so that it `quantity+1`
should add 1
if no quantity is set.
We’ve fixed that for App Connect 2 so you can get the latest file from here:
dmxAppConnect.zip (28.6 KB)
This will be included in the next update, most probably early next week.
2 Likes
Apple
March 1, 2024, 4:09pm
15
Interesting, alternatively I’m guessing it should work with quantity.default(0)+1
1 Like
scott
March 1, 2024, 4:21pm
16
Thanks @Teodor for the quick fix!
Appreciate @famousmag , @Hyperbytes , and @Apple for the assist!
1 Like
Teodor
Closed
March 8, 2024, 4:00pm
19
This topic was automatically closed after 26 hours. New replies are no longer allowed.