I am looking at creating an order export to a CSV file, hooking in to the Order and Order Lines, does anyone know if this has been? If this is possible? Or any ideas how to go about it?
You can do this in xslt very easily. Use the Tea Commerce xslt library to get all the orders and then just loop throught them and create the csv content.
It's in the TeaCommerce.Library class. But you can find it in the xslt editor the same way as you use the umbraco library methods. Just teacommerce instead.
I am struggling with this one, could you give some more detail about this. Also I tried to put a button in the tea commerce section of Umbraco and was able to do this but there was no .cs backend to the aspx file. So I couldnt see how the other buttons worked, is this intentional or am I looking in the wrong place?
We are still looking in to this problem and seem to be having a problem with the SearchOrders.cs, when we extract it using the Reflector programme it adds in uncompilable code. Is there any chance you could give us the code so we can use this and implement it. It would be a massive help.
I don't have an out of the box example on how to make a csv of orders. I have done it before though. I startet out using the Macro service package, but it had pretty huge performance problems unfortunately. So my recipe for a csv looks something like this:
1. Make a template, a document type and a page. 2. Create a xslt to write out the csv data and add it's macro to the template 3. Create a custom .NET xslt library and a method to add a header to the page. My method looks like this:
publicstaticvoid AddHeader( string name, string value ) {
HttpContext hc = HttpContext.Current;
hc.Response.AddHeader( name, value );
}
4. Do some stuff in your xslt 4.1. Some general variables
Order CSV Export
Hi,
I am looking at creating an order export to a CSV file, hooking in to the Order and Order Lines, does anyone know if this has been? If this is possible? Or any ideas how to go about it?
Thanks
Jason
Hi Jason,
You can do this in xslt very easily. Use the Tea Commerce xslt library to get all the orders and then just loop throught them and create the csv content.
/Rune
By the way. The method you want to use is GetFinalizedOrdersXML method, which provides all orders.
/Rune
Hi Rune,
Thanks, that brilliant, where is the method GetFinalizedOrdersXML - I did a quick search through my project and it didnt bring up any matches.
Thanks
Jason
It's in the TeaCommerce.Library class. But you can find it in the xslt editor the same way as you use the umbraco library methods. Just teacommerce instead.
/Rune
Hi Rune,
I am struggling with this one, could you give some more detail about this. Also I tried to put a button in the tea commerce section of Umbraco and was able to do this but there was no .cs backend to the aspx file. So I couldnt see how the other buttons worked, is this intentional or am I looking in the wrong place?
Thanks
Jason
Hi Rune,
We are still looking in to this problem and seem to be having a problem with the SearchOrders.cs, when we extract it using the Reflector programme it adds in uncompilable code. Is there any chance you could give us the code so we can use this and implement it. It would be a massive help.
Thanks
Jason
Hi Jason,
I will e-mail you the code if you throw us an e-mail on [email protected]
/Rune
I also have a customer that is asking for a way to export orders.
At the moment I'm struggling to see how it would work. Are we able to extend the Tea Commerce back-end and provide this with a sensible interface?
Cheers, Matt
Is there any plans for this to be integrated as default functionality as I think a lot of users would benefit from this.
Or if someone you post an example of the XSLT here, that would be really good.
Many thanks
Hi Rich,
I don't have an out of the box example on how to make a csv of orders. I have done it before though. I startet out using the Macro service package, but it had pretty huge performance problems unfortunately. So my recipe for a csv looks something like this:
1. Make a template, a document type and a page.
2. Create a xslt to write out the csv data and add it's macro to the template
3. Create a custom .NET xslt library and a method to add a header to the page. My method looks like this:
4. Do some stuff in your xslt
4.1. Some general variables
<!--
*******************************************
CSV VARIABLES
*******************************************
-->
<xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>
<xsl:variable name="separator" select="';'" />
<xsl:variable name="lineBreak">
<xsl:text>
</xsl:text>
</xsl:variable>
4.2. Change the contenttype and header
<xsl:value-of select="umbraco.library:ChangeContentType('text/csv')"/>
<xsl:value-of select="foreningenaktiv:AddHeader('content-disposition', 'attachment;filename=medlemmer.csv')"/>
4.3. Write the csv text and use the separator and lineBreak variable to do "kommas" and line breaks.
5. The orders can be fetched from Tea Commerce this way: teacommerce:GetFinalizedOrdersXml()
Hope this helps
/Rune
Thanks Rune,
How much would you charge to implement this for us?
Aren't finalised order the ones that have been dispatched?
Then that is no use for me, I need all orders New orders or All orders so we can export the list of orders awaiting dipatch.
Well the finalised orders xml contains all orders that have been paid for. Both the ones that have been dispatched and those waiting for dispatch.
You can just filter them on their order status, which will have to be changed after dispatch. So no problems there!
/Rune
You'll almost certainly want to exclude orders with a status of 'Cancelled'. ;-)
is working on a reply...