Skip to content

Instantly share code, notes, and snippets.

@neilbradley
Created July 28, 2017 16:17
Show Gist options
  • Save neilbradley/2d4d977de4c8379c9f82cded0750645a to your computer and use it in GitHub Desktop.
Save neilbradley/2d4d977de4c8379c9f82cded0750645a to your computer and use it in GitHub Desktop.
CartThrob Feefo Order Export Template
<?php
$month_start = new DateTime("first day of last month");
$month_end = new DateTime("last day of last month");
$fn_start_on = $month_start->format('d-m-Y');
$fn_stop_before = $month_end->format('d-m-Y');
$start_on = $month_start->format('Y-m-d').' 00:00';
$stop_before = $month_end->format('Y-m-d').' 00:00';
$output_file="feefo-$fn_start_on-$fn_stop_before.csv";
header("Content-type: application/download");
header('Content-Disposition: attachment;filename="' . $output_file . '"');
?>
"Name","Email","Date","Description","Merchant Identifier","Product Search Code","Order Ref","Product Link"{exp:channel:entries channel="orders" disable="categories|member_data|pagination|trackbacks" status="complete" orderby="date" sort="desc" start_on="<?php echo $start_on; ?>" stop_before="<?php echo $stop_before; ?>" limit="1000"}{cf_orders_items}
"{cf_orders_customer_full_name}","{cf_orders_customer_email}","{entry_date format="%d/%m/%Y"}","{item:title}","merchant-identifier","{item:cf_products_sku}","#{item:order_id}","https://www.domain.tld/{item:url_title}"{/cf_orders_items}{/exp:channel:entries}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment