Miva Merchant Development by Scot's Scripts

HEADERS: Download, display, open content

Miva Knowledge Base
HEADERS: Download, display, open content
Important Notice: This information is for internal reference only. Use at your own risk.
Does Google actually understand your Miva Merchant store? Our JSON-LD schema generator makes sure it does. Contact us to get started. (more info)

HEADERS: Download, display, open content

Scot Ranney • March 01, 2024


1. Page Items: assign "http headers" item to the page (batch report template usually)

2. Create a header:

HeaderValue
Content-Dispositionattachment; filename="my_file.csv"

SMT code using tab delim:

<mvt:assign name="l.delim" value="asciichar(9)" />
<mvt:assign name="l.lf" value="asciichar(10)" />
<mvt:foreach iterator="line" array="data">
<mvt:eval expr="l.row1_data $ l.delim $ l.row2_data $ l.delim $ l.row3_data $ l.lf" />
</mvt:foreach>

SMT code using comma delim and miva csv encoding:

<mvt:assign name="l.delim" value="','" />
<mvt:assign name="l.lf" value="asciichar(10)" />
<mvt:foreach iterator="line" array="data">
<mvt:assign name="l.line" value="miva_csv_encode(l.row1_data,l.delim) $ l.delim $ miva_csv_encode(l.row2_data,l.delim) $ l.delim $ miva_csv_encode(l.row3_data,l.delim) $ l.lf" />
<mvt:eval expr="l.line" />
</mvt:foreach>

CSV Headers:

You can manually put a header line on top or not, doesn't really matter if your columns are in the right order and your parsing script needs them in that order. Remember to skip the first line when importing if the file is using a header.


https://www.scotsscripts.com/mvblog/headers-download-display-open-content.html

mvkb_header mvkb_batch