473,508 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shopping cart

Hi,

I hope someone can help me make a working shopping cart, as a learning tool.

If I have a "Product Demo" html page with a "Buy Me" button, there must be
a simple javascript method of storing the necessary product information. There
could be several fields involved... [ price; quantity; product ID number;
manufacturer; the list could go on and on]

Then there ought to be another javascript method that can create a new
document based on the list a user has built selecting product from several
of thos "Buy Me" buttons.

That appears to me where my brain always farts! I can't seem to get my mind
wrapped around how Javascript carries any variables around from one page
to another.

Once I do this and understand it, I'll be happy to jump into the several full
shopping cart examples..... but catalogs and databases are beyond me at
this point.

I just want to follow the K.I.S.S. principal to understand the very basics.

Anyone care to help me here?

Regards, and many thanks for even considering this post

Paul B.
Jul 20 '05 #1
2 3289
"Paul Bruneau" <bruneaup@NO_SPAM_rogers.com> wrote in message
news:66********************************@4ax.com...
Hi,

I hope someone can help me make a working shopping cart, as a learning tool.
If I have a "Product Demo" html page with a "Buy Me" button, there must be
a simple javascript method of storing the necessary product information. There could be several fields involved... [ price; quantity; product ID number; manufacturer; the list could go on and on]

Then there ought to be another javascript method that can create a new
document based on the list a user has built selecting product from several
of thos "Buy Me" buttons.

That appears to me where my brain always farts! I can't seem to get my mind wrapped around how Javascript carries any variables around from one page
to another.

Once I do this and understand it, I'll be happy to jump into the several full shopping cart examples..... but catalogs and databases are beyond me at
this point.

I just want to follow the K.I.S.S. principal to understand the very basics.
Anyone care to help me here?

Hi Paul,

In reality, no useful shopping cart can be handled entirely by client-side
JavaScript. The concept you're trying to understand doesn't make any sense
because you're missing the most important part of the equation. What you
need to start learning is server-side scripting/execution. If I were you,
I'd start Googling around the Internet looking for information about PHP
(php.net is a good place to start). It is probably one of the easiest
server-side execution environments to learn and its scripting language
(Zend) is very similar to JavaScript. PHP has been attracting a huge
following over the last two years and is now deployed on most web hosting
providers' web servers. PHP runs very well on Windows-based/IIS web
servers, but it is intended to run as a built-in Apache module on the Apache
web server for Unix operating systems. PHP's strengths over other scripting
environments is that it's very fast (as an Apache module) and was built upon
an SGML document model that makes it very friendly with all types of data
transport models (it can be "woven" into an HTML page without requiring
archaic server-side includes or fully script-generated documents).

Now that you've heard my sales pitch, you'll also want to learn as much as
you can about HTTP. It's such a simple, no-frills protocol that it's
amazing how few people really take the time to understand what's going on
"under the hood."

