Forum Moderators: coopster

Message Too Old, No Replies

Shopping cart with ajax

         

wheel

8:11 pm on Apr 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm looking at having a pricing calculator built in ajax, with php on the backend.

I'm not conversant with ajax, but am familiar with the basic concept. I'm trying to get an idea if what I want to do is difficult, or how to approach it.

Let's say I have a form on my site that allows the visitors to check off options for the product. As they change their options in the form, the 'total' price is constantly updated, using ajax which will hit a php script with pricing tables on my server. Easy enough I'm sure.

Now, I want their current selection to remain static in the form as they change pages on the site. So if they run a pricing calc, then go look at an options page on the site, the new options page remembers their previous calculations and displays it automatically.

I'm guessing that this will be done somehow with cookies? Is that what I should do? have cookies remember the current selection, update the cookie every time they change an option, and check the cookie every time the form is generated? Or is there a more sensible way to have this set up.

belfasttim

10:20 pm on Apr 21, 2009 (gmt 0)

10+ Year Member



sorry if I'm misunderstanding, but wouldn't you just use php session variables? Start a session, then only write the values to the session vars after they select things-- so you can run the calc as you said, using ajax to call your php pages, and display the values all "ajaxy"-- but have an "accept" button or something that will then save those ajax-generated values to the session if they want to keep it.