Jump to content
Sign in to follow this  
rajen

ASP Help

Recommended Posts

Hi,

 

I am trying to update the shopping cart's asp code so that each time order is placed the full order details and price e.g. Invoice goes to the customers. Can anyone give me a valuable suggestion so that all the orders also can be sent by email.

 

Following is the current codes which work perfectly fine and sends a simple email alert when order is placed.

 

Please suggest me a modified code. Many thanks.

 

 

' Add new address & payment info

updateUser

 

' Begin A Transaction

Con.BeginTrans

 

' Transfer cart to orders table

sqlString = "INSERT INTO orders (" &_

"order_id, " &_

"order_productID, " &_

"order_quantity, " &_

"order_userID, " &_

"order_entrydate, " &_

"order_status " &_

") SELECT " &_

"cart_id, " &_

"cart_productID, " &_

"cart_quantity, " &_

"cart_userID, " &_

"NOW(), " &_

"0 " &_

"FROM cart WHERE " &_

"cart_userID =" & userID

 

Con.Execute sqlString

 

' Empty shopping cart

sqlString = "DELETE FROM cart " &_

"WHERE cart_userID=" & userID

 

Con.Execute sqlString

 

' End the transaction

Con.CommitTrans

 

' Send Email Notification

sqlString = "SELECT user_username, user_email " &_

"FROM Users " &_

"WHERE user_id=" & userID

Set RS = Con.Execute( sqlString )

Set Mail = Server.CreateObject("Persits.MailSender")

Mail.Host = "email.bransonworldplc.com"

Mail.FromName = "Branson Online Store"

Mail.From = "info@bransonworldplc.com"

Mail.AddAddress RS( "user_email" )

Mail.Subject = "Thank you for your order!"

Mail.Body = "Dear " & RS( "user_username" ) &_

"!" & vbNewline &_

"Thank you for ordering through " &_

"Branson World PLC Website!" & vbNewline &_

"Your order has been successfully placed." & vbNewline &_

"PLEASE DELETE THIS EMAIL. THIS IS FOR TEST PURPOSE -RAJEN"

On Error Resume Next

Mail.Send

 

%>

Order Placed

logo.GIF

cellpadding=10 cellspacing=0 style="border-collapse: collapse" bordercolor="#111111">


Thank you for placing your order!

You can track the status of your order
at any time by clicking
account at the
top of most store pages.







 

Share this post


Link to post
Share on other sites

i briefly looked at ur problem,,i think u need to modify ur SQL stmt..something like this..........

 

' Send Email Notification

sqlString = "SELECT * " &_

"FROM Users, CART, ORDERS " &_

"WHERE USERS.USER_ID = CART.CART_USERID "&

" AND ORDERS.ORDER_USERID = CART.CART_USERID '&

"AND USERS.user_id=" & userID

Set RS = Con.Execute( sqlString )

Set Mail = Server.CreateObject("Persits.MailSender")

Mail.Host = "email.bransonworldplc.com"

Mail.FromName = "Branson Online Store"

Mail.From = "info@bransonworldplc.com"

Mail.AddAddress RS( "user_email" )

Mail.Subject = "Thank you for your order!"

Mail.Body = "Dear " & RS( "user_username" ) &_

"!" & vbNewline &_

"Thank you for ordering through " &_

"Branson World PLC Website!" & vbNewline &_

"Your order has been successfully placed." & vbNewline &_

"PLEASE DELETE THIS EMAIL. THIS IS FOR TEST PURPOSE -RAJEN"

On Error Resume Next

Mail.Send

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.