How to put the "add to cart form" to my pages??

Discussion in 'HTML & Website Design' started by Laszlo, Nov 22, 2005.

  1. #1
    :eek: Hi everyone.

    I have a very important question about the “add to cart form”.

    I never sold anything on my site and I just start it now. I already created some pages with the product description but I don’t know how to put the “add to cart form” to my WebPages. If you could provide me with a tutorial or an htlm example how the form code looks like I would appreciate it very much. Is there anything particular that I have to do with the form if I want to have a shopping cart? Do I have to customize the add to cart forms for every each of products?
    I copied an example for a shopping cart from a website I highlighted the parts that I would need a little explanation.

    <form name="prod-342" method="post" action="http://www.yourdomain.com/addtocart.php">
    <input type="hidden" value="1" name="redirect0">
    <input type="hidden" value="productID-70" name="productID-342">
    <input size="2" value="1" name="qty-343">
    <img border="0" src="../addtocart.jpg" width="88" height="25" align="bottom">
    <br><font face="Verdana" size="2"><strong>
    </tr>
    </form>
    I know this is a very newbie question but I need help with this very much.
    Can somebody please help me? Thanks a lot much Laszlo.
     
    Laszlo, Nov 22, 2005 IP
  2. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You will need an sql database of products and a shopping cart script to do this, try www.oscommerce.com if you want a free php one.

    This is not as simple as just adding a few pages to your site - you could code this yourself if you want a simple script but if you want a good online shop you should go with a proper solution.
     
    dave487, Nov 23, 2005 IP
  3. Laszlo

    Laszlo Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes I am already considering the shopping cart system from litecommerce.com
    But my question is about the add to cart form.

    How should I place that in my pages????

    I already have a few since I copied them from an other website but it doesen't work.


    Please help me please .
     
    Laszlo, Nov 23, 2005 IP
  4. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    to answer your specific questions in your first post:


    <form name="prod-342" method="post" action="http://www.yourdomain.com/addtocart.php">

    the form action is basically the page that your form is sent to. in this case, once the user submits the form, the form variables will be sent to "http://www.yourdomain.com/addtocart.php". you will need to replace this url with the shopping cart url that receives your form submissions.

    <input type="hidden" value="productID-70" name="productID-342">

    that's a hidden field - passing the above-mentioned url a form variable, named "productID-342", the value "productID-70". this would be similar to passing a field named "shoe_size" the value "10.5 wide".

    I know nothing about litecommerce.com, but in answer to your question, "Do I have to customize the add to cart forms for every each of products? ", the answer is yes, each shopping cart form should pass unique variables to identify what the visitor to your site is purchasing, i.e. shoe size, color, style, price, etc... so the shopping cart page will know what the person is trying to buy.

    I would suggest, if you are going to use litecommerce.com, that you do a little research on their website. I'm sure they have tutorials that explain specifically what sort of variables their product is looking for - but there's a whole lot of other stuff involved. Are you tracking your inventory? Are you accepting CC's? Are you doing real-time CC transations? Do you have a payment gateway? A product database?

    Sounds like you've got your homework to do bud, but be patient. It'll take some time. if you haven't made up your mind yet, you might take dave487's advice and give oscommerce a try. it's pretty popular, free, and there's alot of user support for it via other users of the product.

    Good luck,

    VG
     
    vectorgraphx, Nov 23, 2005 IP
  5. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #5
    one last thought - re-reading your post - you seem to be asking "how can i make my 'add to cart' image function as a submit button?" if that's the case, you'll need to modify your code as below:

    
    <form name="prod-342" method="post" action="http://www.yourdomain.com/addtocart.php">
    <input type="hidden" value="1" name="redirect0">
    <input type="hidden" value="productID-70" name="productID-342">
    <input size="2" value="1" name="qty-343">
    <input type="image" src="../addtocart.jpg" width="88" height="25" value="Submit" alt="Submit"  align="bottom">
    
    <br><font face="Verdana" size="2"><strong>
    </tr>
    </form>
    
    Code (markup):
    just replace the form variables with your product variables as described above. this code i gave you will turn your "add to cart" image into a submit button.
     
    vectorgraphx, Nov 23, 2005 IP
  6. Laszlo

    Laszlo Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Woaow. This is what I needed. Thank you very much. Vectorgraphx. And of course everyone who contributed. I will check out oscommerce. How come it is free? Others charges even 100 dollars for it.
    Yes I know that I have a long way to go. I have about 2000 different products to sell. It is gonna be a printer supply website.
    But if I don’t do it anybody else will instead of me. Thanks again. Peace Laz.
     
    Laszlo, Nov 23, 2005 IP
  7. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #7
    it's free, because it's opensource, hence the name "OS" Commerce.

    You're welcome, by the way :) hope you get it all sorted out.

    VG
     
    vectorgraphx, Nov 24, 2005 IP
  8. Laszlo

    Laszlo Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I tried to upload Zen Cart but the more I read myself thought their installation process the more confused and intimidated I am. Firs of all I have to have access to a MySQL database, and username/password to that database. Well I downloaded the file: /apache2triad/apache2triad1.4.3.exe but I am not sure if it is the database that is in question.

    2,Upload the Zen Cartâ„¢ fileset to your webserver. Well I am not sure if this would be better on my computer or on my webhost webserver.

    Well the rest is also confusing but first I would need some advice on where to download the shopping cart system. To my computer or the webserwer.

    My head is spinning. I am sure I won’t be able to do this by myself. I wish I would know training on this topic.
     
    Laszlo, Nov 26, 2005 IP