Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Mackay 98 posts 149 karma points
    Dec 08, 2011 @ 12:29
    Jason Mackay
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Dec 08, 2011 @ 13:37
    Rune Grønkjær
    0

    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 

  • Rune Grønkjær 1372 posts 3103 karma points
    Dec 08, 2011 @ 13:38
    Rune Grønkjær
    0

    By the way. The method you want to use is GetFinalizedOrdersXML method, which provides all orders.

    /Rune

  • Jason Mackay 98 posts 149 karma points
    Dec 08, 2011 @ 13:43
    Jason Mackay
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Dec 08, 2011 @ 16:17
    Rune Grønkjær
    0

    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

  • Jason Mackay 98 posts 149 karma points
    Dec 15, 2011 @ 15:12
    Jason Mackay
    0

    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

  • Jason Mackay 98 posts 149 karma points
    Jan 10, 2012 @ 18:25
    Jason Mackay
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Jan 11, 2012 @ 08:17
    Rune Grønkjær
    0

    Hi Jason,

    I will e-mail you the code if you throw us an e-mail on [email protected]

    /Rune

  • Matt Taylor 873 posts 2086 karma points
    Jan 17, 2012 @ 15:06
    Matt Taylor
    0

    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

  • rich hamilton 117 posts 136 karma points
    Nov 19, 2012 @ 11:20
    rich hamilton
    0

    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

  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 22, 2012 @ 08:18
    Rune Grønkjær
    0

    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:

    public static void 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

      <!--
      *******************************************
          CSV VARIABLES
      *******************************************
      -->
      <xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>
      <xsl:variable name="separator" select="';'" />
      <xsl:variable name="lineBreak">
        <xsl:text>&#xa;</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

  • rich hamilton 117 posts 136 karma points
    Nov 22, 2012 @ 10:28
    rich hamilton
    0

    Thanks Rune,

    How much would you charge to implement this for us?

  • rich hamilton 117 posts 136 karma points
    Nov 22, 2012 @ 13:14
    rich hamilton
    0

    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.

  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 22, 2012 @ 15:31
    Rune Grønkjær
    0

    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

  • Matt Taylor 873 posts 2086 karma points
    Nov 22, 2012 @ 15:42
    Matt Taylor
    0

    You'll almost certainly want to exclude orders with a status of 'Cancelled'. ;-)

Please Sign in or register to post replies

Write your reply to:

Draft