I have a rule setup to send an email on all "abandoned" cart orders.

Using the token [order:products] produces an output of: Property 0, Property 1, Property 2, (etc.)

The expected output would be the title of the product, not a generic "backend" array name.

CommentFileSizeAuthor
#6 1983898-order-products-token.patch1.13 KBlongwave

Comments

longwave’s picture

Should this just be a comma-separated list of product names? Or should we include the quantities here as well (e.g. 1 x T-shirt, 2 x Hat)?

philsward’s picture

Personally, I would LOVE to see the quantities...

I'm not sure how other's would use this token, outside of an email, but now that I have all of the abandoned order emails coming in, it's given me some good insight to where I need to focus attention to assist conversions. (free shipping products vs freight lookup, product a vs product b, etc.)

I also use the emails as a Lead Generation method for my sales guy when someone does leave their info, but doesn't buy. If he had the quantities, he would have a much better idea of how to start a conversation with the customer.

philsward’s picture

Thinking about it, would we be better off to have a comma separated list, or a "line item list"?

1 x shirt, 2 x coffee mug, 4 x plush widget

vs

1 x shirt
2 x coffee mug
4 x plush widget

(My vote is for the latter)

longwave’s picture

The source of this bug is in Entity Tokens, which helpfully tries to provide tokens for all order properties, including the list of products, but this doesn't work properly for lists: #1621084: Support list<struct> type tokens

I think we could override this by providing our own token, however.

philsward’s picture

I think a list would be ideal, but at the same time if it's going to be a pain to get it working right, I suppose it can always be handled through email HTML?

On the same note, how hard will it be to integrate the uc quantity with the entity token? Your idea of creating a custom token might be easier in the long run... Your call :-)

longwave’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

This patch adds a custom token with one product per line, including quantity. Fixing entity tokens is a lot more work without any more real benefits right now.

philsward’s picture

Awesome! Looks like it works perfect to me!!

Products Ordered:
3 × 55 Gallon Asphalt Emulsion Sealer
1 × 4 Gallon Asphalt Crack Bander
2 × 10 Gallon Asphalt Crack Machine 
2 × Flex-A-Fill Hot Asphalt Crack Filler (150 LBS - 5 Boxes)

Now that this is working, a person could override the default "E-mail admin checkout notification" using the admin template, and instead use a rule to output the same stuff and more, huh?

Thanks for getting this going!

philsward’s picture

Looking at things, the only two issues for replacing the admin template with a rule is:

1) Need a SKU token (and) Product & SKU token
2) Needs total shipping amount token

At this point, I can live without them :-)

@longwave if you're interested in adding the suggested tokens, let me know and I'll setup a feature request for them. Otherwise, I might have someone come up with a patch for it at a later time.

longwave’s picture

Status: Needs review » Fixed

Committed #6.

Feel free to open the feature request; ultimately I think the most flexibility would come from being able to render a Views table into a token, that way it would be fully customisable. And yes, replacing the order admin "invoice" template with a standard Rules email is a good long term goal, I think.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status: Closed (fixed) » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: 1983898-order-products-token.patch, failed testing.

longwave’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)