www.webdeveloper.com
Results 1 to 3 of 3

Thread: Shopping Cart advice needed

  1. #1
    Join Date
    May 2014
    Posts
    1

    Shopping Cart advice needed

    I just started learnig PHP, through tutorials and i am stuck with shopping cart. Is it even possible to do this what i want. On my site there will not be price of products just quantity and i want to make, when somebody chose products, enter how much of them he wants, type his personal data and press BUY all that comes to my e-mail and then i will call them or something, there is no payment system on my site. Because my English is bad i made this little picture to see if you dont understand me. I allready have database, allmost whole design completed this is last thing i need for my site. My problem is that, i don't have any idea how to make this, so if somebody can point me to good tutorial for that or something else, part of code, idea how to do that, or anything that can help me , it will be helpful for me. Maybe i am aking too much here, but thank you anyways. Cheers

    Here is the link for picture http://tinypic.com/view.php?pic=98zj36&s=8#.U3UKPfl_sVg

  2. #2
    Join Date
    May 2014
    Posts
    1
    Yes it is possible, You can design/code and make the site work the way you want to.
    I suggest you to make an Orders Panel and Admin Control Panel for that instead of having email's from the customers. That would be better for the users too, They can track their orders which which will be user friendly and it will increase your sales.

  3. #3
    Join Date
    May 2014
    Posts
    3
    This is a simple example that will do what you're looking for. However i do agree with harsimarriar96. The best way to accomplish this is to store the user purchases in a database and administer through an administration panel. This allows for much more functionality (for example, maybe you want to alert someone who purchased an item a month ago that you have put that same item on sale?).

    This is very simple code and you will have to modify to get it exactly how you want it. I didn't include all of the fields, but enough to where you should be able to see whats going on:

    Code:
    <html>
    <head>
    	<title>Yep</title>
    </head>
    <body>
    	<form id="simpleForm" action="process.php" method="post">
    		<!-- Quantity Box-->
    		<input type="text" name="quantity"/>
    		
    		<!-- Customer Name -->
    		<input type="text" name="cusName"/>
    		
    		<!-- Customer Email -->
    		<input type="text" name="cusEmail"/>
    		
    		<!-- Submit button that posts the form to action attribute. In this case process.php-->
    		<input type="submit" value="submit"/>
    	</form>
    </body>
    </html>
    
    
    <?php
    
    /* process.php
    -----------------------------------------------------------------*/
    
    //Obtain data sent to file via http POST
    $quantity = $_POST['quantity'];
    $name = $_POST['cusName'];
    $email = $_POST['cusEmail'];
    
    //Create email to send 
    $to = 'YOUR-ADDRESS@place.com';
    $subject = 'Someone purchased something';
    
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: Customer Purchase <' . $email . '>' . "\r\n";
    
    //use this if you want the email to be cc'd to others
    $headers .= 'Cc: associate1@place.com, associate2@place.com' . "\r\n";
    
    //The message
    $message = 'Name: ' . $totalApprovals . '<br/>';
    $message .= 'Quantity: ' . $quantity . '<br/>';
    
    
    //Send email
    mail($to, $subject, $message, $headers);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles