Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Question related to shopping cart


g_p_java

Recommended Posts

Posted

Hello,

 

i have to modify some methods in the shoppingCart class and i have some questions related to that.

 

1) When a user has logged in, the products in the shopping cart are stored in customers_basket table, right?

2) When the user is NOT logged in, the products in the shopping_cart are stored in the session,right??

 

Also, in includes/classes/shopping_cart.php,the class named class shoppingCart

contains some methods such as add_cart,restore_contents() etc.

3) Are these methods used in sessions too??

4) In which files are the sessions created for shoppingCart??

5) Also, is get_products() the ONLY method that returns the contents of the shoppingCart??

 

thanks, in advance

Posted

to 1 and 2 : The cart contents go to the session always, if customer is logged in, then also to the database.

 

to 3. In general yes, wherever it is necessary and makes sense. For example, the function restore contents, makes sense only if the user is logged in: It writes the current cart contents (before user log in) to the DB, then reset the session, then recreate the session using the DB contents. Function add cart, works in both cases, it writes to the database only if user is logged in.

 

to 4 includes/application_top.php and filled in includes/classes/shopping_cart.php

 

to 5 Regarding the contents array, yes. But you can call the total cart items for example anywhere using $cart->count_contents();, that "activates" the function count contents of the shopping cart class.

 

 

What do you want to do?

Archived

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

×
×
  • Create New...