Convert html page or database shopping basket to an email

Discussion in 'ASP General' started by Richard Pain, Apr 1, 2004.

  1. Richard Pain

    Richard Pain Guest

    OK - I have a shopping basket with data in a database. Once the person
    has successfully completed their order I want to be able to send them
    an email with the products ordered roughly in the following format:

    Product Price Quantity

    prod1 £6.99 1
    prod2 £5.99 2
    Postage £0.50

    Total whatever..I'm
    lazy

    Formatting would be a little different (just spacing out the prod
    table a little more.

    Any ideas or links to scripts that do this?. I've been looking for a
    while now but have had no luck in finding a solution. I just want to
    send a text email (and not html).

    The other thing is that on the last page but one, this shopping basket
    is displayed. Is there anyway I could capture the html data from that
    page, store it in a session variable and then generate the email after
    the order has been completed (so sort of like sending a mirror of that
    page)? In that case having a HTML formatted email would be ok.


    Many thanks,

    Richard Pain
     
    Richard Pain, Apr 1, 2004
    #1
    1. Advertising

  2. Richard Pain

    Dominique Guest

    My Solution has always been to create a UDF to which i can send parameters,
    which in turn generates the HTML email and sends it.

    In your case, you can just query the data in your hopping basket, and have
    it spit out the rows containing the data you have below.

    Mail me if you want an example of what i'm talking about

    Laterz
    Dominique


    "Richard Pain" <> wrote in message
    news:...
    > OK - I have a shopping basket with data in a database. Once the person
    > has successfully completed their order I want to be able to send them
    > an email with the products ordered roughly in the following format:
    >
    > Product Price Quantity
    >
    > prod1 £6.99 1
    > prod2 £5.99 2
    > Postage £0.50
    >
    > Total whatever..I'm
    > lazy
    >
    > Formatting would be a little different (just spacing out the prod
    > table a little more.
    >
    > Any ideas or links to scripts that do this?. I've been looking for a
    > while now but have had no luck in finding a solution. I just want to
    > send a text email (and not html).
    >
    > The other thing is that on the last page but one, this shopping basket
    > is displayed. Is there anyway I could capture the html data from that
    > page, store it in a session variable and then generate the email after
    > the order has been completed (so sort of like sending a mirror of that
    > page)? In that case having a HTML formatted email would be ok.
    >
    >
    > Many thanks,
    >
    > Richard Pain
     
    Dominique, Apr 1, 2004
    #2
    1. Advertising

  3. Richard Pain

    Richard Pain Guest

    Hmmm - unfortunately I'm using mysql (hosting on linux with chilliasp)

    Thanks

    Richard

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Richard Pain, Apr 2, 2004
    #3
  4. Richard Pain

    Roland Hall Guest

    "Richard Pain" wrote in message
    news:...
    : OK - I have a shopping basket with data in a database. Once the person
    : has successfully completed their order I want to be able to send them
    : an email with the products ordered roughly in the following format:
    :
    : Product Price Quantity
    :
    : prod1 £6.99 1
    : prod2 £5.99 2
    : Postage £0.50
    :
    : Total whatever..I'm
    : lazy
    :
    : Formatting would be a little different (just spacing out the prod
    : table a little more.
    :
    : Any ideas or links to scripts that do this?. I've been looking for a
    : while now but have had no luck in finding a solution. I just want to
    : send a text email (and not html).
    :
    : The other thing is that on the last page but one, this shopping basket
    : is displayed. Is there anyway I could capture the html data from that
    : page, store it in a session variable and then generate the email after
    : the order has been completed (so sort of like sending a mirror of that
    : page)? In that case having a HTML formatted email would be ok.

    Richard...

    How are you sending the email, Sendmail?

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Apr 2, 2004
    #4
  5. Richard Pain

    Richard Pain Guest

    I think it's just 'mail' - the syntax is:

    mail($to, $subject, $body);


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Richard Pain, Apr 2, 2004
    #5
  6. Richard Pain

    Roland Hall Guest

    "Richard Pain" wrote in message news:...
    : I think it's just 'mail' - the syntax is:
    :
    : mail($to, $subject, $body);

    Richard...

    This is PHP.
     
    Roland Hall, Apr 7, 2004
    #6
  7. Richard Pain

    Richard Pain Guest

    Sorry - they've stuck with aspmail after all so the question is still
    relevant to this post.

    Thanks,

    Richard



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Richard Pain, Apr 7, 2004
    #7
  8. Richard Pain

    Roland Hall Guest

    "Richard Pain" wrote in message news:...
    : Sorry - they've stuck with aspmail after all so the question is still
    : relevant to this post.

    Ok, well to make sure you have the right one, there are two that are similar
    in name.

    ServerObjects ASPMail - http://www.serverobjects.com/products.htm#aspmail
    Persits ASPEmail - http://www.aspemail.com/

    If you're not referring to either of these, which server OS is this running
    on?

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Apr 7, 2004
    #8
  9. Richard Pain

    Richard Pain Guest

    It is asp mail. In the end the gits didn't tell me that a page to do
    this had already been written with text formatting and everything. I've
    attached it below to help anyone else who may have the same problem as
    me..


    <%
    if (Session("LoggedIn")<>"yes") then
    response.redirect "adminlogin.htm"
    end if

    response.expires=-1000

    function GetCountry(sCountryCode)
    if (sCountryCode="040") then
    GetCountry = "Austria"
    elseif (sCountryCode="056") then
    GetCountry = "Belgium"
    elseif (sCountryCode="208") then
    GetCountry = "Denmark"
    elseif (sCountryCode="246") then
    GetCountry = "Finland"
    elseif (sCountryCode="250") then
    GetCountry = "France"
    elseif (sCountryCode="276") then
    GetCountry = "Germany"
    elseif (sCountryCode="528") then
    GetCountry = "Holland (The Netherlands)"
    elseif (sCountryCode="372") then
    GetCountry = "Ireland"
    elseif (sCountryCode="380") then
    GetCountry = "Italy"
    elseif (sCountryCode="442") then
    GetCountry = "Luxembourg"
    elseif (sCountryCode="578") then
    GetCountry = "Norway"
    elseif (sCountryCode="724") then
    GetCountry = "Spain"
    elseif (sCountryCode="752") then
    GetCountry = "Sweden"
    elseif (sCountryCode="756") then
    GetCountry = "Switzerland"
    elseif (sCountryCode="826") then
    GetCountry = "United Kingdom"
    end if
    end function

    sOID = request.querystring("OID")
    set cnDB=server.createobject("adodb.connection")
    set rsDB=server.createobject("adodb.recordset")
    set rsDB2=server.createobject("adodb.recordset")
    cnDB.open "etc", "etc", "etc"
    sSQL="UPDATE Orders SET transactionstatus='Confirmed' WHERE OID=" & sOID
    cnDB.execute sSQL

    sSQL="SELECT * FROM Orders WHERE OID=" & sOID
    rsDB.open sSQL, cnDB
    if (rsDB.EOF=false) then

    sbody = "Please do not reply to this email" & vbCrLf & vbCrLf
    sbody = sbody & "Thank you for ordering online at blah" & vbCrLf &
    vbCrLf
    sbody = sbody & "Below is a copy of your order. If you have any
    queries regarding your order please contact us using any of the contact
    means listed on our website." & vbCrLf & vbCrLf
    sbody = sbody & "Your Details" & vbCrLf
    sbody = sbody & "------------" & vbCrLf & vbCrLf
    sbody = sbody & "Firstname " & rsDB("firstname") & vbCrLf
    sbody = sbody & "Surname " & rsDB("surname") & vbCrLf
    sbody = sbody & "Address " & rsDB("baddr1") & vbCrLf
    if (rsDB("baddr2")<>"") then
    sbody = sbody & " " & rsDB("baddr2") & vbCrLf
    end if
    if (rsDB("baddr3")<>"") then
    sbody = sbody & " " & rsDB("baddr3") & vbCrLf
    end if
    sbody = sbody & " " & rsDB("bcity") & vbCrLf
    sbody = sbody & " " & rsDB("bcountyprovince") & vbCrLf
    sbody = sbody & " " & GetCountry(rsDB("bcountry")) &
    vbCrLf
    sbody = sbody & "Postcode " & rsDB("bpostalcode") & vbCrLf
    sbody = sbody & "Telephone " & rsDB("btelephonenumber") & vbCrLf
    sbody = sbody & "Email " & rsDB("email") & vbCrLf & vbCrLf

    sbody = sbody & "Your Order" & vbCrLf
    sbody = sbody & "----------" & vbCrLf
    sbody = sbody & "Invoice E" & sOID & vbCrLf
    sbody = sbody & "Date " & rsDB("EntryDate") & vbCrLf & vbCrLf
    sbody = sbody & "Del. Address " & rsDB("saddr1") & vbCrLf
    if (rsDB("saddr2")<>"") then
    sbody = sbody & " " & rsDB("saddr2") & vbCrLf
    end if
    if (rsDB("saddr3")<>"") then
    sbody = sbody & " " & rsDB("saddr3") & vbCrLf
    end if
    sbody = sbody & " " & rsDB("scity") & vbCrLf
    sbody = sbody & " " & rsDB("scountyprovince") & vbCrLf
    sbody = sbody & " " & GetCountry(rsDB("scountry")) &
    vbCrLf
    sbody = sbody & "Postcode " & rsDB("spostalcode") & vbCrLf
    sbody = sbody & "Telephone " & rsDB("stelephonenumber") & vbCrLf &
    vbCrLf

    sbody = sbody & "Product Price Quantity
    Total Price" & vbCrLf
    sbody = sbody &
    "---------------------------------------------------------------" &
    vbCrLf

    dTotalPrice=0.0

    sSQL = "SELECT * FROM ShoppingBasket WHERE BasketID=" & sOID & " ORDER
    BY EntryDate DESC;"
    rsDB2.open sSQL, cnDB
    do while (rsDB2.EOF=false)
    sbody = sbody & left(rsDB2("ProductName") & " - " & rsDB2("SubCode")
    & " ", 30)
    sbody = sbody & right(" " & FormatCurrency(rsDB2("Price")),
    10) & right(" " & rsDB2("Quantity"), 8)
    sbody = sbody & right (" " &
    FormatCurrency(rsDB2("Price") * rsDB2("Quantity")), 15) & vbCrLf
    dTotalPrice=dTotalPrice + (rsDB2("Price") * rsDB2("Quantity"))
    rsDB2.MoveNext
    loop
    rsDB2.close
    sbody = sbody &
    "---------------------------------------------------------------" &
    vbCrLf
    sbody = sbody & " Nett Total
    " & right(" " & FormatCurrency(dTotalPrice), 10) & vbCrLf
    sbody = sbody & " Carriage
    " & right(" £" & rsDB("delivery"), 10) & vbCrLf
    sbody = sbody & " VAT
    " & right(" £" & rsDB("vat"), 10) & vbCrLf
    sbody = sbody & " Total
    " & right(" £" & rsDB("total"), 10) & vbCrLf & vbCrLf & vbCrLf
    sbody = sbody & "This email does not constitute an order until payment
    has been received." & vbCrLf & vbCrLf

    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = "blah"
    Mailer.FromAddress= "blah"
    Mailer.RemoteHost = "blah"
    Mailer.AddRecipient rsDB("firstname") & " " & rsDB("surname"),
    rsDB("email")
    Mailer.Subject = "product order"
    Mailer.BodyText = sBody
    Mailer.SendMail
    Set Mailer = Nothing

    end if
    rsDB.close
    set rsDB=Nothing
    set rsDB2=Nothing

    cnDB.close
    set cnDB=nothing
    response.redirect "adminorders.asp"
    %>


    Many thanks for your interest,

    Richard

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Richard Pain, Apr 8, 2004
    #9
  10. Richard Pain

    Roland Hall Guest

    "Richard Pain" wrote in message
    news:%23Dd3%...
    : It is asp mail. In the end the gits didn't tell me that a page to do
    : this had already been written with text formatting and everything. I've
    : attached it below to help anyone else who may have the same problem as
    : me..
    :

    Ah, regular ASP mail.

    I'm not sure what a git is but it doesn't sound good. (O:=
    Thanks for responding with the solution Richard.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Apr 8, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: BEST WAY TO implement shopping basket

    Kevin Spencer, Aug 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    412
    Kevin Spencer
    Aug 5, 2003
  2. Samuel Shulman

    Shopping Basket

    Samuel Shulman, Sep 11, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    475
    Grant Merwitz
    Sep 12, 2006
  3. Jamie Allison

    Shopping Basket

    Jamie Allison, Mar 5, 2007, in forum: HTML
    Replies:
    3
    Views:
    359
    Adrienne Boswell
    Mar 7, 2007
  4. sam.thescorpions
    Replies:
    1
    Views:
    390
    shawpnendu
    May 17, 2009
  5. Rob Meade

    Shopping Basket / Sessions

    Rob Meade, Jun 8, 2006, in forum: ASP General
    Replies:
    4
    Views:
    186
    Anthony Jones
    Jun 9, 2006
Loading...

Share This Page