Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

where shop cart holds info before login?


Recommended Posts



Can someone please explain how & where the shopping cart holds the info before the login is done and where that is located at?


Your help is greatly appreciated!

Link to comment
Share on other sites

Everything is in cart check and see how the /catalog/shopping_cart.php calls /includes/modules/order_details.php and how that gets the info to display from the cart.


Once you see how it is processed, then you can play a bit more with the data and mess it up ... er ... customize it :shock:

Link to comment
Share on other sites



What I need to know is if the info is being held in an array or as an http variable? I doubt if that is the correct terminalogy. It is the login.php page that has us stumped. I remember breaking the shopping cart when I tried changing the login.php page ;-)


I think this is the code in the login.php page that has me at a lost,


// restore cart contents



if (sizeof($navigation->snapshot) > 0) {

$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);



} else {




is this the area that is dealing with grabing the info that was added to the cart prior to loging in?


If it is, I need some one explain in english what it is doing... not the obvious things liek sizeof, if etc ..


if this isn't the routine, then what is it?


Your help is greatly appreciated!

Link to comment
Share on other sites

I don't see that code on the page:



Sorry, the specific reference uses the path:


    require(DIR_WS_MODULES. 'order_details.php');

Link to comment
Share on other sites



You need to take a look at /includes/classes/shopping_cart.php


Before login any items put into the shopping cart are stored in the $cart object. This can be queried in a number of ways. Depends what info you need to get out.


When login hs occurred the function $cart->restore_contents is run. This uses the customer_id to create entries in the basket table on the database. If a basket for that customer already exists then the items are merged. Now every time something is added to the $cart basket it is also added to the database so that if the customer goes away, when they come back the cart remembers the things that were out there.


Hope this helps, but if you need some more detail let me know.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

  • 1 year later...

I need some information on this too...that last post was helpful.


I have created a mod which allows users to customize greeting cards and add them to an OSCOMMERCE shopping cart. Before they can checkout or buy the card, they have to log in...the problem i'm having is that these custom cards need to store things like single quotes (') and double quotes ("), If the user is not logged in, the whole NAVIGATION->SNAPSHOT thing adds backslashes to the single quotes so by the time they register or login and arrive at their shopping card,


tony's card

has become

tony\\\s card


or something like that. i believe it is because my server adds backslashes to GET variables and/or POST variables (might this be magicquotes?) and these snapshot variables are propagated several times by GETting or POSTing.


I'm also concerned about security...i don't wan to change anything that might allow a hacker to cut in on my PHP code by putting a single quote in a string and posting it to my OSCOMMERCE code.


anybody have a suggestion for me?

FlashMOG - make multiplayer games in Flash/PHP!

Link to comment
Share on other sites

Hi Again


My problem is that the guest cart details are not being picked up by the restore_contents function that is contained in classes/shopping_cart.php .


As far as I can tell so far the guest session is deleted somewhere during the login process but I cant see where or why.



Further help much appreciated - this is my last known snag before I go live with my OSCommerce store

Link to comment
Share on other sites

  • 2 weeks later...



After checking that the code should be working and scouring forums I picked up the vital clue.


With PHP4.1 the Session options in admin should all be set to false. I'll try more rigour when my ISP upgrades to 4.2 .


Hope that is of help to others struggling with this one.

Link to comment
Share on other sites

  • 6 months later...


This topic is now archived and is closed to further replies.

  • Create New...