0

LS I would like to add a csv file to the order confirmation email containing fields from the order.

Like so:

Header: Type verzending ; Familienaam ; Adres 1 ;land ; Postcode ; Woonplaats ; Vooraanmeldingstype 1 ; Contactgegevens 1 ; Proactive rule 1 ; Pro-active taalinstelling 1

Rule: NCP,PRO;None;Test;NL;3145ER;Woerden;email;[email protected];1;NL

• Type verzending: always "NCP,PRO" • Familienaam: {shipping_name} • Adres 1: {shipping_address1} • Land: {shipping_country} • Postcode: {shipping_postcode} • Woonplaats {shipping_city} • Vooraanmeldingstype 1: always "email" • Contactgegevens 1: {order_email} • Proactive rule 1: always "1" • Pro-active taalinstelling 1 : always "NL"

Is there anyway to add this as CSV file (or txt) as an attachment to the confirmation email?

7
  • I think it would be easier to include a link to a CSV file rather than attach it.
    – Kokako
    Commented Jul 19, 2017 at 11:39
  • it needs to contain order specific data in order to print a distribution label
    – Bart
    Commented Jul 20, 2017 at 0:56
  • yes i can see that but all you have to do is create a template that generates the CSV and in your email, you set a link to that template that contains the order ID number. Then the template pulls that order info and generates a CSV that you can force to download. I've not used expresso-store but if the data is stored in EE you can do this. I know you can do it with CartThrob.
    – Kokako
    Commented Jul 20, 2017 at 1:01
  • I think you just solved a headbreaker here thank you so much i will let you know if this solves my issue, thx!!
    – Bart
    Commented Jul 20, 2017 at 1:05
  • but wait, how do i make the template "be a csv file"?
    – Bart
    Commented Jul 20, 2017 at 1:07

1 Answer 1

1

I think it would be easier to include a link to a CSV file rather than attach it.

All you have to do is create a template that generates the CSV and in your email, you set a link to that template that contains the order ID number. Then the template pulls that order info and generates a CSV that you can force to download. I've not used expresso-store but if the data is stored in EE you can do this. I know you can do it with CartThrob.

to generate the CSV you can use http_header component then you template looks something like this:

{exp:http_header content_disposition="attachment" content_type="text/csv" filename="{current_time format="%y_%m_%d"}-members.csv"}ID,Status,Last name,First name,Email,Last Payment,Join Date {exp:user:users orderby="total_entries" sort="desc" dynamic_parameters="no" limit="500" }{member_id},{if group_id == 4}Pending,{/if}{if group_id == 6}BO Member,{/if}{if group_id == 7}Expired,{/if}{if group_id == 8}Content Admin,{/if}{if group_id == 9}Order Admin,{/if}{if group_id == 1}Admin,{/if}{if group_id == 5}Expired,{/if}{if group_id == 10}Member Admin,{/if}{last_name},{first_name},{email},{payment},{join_date format="%m/%d/%y"} {/exp:user:users}

1
  • completely agree. Its the same principle as having a download invoice link. I'll add that if you want to render the CSV links unreadable, you can store a hash value with your order ( in a custom field) and use that hash id to pull the info you need.
    – pixldev
    Commented Jul 21, 2017 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.