HTTP allows for several data request and supply methods that make passing
information between pages trivial. In a nutshell, there are two important
request methods: GET and POST. The GET method is the most common (since all
requests that aren't explicitly set to POST are queried as a GET request).
A GET request can be as simple as asking for an HTML document:

GET /index.html HTTP/1.1

and can be as complex as a key/value list of data:

GET /processor.php?id=123&fullname=Bob+Johnson&phone=55 51212&favcolor=blue
HTTP/1.1

In an anchor tag in an HTML document, you can issue GET queries statically:

<a href="dosomething.php?operation=play+a+game">Play a Game!</a>

The other method is POST. This is most typically used when you want to send
a lot of data to the server through an HTML form:

<form method="post" name="post_test" action="processor.php">
<input type="text" name="id" value="123" />
<input type="text" name="fullname" value="Bob Johnson" />
<input type="text" name="phone" value="5551212" />
<input type="text" name="favcolor" value="blue" />
<input type="submit" name="submit_button" value="Submit" />
</form>

Any of these request methods will send a list of data to the server. In the
GET method, this is sent as plain text in the URL (simple). In the POST
method, this is sent as plain text in the request header (more complicated,
but nothing we have to worry about since the browser constructs the POST
request).

These examples just touch the surface. To understand how to use them,
you'll need to learn a server-side execution environment.

If you want a list of some of the popular server-side execution
environments, here you go:

PHP, Perl, JSP, ASP[.NET]*, C#*

*Indicates a proprietary language specific to M$-based web servers. PHP,
JSP, and especially Perl are very powerful, open-source (free) solutions
that are available to any web server that wants to support them (even M$
"servers"). ASP (in all of its incarnations) and C# take a lot of voodoo to
work on anything but a Windows "server."

If you want a history lesson, learn Perl: it's slow unless the server has
been really tweaked and tuned to run Perl efficiently. Even then, some
things are just easier with Perl, so it's a nice tool to have in the box.
If you want to spend time compiling programs like you would in C, JSP is
nice. JSP (using the Java programming language) can be difficult to use
unless you're used to ADTs and OOP in C++. ASP was created with the idea
that you can use any programming language to construct server-side
applications. Out of the box, IIS servers allow you to code ASP using
JScript (a close, but not identical, cousin to JavaScript) and VBScript
(M$'s idea of a scripting language based on Visual Basic). I've never used
C#, so I don't know the advantages of it over other scripting/programming
paradigms. I just know that Visual Studio isn't free or cheap. (IMHO,
_that_ is why all of the M$ proprietary solutions will never be able to
compete with stronger, faster, and more reliable alternatives that cost
absolutely nothing.) Out of the box, PHP supports one scripting language
(Zend: a JavaScript-like language). PHP is starting to mature as a product
and will probably become the dominant server-side execution environment for
all of the Apache-based web servers (more than 50% of all the web servers on
the Internet). So far, PHP has never let me down in features and
capabilities. You can do everything from printing the current date in the
corner of an HTML document to progrmatically generating Flash, images, and
PDFs on the fly. Coupled with MySQL (one of the leading open-source
database management systems), you can create advanced web applications (like
shopping carts) with ease.

Hopefully, this has given you some direction in learning how to develop
web-based applications. I should tell you that jumping right into a
shopping cart will be a rather intense experience. Given the amount of
browser and server interaction that is required in building a robust
shopping cart, this is arguably one of the most difficult web applications
you can develop. Start small (like a news system or content management
system) and work your way up to things like shopping carts and online
community systems.

Good luck and take care,
Zac
Jul 20 '05 #2
On Thu, 24 Jul 2003 12:52:24 GMT, Paul Bruneau <bruneaup@NO_SPAM_rogers.com>
wrote:
Hi,

I hope someone can help me make a working shopping cart, as a learning tool.
Blah
Blah
Blah
Blah


Thanks Zac.

You took a fair bit of time to write back to me. I thought it a great piece of
advice and will play with php scripts for the nhell of it. First time didn't
work, so I must have misunderstood where to put the commands.

In any event, you took the time to compose a nice letter of advice, and with
nothing to loose I'm gonna play with it... to see if I can manage to move
significant information from page to page.

Clearly, if I can't draw an HTTP page with php I can with Javascript, so who
knows what can happen?

Many THyanks Zak
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2845
by: Don Grover | last post by:
I am retrieving costs and product id's from a sql db. and need to build a shopping cart around it. How do I store the selected items and qty req so I can move into another catalog and total up as...
1
3564
by: madison | last post by:
Hi, I am trying to start a website using paypals shopping cart function. If i have 10 items and they sell out, how do I make it so the item is then listed as sold out. The next person would not...
1
1795
by: Jia Sun | last post by:
hello , everybody , i need a similar program , just like fancyimport.com if possible, pls contact me ,thank you very much . inchina@gmail.com
1
3201
by: Adil Akram | last post by:
I have created a site shopping cart in ASP.net. I am using ASP session object's SessionID on non SSL connection to track session. While adding products to cart DB I insert product and SessionID...
2
2283
by: G.E.M.P | last post by:
High Level Session Handling Design for a Shopping cart 0) What am I missing? 1) How does OSCommerce do it? I'm thinking about building a shopping cart from scratch, using a library of dynamic...
7
2620
by: isaac2004 | last post by:
hi i have a basic asp page that acts as an online bookstore. on my cart page i am having trouble generating 3 numbers; a subtotal, a shipping total, and a final price. here is my code i would...
1
7264
by: jecha | last post by:
I'm implementing a shopping cart but am having a problem in checking out a person who has added item in his/her shopping busket.The code for the checkout.php script is given below <?...
15
4261
gregerly
by: gregerly | last post by:
Hello, I once again turn to this community of genius' for some help with a problem. I've got a shopping cart (which is working well so far) that I will be implementing all kinds of AJAX...
3
2882
by: Paulo | last post by:
Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart concept on my application? When the user clicks add item, it will be stored on some storage format, I dont know what is the...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.