Help creating a very basic shopping basket for a website.

HI all,

I need some help creating a very basic shopping basket on a website. Basically all that is needed to happen is you have a list of items with a quantity box, the visitor can fill in the amount of each item they want, click 'send' or 'order' and the amount is collated into a very basic basket which then has fields for the customer to fill in contact details then click 'order' or 'send' again and all that does is send an email to a recipient.
That is it! Nothing more, nothing less, issue being I don't know how to do it  lol

Not sure on the best method to employ to do this, have been told ASP.net is good, so I've downloaded and installed Microsoft Visual Web Developer - which seems cool.

I'm OK with HTML and CSS, but have little to no experience with ASP, or any other programming language so any help would be greatly appreciated. I can't see this being majorly difficult, just awkward for someone not knowing the details behind anything other than HTML or CSS.

Thanks in advance.


Nicola_BourneAsked:
Who is Participating?
 
samtran0331Connect With a Mentor Commented:
This site has just about everything you need to know about sending email in ASP.Net
http://www.systemnetmail.com/faq/4.1.aspx
http://www.systemnetmail.com/faq/2.4.aspx

use the "Home" link on the left to go back to the main page if you have other email questions...
0
 
Aurora27Commented:
If you are doing ASP.NET, then you can actually store the *item numbers* if they are unique in some session variables and then build the info. abt items ordered everytime the shopping cart pages comes up..based on that...

If you have a user logged in for that, then simply store it in a db table and reference it anytime you want too. Like,w hen they add an Item, add to ShoppingCart table for that user and then pull it up..its like anyother master/details tables logic.

CT.
0
 
Nicola_BourneAuthor Commented:
Bare in mind I don't know any ASP, I don't have the need for users to create accounts or log in etc, I would guess that it is simple a case of visiting the site, seeing that you want say 2 of item A, 3 of item B and 6 of item C, click GO and then type in your name, number and address and click SEND. Maybe not even that complicated. Simplicity is the key here :) (Mainly because I am quite simple!!!  lol)


0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
samtran0331Commented:
>>I'm OK with HTML and CSS, but have little to no experience with ASP, or any other programming language

That being the case, I'd suggest you pick a technology and find open source e-commerce project.
That way you don't have to start from scratch.

Since you need "simple"...you might not even have to modify anything in the projects except the visuals.

ASP.Net:
http://www.asp.net/community/projects/
*the second and third projects both have cart functionality.
0
 
Nicola_BourneAuthor Commented:
I have had a look through some examples on the web last night, and employed something I found into my site, only I'm having a little trouble getting it to work properly!

Basically the example that I found on the web is a simple form that has 3 text boxes and 2 buttons.
[Name], [EMail] and [Text].
The two buttons are [Send] and [Reset].

The sample code basically sends the information in each of the text boxes to a set email address within the code.

This is great, only the sample code doesn't include any syntax for SMTP server authentication, such as username and password.

So I scnaned the web again for such syntax's and stuck them in, I get zero Errors, warnings or messages from the Visual Web Developer app I'm using to write this stuff, but it fails to work when I'm testing it. It carries straight to the end of the code where it prints a message to the screen stating that "Sending email failed".

Again, I'm very new to this, so I appologise in advance for my sheer level of ignorance!

 [DEFAULT.ASPX.CS]

using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page
{
    #region  "Send email"
    protected void btnSendmail_Click(object sender, EventArgs e)
    {
        // System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0
        // System.Net.Mail.SmtpClient is the alternate class for this in 2.0
        SmtpClient smtpClient = new SmtpClient();
        MailMessage message = new MailMessage();

        try
        {
            MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);

            // You can specify the host name or ipaddress of your server
            // Default in IIS will be localhost
            smtpClient.Host = "xxx.xx.3.98";
            smtpClient.Credentials = new System.Net.NetworkCredential("**********",
                                     "**********");
                       
            //Default port will be 25
            smtpClient.Port = 25;

            //From address will be given as a MailAddress Object
            message.From = fromAddress;

            // To address collection of MailAddress
            message.To.Add("username@domain.co.uk");
            message.Subject = "TEST";

            // CC and BCC optional
            // MailAddressCollection class is used to send the email to various users
            // You can specify Address as new MailAddress("admin1@yoursite.com")
            //message.CC.Add("admin1@yoursite.com");
            //message.CC.Add("admin2@yoursite.com");

            // You can specify Address directly as string
            //message.Bcc.Add(new MailAddress("admin3@yoursite.com"));
            //message.Bcc.Add(new MailAddress("admin4@yoursite.com"));

            //Body can be Html or text format
            //Specify true if it is html message
            message.IsBodyHtml = false;

            // Message body content
            message.Body = txtMessage.Text;

            // Send SMTP mail
            smtpClient.Send(message);

            lblStatus.Text = "Email successfully sent.";
        }
        catch (Exception ex)
        {
            lblStatus.Text = "Send Email Failed.<br>" + ex.Message;
        }
    }
    #endregion

----------------------
I have now changed the last bit of the code above from:

       lblStatus.Text = "Send Email Failed.<br>" + ex.Message;

to:

       lblStatus.Text = ex.ToString();

Which results in this load of 'stuff' being outputted to the screen, which I simply do no understand! lol

       
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.btnSendmail_Click(Object sender, EventArgs e) in c:\Documents and Settings\Dale\My Documents\Visual Studio 2005\WebSites\WebSite3\Default.aspx.cs:line 58

using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
 
public partial class _Default : System.Web.UI.Page
{
    #region  "Send email"
    protected void btnSendmail_Click(object sender, EventArgs e)
    {
        // System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0
        // System.Net.Mail.SmtpClient is the alternate class for this in 2.0
        SmtpClient smtpClient = new SmtpClient();
        MailMessage message = new MailMessage();
 
        try
        {
            MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);
 
            // You can specify the host name or ipaddress of your server
            // Default in IIS will be localhost 
            smtpClient.Host = "xx.xx.15.102";
            smtpClient.Credentials = new System.Net.NetworkCredential("login",
                                     "password");
                        
            //Default port will be 25
            smtpClient.Port = 25;
 
            //From address will be given as a MailAddress Object
            message.From = fromAddress;
 
            // To address collection of MailAddress
            message.To.Add("username@domain.co.uk");
            message.Subject = "TEST";
 
            // CC and BCC optional
            // MailAddressCollection class is used to send the email to various users
            // You can specify Address as new MailAddress("admin1@yoursite.com")
            //message.CC.Add("admin1@yoursite.com");
            //message.CC.Add("admin2@yoursite.com");
 
            // You can specify Address directly as string
            //message.Bcc.Add(new MailAddress("admin3@yoursite.com"));
            //message.Bcc.Add(new MailAddress("admin4@yoursite.com"));
 
            //Body can be Html or text format
            //Specify true if it is html message
            message.IsBodyHtml = false;
 
            // Message body content
            message.Body = txtMessage.Text;
 
            // Send SMTP mail
            smtpClient.Send(message);
 
            lblStatus.Text = "Email successfully sent.";
        }
        catch (Exception ex)
        {
            lblStatus.Text = ex.ToString();
        }
    }
    #endregion
 
    #region "Reset"
    protected void btnReset_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        txtMessage.Text = "";
        txtEmail.Text = "";
    }
    #endregion
}
 
 
 
 	
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.btnSendmail_Click(Object sender, EventArgs e) in c:\Documents and Settings\Dale\My Documents\Visual Studio 2005\WebSites\WebSite3\Default.aspx.cs:line 58

Open in new window

0
 
Nicola_BourneAuthor Commented:
Thanks very much for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.