Jump to content

Can we use Product Options in an email template?


Daamon

Recommended Posts

Hi,

I know that the HTML of the email templates can include a long list of data using the macros listed underneath, but can details captured in the Product Options area be used? I've searched the forums and couldn't see anything...

An example: we capture the Make, Model, registration and year of manufacture of motorbikes for one of our membership products (non-physical) as Product Options. We would like to reference these when the Order Complete email gets sent.

Can this be done? If so, what would be really handy would be if some logic could be used in the email template along the lines of "If empty, then display no text. If not empty, display Make: DATA.Product.Option.Make_field" - I hope you get the idea.

Thanks.

Link to comment
Share on other sites

it's already in the stock templates

 

		{foreach from=$PRODUCTS item=product}
		<tr>
			<td>{$product.name}<br />
			{$product.product_options}</td>
			<td>{$product.quantity}</td>
			<td>{$product.price}</td>
		</tr>
		{/foreach}

 

you should be able to re-use the code in the confirmed e-mail template. Be aware of this though, it may or may not impact you.

https://github.com/cubecart/v6/issues/1271

 

 

Link to comment
Share on other sites

Thanks @Noodleman, I confess I don't know how to use the stock templates - why I didn't see it in there.

I used your code (thanks for that) and it's appearing in the email being sent out upon Order Complete. I've removed Product Quantity and Price as they're not needed.

We have four Product Options for a number of items, the same options for each. When they appear in the email, they're listed with no line breaks after each option - can your code be modified to introduce line breaks after each option? I did try appending "|nl2br" within the curly brackets to the Product Options code.

Example:

- What I'm getting: Make: TestMake Model: TestModel Year of Manufacture: TestYear Rego: TestRego

- What I'd like:

Make: TestMake

Model: TestModel

Year of Manufacture: TestYear

Rego: TestRego

[example end]

 

Link to comment
Share on other sites

@Noodleman In the above formatting query I assumed that we are forced to accept the field names too - i.e. the Make, Model etc. - hence a request to have them on separate lines for easier reading. If there's a way of extracting just the data without the field names, then having it listed in sequence and comma separated would be better still.

Example: Honda, Blackbird, 2005, ABC123

Cheers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...