Creating an email sales receipt list of items in the shopping cart

I have been searching the forum and seem not to be able to find a solution I can follow, for what I can only imagine is a solved problem. I am hoping someone can help

When my user checks out I want to send them an email showing the list of items (the order) they have purchased and issue a sales receipt.

Where I am struggling is to include in the email the list of items in their order.

This should be

item name | Quantity | Item Price

I cannot seem to get this from bubble into a row per line item. I can output each list so

Item name, item name, item name
quantity, quantity, quantity
Item price, Item price, item price

when I want

item name | Quantity | Item Price
item name | Quantity | Item Price
item name | Quantity | Item Price

Any solution how to do this would be great.

Thanks

Do you mind sharing a screenshot how do you implement this?!


@bestbubbledev - Youtube | LinkedIn | Twitter
| Best Nocode Studio

Thanks for taking a look at this,

Let me try and see if I can represent it

At Check out I am using an active cart to create an Order

Then I wish to build an email within that same workflow

Is how I am currently unsuccessfully doing.

I have tried an approach I saw using do a search for, but that did not seem to work and returns spurious repetition.

LEt me know if these are helpful

“Format as text” will allow you to iterate over each item in a list. Within the format as text function, you can define what you want to see from each item (this item’s name, this item’s price, etc.) .

The only issue with this approach will be if you’re trying to render an image for each line item, but you may be able to get around this by wrapping “this item’s img url” in bbcode or similar.

Hi Ed,

Thanks I have given this a go

I think the challenge is that Item is a foreign key in Order, linking to Item Table, Quantity is a list in order thus it seems to call when using “Format as text” the item name but then I want to inner iterate the quantity list, but cannot seem to get it to do so

E.g.

image

Format as text 1

image

Format as test 2

image

Results in

Product name Quantity 1, 3 Quantity 1, 3 Product Name

What I am looking for is

Product Name Quantity 1
Product Name Quantity 3

It is the traversing two lists in unison, I cannot seem to get it to do.

So are you structuring each order with a list of items from a fixed list, then a separate list for the qty of each item sold?

If I’ve read that right, then I’d probably suggest fundamentally changing the orders to contain a “line item” datatype, within which you have the item name & qty (plus any other relevant information, price etc.). Having the qty separate makes this a fair bit harder, since there’s no way to reference the current item’s index in the formatted text, so you’d either need to have all the data available in a single “thing” (line item), or have a number field to reference on each item in the order (which seems way more convoluted to me).

Within the format as text function, I can see that you’re still referencing a workflow step, when you should be referencing the current list item. So you’d use it like so:

Example List:
{“name”: “Item 1”, “qty”: “10”},
{“name”: “Item 2”, “qty”: “20”}

Workflow:
List:Format as Text (This item’s name - This item’s qty), delimiter can be a carriage return.

Output:
Item 1 - 10
Item 2 - 20

Thanks ed19, I will take a look at that approach

The data structure is as follows

Table: Items
Item ID, Item Name, Item Price, Item Price Discounted etc

Table: Carttems
CartItems ID, Item ID, Price (could be discounted or not), Quantity

Table CartCheckouts
ChartCheckoutID, CartItems, OrderID

Order
Order ID, ChartCheckout, Items (list of Item IDs)

This seemed to be the best 3nf normalised form, however I seem unable to bring in the quantity from CartItems when building the email. Hence pulling it from the worflow

however I added a itemQuantity list to Order, to try to pull it from the workflow. In the end as a work around I created a list within Order call itemQuantity and tried to pull it from there, but not working.

Maybe my understanding of how bubble handles data is flawed :frowning:

I will try your suggestion unless you think there is something I could improve in the data structure.

I think the structure looks fine, though obviously this is just at a glance. All I’d say is you need that one extra datatype in a line item.

So have the Line Item datatype as a foreign key (list) in your orders, then set your Item datatype to be a foreign key for each line item. That should give you a similar structure, but creates an instance of each line item’s use, with the associative qty, price, total price (whatever else you want).

This topic was automatically closed after 70 days. New replies are no longer allowed.