cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frankie70
Post Patron
Post Patron

Design shopping cart and manage items

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.

Frankie70_0-1615994026302.png

I can think of two options:

  1. use a dropdown (when choosing '0' is deleting the product from the list
  2. using buttons (up and down arrow) to modify the quantity or put it to '0' for deletion

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!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Frankie70 

Yes, that incrementing will not work.  Here is what you need.

On the Plus icon:

With({_itm: LookUp(basket, itemname = Gallery4.Selected.Title &&
                           itemcat = Gallery4.Selected.Category &&
                           itemopt = dd_options_5.Selected.Result)},

        Patch(basket, _itm, {itemcount: _itm.itemcount + 1})
)

And for the minus:

With({_itm: LookUp(basket, itemname = Gallery4.Selected.Title &&
                           itemcat = Gallery4.Selected.Category &&
                           itemopt = dd_options_5.Selected.Result)},

        Patch(basket, _itm, {itemcount: _itm.itemcount - 1})
)

 

I would also put this on the minus button.

If(LookUp(basket, itemname = Gallery4.Selected.Title &&
                  itemcat = Gallery4.Selected.Category &&
                  itemopt = dd_options_5.Selected.Result,
                  itemcount) <=1,
    Disabled,
    Edit
)

 

This will keep people from going less than 1 on the item.  

I would assume then a Delete icon on the item so people can get rid of it:

RemoveIf(basket, itemname = Gallery4.Selected.Title &&
                  itemcat = Gallery4.Selected.Category &&
                  itemopt = dd_options_5.Selected.Result
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

40 REPLIES 40
RandyHayes
Super User III
Super User III

@Frankie70 

I am not sure if you are looking for formulas or just general help on this.

I would suggest that you NOT automatically remove an item from the list when it is set to 0.  Instead consider a trash can icon with a confirm.  It is annoying for a user to accidentally do something (i.e. clicking the down arrow thinking it was the up arrow) and having an item disappear.  Putting an icon on the line gives them more control that they are doing just that.  Also, if there are 20 items, if they want to delete all 20, they would have to know that they need to click the down arrow 20 times to remove it...a trash can icon is pretty universal for what it means.

Of course, you can use the dropdown instead, but that again becomes an annoyance if they want to add more than the maximum in your dropdown.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes 

Thank you very much for your feedback. This is really helpful. Although if you could help me with some formulas it would be absolutely great. Because I am stuck. Using a drop-down would suit me best. I already tried to remove the grouped item with a trash symbol, but I did not succeed.

Hi @RandyHayes 

I am struggeling with changing the amount of a single item in the shopping tray (basket).

I would like a "-" left of the amount (which will change to a trash icon if the amount is 1) and a "+" right of the amount for increasing the amount.

 

I'm not quite sure if I'm making a mistake here either. If I change the number of an item in the basket (which is a group), will the number of items in the group really be changed? Any thoughts and ideas will be very helpful for me.

RandyHayes
Super User III
Super User III

@Frankie70 
So, if you are incrementing or decrementing values, this would not be at the group level, you would be doing this on an individual item record in that group.  When you do that, yes, the grouping will update.

But again, no, there is nothing really to change at the group level for this...has to be the records in the group.

 

Also, you might want to take a look at this post from yesterday where I discussed a process of doing the increment and decrement process in a gallery.  Not sure if helpful, but perhaps in your case.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes 

thanks for your answer. Could you please provide me some help on this. I do not understand how to use the up and down controls on the group put changing the individual items...

RandyHayes
Super User III
Super User III

@Frankie70 

Sure thing...

I believe what you need to abandon is the items of the Group concept.  Meaning, when you ultimately go to store the information, the basket items will not be used, instead the Gallery is your basket (which it really kind of already is).

 

BUT, before that, rolling back...why a GroupBy on your items?  Is this somehow related to how you are adding the items to your basket?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes 

the groupby just looks a bit more cleaned up.

And it more comfortable for the user to add or remove.

Frankie70_0-1616091541786.png

The items are added like that:

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: "1"
    }
)

I added itemcount just recently for testing, because I can not succeed 😞

RandyHayes
Super User III
Super User III

@Frankie70 

I am not entirely sure what you concept is on that screen.  It appears that you have a list of items at the top...but they have trash cans on them, so I am not sure how that fits in.  I assume the user clicks the item at the top and it goes into the shopping cart?  which is displayed below?

 

If that is the case, then here's the thing... you are adding these items row by row.  What you should be doing is (perhaps where you were going) incrementing or decrementing an Item Count on the row.

This way if someone selects the Lenovo, when they add another one, you should be incrementing the item you have, not adding another row. 

At that point there is no need for grouping and the complexity it is causing.

Your cart will have only one item in it and a count of how many are desired.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi @RandyHayes 

I'm sorry that confused you.

I just put the "old" ungrouped shopping cart at the top and the "new" grouped one at the bottom.

The shop where you choose the products is on another screen.

Here:

Frankie70_1-1616100627157.png

 

So, I would like only to have the "new" grouped view of the shopping cart where you are able to increase and decrease the number of grouped products (or even delete them when the number is down to 1, the arrow down will be a trash icon).

I hope this expains now, what my plans are.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (63,724)