Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product_info.php Add to cart


Gizmodo

Recommended Posts

Posted

I have made a lot of changes to the URL because I needed other parameters to be passed around. The question I have is: How does the "Add to Cart' button redirect from product_info.php to shopping_cart.php? The action on my form of the name "cart_quantity" on product_info.php is localhost/osc/product_info? with all my parameters on there, including action=add_product. In application_top.php, at this line:

if (isset($HTTP_GET_VARS['action']))

it appears as though that value is not set. What ends up happening is it always says my cart is empty. :( Any ideas? Thanks!

Posted

I did some more digging, and it appears the $cart is not getting registered as a variable when the user clicks on the "Add to Cart" button. The following code was taken from application_top.php file. Why would this be happening? I get "cart registered" printed on every page, even the page where the "Add to Cart" button is, but I get "cart wasn't registered" when I push the "Add to Cart" button, and I am told that my cart is empty. Please help!

	// create the shopping cart & fix the cart if necesary
 if (tep_session_is_registered('cart') && is_object($cart))
 {
  echo('cart registered');
if (PHP_VERSION < 4)
{
  $broken_cart = $cart;
  $cart = new shoppingCart;
  $cart->unserialize($broken_cart);
}
 }
 else
 {
  echo('cart wasn\'t registered');
tep_session_register('cart');
$cart = new shoppingCart;
 }

Posted
I did some more digging, and it appears the $cart is not getting registered as a variable when the user clicks on the "Add to Cart" button. The following code was taken from application_top.php file. Why would this be happening? I get "cart registered" printed on every page, even the page where the "Add to Cart" button is, but I get "cart wasn't registered" when I push the "Add to Cart" button, and I am told that my cart is empty. Please help!

	// create the shopping cart & fix the cart if necesary
 if (tep_session_is_registered('cart') && is_object($cart))
 {
  echo('cart registered');
if (PHP_VERSION < 4)
{
  $broken_cart = $cart;
  $cart = new shoppingCart;
  $cart->unserialize($broken_cart);
}
 }
 else
 {
  echo('cart wasn\'t registered');
tep_session_register('cart');
$cart = new shoppingCart;
 }

 

you possibly lose your session when pressing add to cart ?

Treasurer MFC

Posted
you possibly lose your session when pressing add to cart ?
That's what I am thinking, but I'm not real sure how/why I would be losing the session. Below is the form code on that page. Do you see anything weird? I removed the cPath variable and used my own. I also changed it so that all of the code is valid as far as W3C is concerned. Could either of those things be the problem?

<form name="cart_quantity" action="http://localhost:8888/PTCommerce/catalog/product_info.php?vehicleID=1&categoryID=9&products_id=7&action=add_product&osCsid=0fcd6670faa5f1afd80848db6598cb3c" method="post">
...
<input type="hidden" name="products_id" value="7" />
<input type="image" src="includes/languages/english/images/buttons/button_in_cart.gif" class="BorderlessImage" alt="Add to Cart" title="Add to Cart" name="ImageSubmit" />

Archived

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

×
×
  • Create New...