Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Javascript Trouble with Shopping cart function

    Hi all,

    Like many here, i am a novice. i have read alot and gone through tutorials and actually have a good grasp of how functions, arrays, DOM and so on work.
    But i just can't put all the elements i have learn't together to create my shopping cart site.

    I’ll give you an over view of what I have to do, then what’s trouble me:

    • Display of a few toys on a single web page with their name, image and price and a drop down menu to allow the user to select a desired quantity of each toy.

    • Add to Shopping Cart – A button (“Add to Cart”) should appear either next to each toy or one for the entire page so that when clicked the desired quantity of each toy can be added to the shopping cart, by executing the appropriate event handler method and invoking the Javascript function AddToCart().

    • AddToCart() function should do the following: i) Store the name of each toy, quantity and sum (calculated by quantity*price) in three global arrays name[],quantity[] and sum[].

    • A “view shopping cart” button should also appear on the page so that when clicked the appropriate event handler method is executed which will invoke the Javascript function ViewShoppingCart(). The ViewShoppingCart() function should display the the contents of the user’s shopping cart in the form of a dynamically generated table. Each row of the table should display the name of the toy, the quantity, the price and the sum (quantity*price) which is present in the shopping cart. Finally the total price of all toys in the shopping cart should be displayed at the end of the table.

    • The ViewCart() function should do the following i) Iterate (loop) through the three arrays name[],price[] and sum[] and display the elements of the three arrays in the cells of a dynamically generated table. The total sum of the shopping cart should also be displayed somewhere at the end of the table.

    I would really appriciate some pointers on how to tackle this problem.

    Thankyou in advanced

    Matt

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    First at all you need a database, a relational database management system (RDBMS) to handle that DB, a sever language which will make queries to that DB.

    Probably the easier (mainly because it is freeware) is to use Apache as server, MySQL as DB / DB management system, and PHP as the server-side language. PHP/MySQL, by short.

    The JavaScript toys are rather irrelevant in this equation. Maybe if you need an asynchronous query, in which case you may use AJAX as technique.

    Do you know all these? If not, it is time to learn them. Or to hire a professional.

    After learning at least the basis of those languages/RDBMS, you may shorten the implementation time on using a framework. For PHP/MySQL you may use templates created in Drupal. Or in Joomla. Google for.

    Of course, you must know also (at east at average level) HTML/XHTML, CSS, Javascript and, probably XML.

    It is hard for a single inexperienced beginner. Usually this kind of product (e-commerce site) is to be done in a team. At least 2 people: 1 designer& client-side programmer (Photoshop, HTML, CSS, JavaScript, AJAX) and 1 server-side admin and programmer (Apache/PHP/MySQL).
    Last edited by Kor; 05-04-2010 at 03:15 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can anyone provide the code for the Shopping cart function and view cart function? I'm a novice and would like to have an idea of it as I'm doing something similar.

    Or pointers on code, etc, anything would help!

    Thanks!

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by chicawapa View Post
    Can anyone provide the code for the Shopping cart function and view cart function? I'm a novice and would like to have an idea of it as I'm doing something similar.

    Or pointers on code, etc, anything would help!

    Thanks!
    Hm. How can you start creating a a Shopping cart without basic knowledge. Do you think that there is an "Universal Code for Shopping Cart", or similar, which you can simply stick to a site?

    A shopping cart is a multi-language application - an inter-relational relationship between a server data base, a server-side language and client-side languages.

    What kind of DB do you have? What server-side languages runs on your server? Do you know those languages? Have you read my previous post?
    Last edited by Kor; 03-18-2011 at 03:07 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Tags for this Thread

    Posting Permissions

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