Hi all,
I am building a webshop and I would like to be able to change the quantity of products or remove them from my gallery.
I can think of two options:
Currently the dropdown is configured like this:
Sequence(ThisItem.Amount+3,0,1)
In my gallery the items ar grouped
AddColumns(
GroupBy(
basket,
"itemname",
"itemopt",
"itemprice",
"itemname_rec"
),
/* "Total", Sum(itemname_rec, itemprice), */
"Amount",
Sum(
itemname_rec,
itemcount
)
)
I am really stuck here and any help is appreciated!
Solved! Go to Solution.
Very good. So then the concept is this, on your Add to Cart, check your collection to see if the item is already in the cart. If so, increment the count. If not, add it and set the count to 1.
This will totally eliminate the need to group by anything as it will then automatically be grouped.
Thanks a lot.
I was hoping you could help me with some formula because I am not really sure how to start. This would be awesome.
Sounds good...put this concept in play and see how you get along with it.
Hi @RandyHayes
Somehow I can not get it to work.
I check if an item already exists in the collection and if so, i want to increment the current amount with the value selected from the dropdown (dd_amount). But it seems that referencing to the same property does not work.
If(CountRows(Filter(basket, itemname = Gallery4.Selected.Title))<0,
Collect(basket, {itemname: Gallery4.Selected.Title, itemcat: Gallery4.Selected.Category, itemprice: Gallery4.Selected.Price, itemopt: dd_options_5.Selected.Result, itemid:Gallery4.Selected.ID, itemcount: dd_amount.Selected.Value}),
Patch(basket, First(Filter(basket, itemname=Gallery4.Selected.Title)), {itemcount: ...??
Could you please give me a hint?
Hi @RandyHayes ,
I am really stuck on this. Could you please have a quick look?
The "Add to cart" button has the following formula:
OnSelect:
Collect(basket, {itemname: Gallery4.Selected.Title, itemcat: Gallery4.Selected.Category, itemprice: Gallery4.Selected.Price, itemopt: dd_options_5.Selected.Result, itemid:Gallery4.Selected.ID, itemcount: dd_amount.Selected.Value})
In the gallery below I would like to add and remove items.
I cannot get this to work.
Sorry for delay...
Set your formula to:
With({_itm: LookUp(basket, itemname = Gallery4.Selected.Title)},
If(!IsBlank(_itm.itemcount),
UpdateIf(basket, itemname=_itm.itemname,
{itemcount: _itm.itemcount + Value(dd_amount.Selected.Value)}
),
Collect(basket,
{itemname: Gallery4.Selected.Title,
itemcat: Gallery4.Selected.Category,
itemprice: Gallery4.Selected.Price,
itemopt: dd_options_5.Selected.Result,
itemid:Gallery4.Selected.ID,
itemcount: Value(dd_amount.Selected.Value)
}
)
)
)
This looks up the item in the basket collection first.
If there is an itemcount then there is a record...so updateIf is used to increment the count.
If there is not, then the item is collected.
Hi @RandyHayes ,
that worked really great. But my initial problem is how I can increment and reduce the itemcount in the basket.
Somehow I do not have access to "ThisItem.itemcount" in the gallery.
What is the Items property of that Gallery? I assume it is basket
What is the error you are seeing (when you hover over the error in the formula)?
Hi @RandyHayes ,
yes, its basket.
The itemcount between the two arrows has
Text: ThisItem.itemcount
The itemprice on the very right has
Text: Text(ThisItem.itemcount*ThisItem.itemprice, "[$-en-US]###,###.00") & " €"
I'm not sure what formula to use for the up and down arrows?
Click on this dropdown on the red error:
Then choose Edit in the formula bar:
Then click into the formula and see what is underlined in red. Then hover your mouse pointer over that red underline and let me know what the error message is that pops up.
User | Count |
---|---|
255 | |
106 | |
85 | |
51 | |
43 |