Jump to content

add into basket


robert_gsfame

Recommended Posts

I wonder how can we create "add into basket", what are they actually using...session or cookies?? then how to create multiple session or cookies??

 

thanks in advance

 

You need to do some reading on PHP Sessions. Yes sessions are used to create a shopping basket application. Cookies are also used but the cookie part is usually behind the scenes and PHP does this automatically for you. A cookie is used to store the session ID on the users computer, which is then transmitted to the server with each page request.

Link to comment
Share on other sites

If i let any users including visitors without registration needed which means that no SESSION ID is required...so i only need to create cookie based on what product they're choosing....is that correct?

 

You'll need a session regardless of whether the user is registered or just a guest. You would not normally store a reference to the product in a cookie. Normally the basket items are stored in the session like here for example, this would add a product to the basket array in the session:

 

$_SESSION['BASKET']['ITEMS'][] = array('product_id' => 1234, 'product_name' => 'Shoes', 'qty' => 1);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.