raft order export

<?xml version="1.0" encoding="UTF-8"?>
<files>
<file filename="export.csv" search="," replace=";">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl">
<xsl:output method="text"/>

<xsl:variable name="sepstart" select="''"/> <!-- field seperator, including '' -->
<xsl:variable name="sepend" select="','"/> <!-- field seperator, including '' -->

<xsl:template match="/">
<xsl:text>OrderId,OrderDate, PayAmount, PayMethod, CustomerId ,DelAddress1,DelAddress2 ,DelTown,DelRegion,DelPostcode ,AccAddress1,AccAddess2,AccTown,AccRegion,AccPostcode,Tel1,Tel2,Email , LineId ,SKU ,OrderQty, UnitPriceExVAT ,UnitPriceIncVAT, VATRate, Description,First Name,Last Name </xsl:text>
<xsl:text>&#xD;&#xA;</xsl:text> <!-- Newline -->

<xsl:for-each select="orders/order">
<xsl:for-each select="items/item">

    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../entity_id"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="php:functionString('strftime', '%d/%m/%Y', ../../created_at_timestamp)"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="php:functionString('round', price)"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../payment/method"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../customer_id"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../shipping/street1"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../shipping/street2"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../shipping/city"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../shipping/region"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../shipping/postcode"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../billing/street1"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../billing/street2"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../billing/city"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../billing/region"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../billing/postcode"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../billing/telephone"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../shipping/telephone"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../customer_email"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="sku"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="php:functionString('round', qty_ordered)"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="php:functionString('round', ../../subtotal)"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="php:functionString('round', ../../grand_total)"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" />20%<xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="description"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../customer_firstname"/><xsl:value-of select="$sepend" />
    <xsl:value-of select="$sepstart" /><xsl:value-of select="../../customer_lastname"/><xsl:value-of select="$sepend" />


<xsl:text>&#xD;&#xA;</xsl:text>
</xsl:for-each>
</xsl:for-each>

</xsl:template>

</xsl:stylesheet>
</file>
</files>

Did you find this article valuable?

Support Mandeep Singh by becoming a sponsor. Any amount is appreciated!