Forum Moderators: coopster

Message Too Old, No Replies

javascript to shopping cart

don't want to reload the page

         

louponne

7:37 am on Feb 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm working on a site that offers information to users. On each page, there are certain products that they can ask about. Not actually selling, just offering information.

Now I want users to be able to record which products interest them, so that when they reach the message form, those products come back up, and are sent automatically, within the message. So basically, like a shopping cart, but without the on-line purchase aspect.

But I'd like to do this without reloading the page, as I've seen done on some shopping sites. I'd also like the list of recorded products to appear in the upper-right corner on the page. In other words, I click on a "this interests me" button, and the said item is added to a visible list in the upper right corner. At the same time, it's recorded (in a session variable?) so that the list is shown from page to page, and of course appears on the message form.

What's the best approach to this?

jatar_k

5:08 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if you don't want to reload the page when the user selects something then you could use js to add the info to a cookie.

Then you could either read the cookie on every page and drop the data into the session or you could just leave it as a cookie and use js only.

louponne

5:24 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yes, I'd thought of using a javascripted cookie, but was hoping to avoid that. Is there any way to trigger a php function that would manage the session variable, via an onclick event?

jatar_k

5:31 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



not without reloading the page

php is server side so with out sending something to the server it just doesnt care.

louponne

5:49 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, here's an idea. I have a friend who doesn't have stats nor php on his site, so I I put a fake 1px x 1px "image" on his site that instead of being his_image.gif, is set to call as its src:
htt#://www.my_domaine.com/script/his_stats.php
That php script, on my own domain that does have php, runs stats on the referer url that calls it and seems to be running ok, although I certainly haven't testing it extensively.

Now that's fine for something like stats that are not mission-critical as far as the site is concerned - but how about this present situation? I mean this has to work for the site to be functional. Could I similarly, say, javascript-trigger a reload of an "image" that would actually be a php script managing my session variable?

Is this just plain stupid?

jatar_k

6:00 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



nothing's ever stupid. :)

Try it, it sounds interesting but would need some testing.

moebass

10:09 pm on Feb 11, 2004 (gmt 0)



I would like to suggest use of non-parsed headers to accomplish updating of the session variable without fully refreshing the page.
The process would still rely on javascript to update the user's view of the page, then submit "a" form to the non-parsed-headers script page which would leave the page as it is, yet update the session variable.

louponne

10:16 pm on Feb 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would like to suggest use of non-parsed headers to accomplish updating of the session variable without fully refreshing the page.

wow, that sure sounds intriguing! But, um, what does it mean? I did a ggle-search on "non parsed headers php" and came up with very little - care to elaborate?