Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Moved to new server, now can't remove items from cart...HELP


pyounan

Recommended Posts

We recently moved our store (www.monstronix.com) to a new hosting provider and everything else but removing items from the cart seems to work just fine on this heavily modded store.

 

I don't get it. We can change the quantity and hit the "update" button and all works well, but checking the "remove" checkbox and clicking on the update button simply refreshes the page but leaves the item that was supposed to be removed in the cart.

 

Oddly enough, if you log off and log back on, the item is deleted.

 

Is this a cookie issue?

 

All the code was ported over to the new provider as is with no modification whatsoever. Any help/insight would be GREATLY appreciated.

 

Paul

Link to comment
Share on other sites

We recently moved our store (www.monstronix.com) to a new hosting provider and everything else but removing items from the cart seems to work just fine on this heavily modded store.

 

I don't get it. We can change the quantity and hit the "update" button and all works well, but checking the "remove" checkbox and clicking on the update button simply refreshes the page but leaves the item that was supposed to be removed in the cart.

 

Oddly enough, if you log off and log back on, the item is deleted.

 

Is this a cookie issue?

 

All the code was ported over to the new provider as is with no modification whatsoever. Any help/insight would be GREATLY appreciated.

 

Paul

 

are both of your configure.php files are modified correctly?

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

It sounds to me like a session problem. Until the old sessions are removed from the store its possible the cart will not clear until the user logs off and back on.

 

I am not sure how to fix this as I have not encountered a problem like this, but I would think about searching for session issues and as you correctly mentioned, cookies.

 

Cheers

 

Steve

My Toolbox: Crimson Editor, Adobe Photoshop CS2.0, Expression Web, Macromedia Suite 8.0, Cinema 4D, Nvu.

Link to comment
Share on other sites

are both of your configure.php files are modified correctly?

 

Hi Wade,

 

Thank you for your help - here is the catalog's configure file:

 

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', 'http://www.monstronix.com'); // eg, http://localhost - should not be empty for productive servers
 define('HTTPS_SERVER', 'https://www.monstronix.com'); // eg, https://localhost - should not be empty for productive servers
 define('ENABLE_SSL', true); // secure webserver for checkout procedure?
 define('HTTP_COOKIE_DOMAIN', 'www.monstronix.com');
 define('HTTPS_COOKIE_DOMAIN', 'www.monstronix.com');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '/');
 define('DIR_WS_HTTP_CATALOG', '/');
 define('DIR_WS_HTTPS_CATALOG', '/');
 define('DIR_WS_IMAGES', 'images/'); 
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/srv/monstronix');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
 define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
 define('DB_SERVER_USERNAME', '***');
 define('DB_SERVER_PASSWORD', '***');
 define('DB_DATABASE', 'monstronix');
 define('USE_PCONNECT', 'false'); // use persistent connections?
 define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
?>

 

Odd thing here is that I didn't even touch this code - just moved it over from the old server.

 

Thanks!

Link to comment
Share on other sites

Just to add. It seems like your sessions are stored in your mysql from the info in the configure file. What happens if you clear out those sessions? (back up first as I am not sure this is the answer, but is probably what I would try next)

 

Steve

My Toolbox: Crimson Editor, Adobe Photoshop CS2.0, Expression Web, Macromedia Suite 8.0, Cinema 4D, Nvu.

Link to comment
Share on other sites

Just to add. It seems like your sessions are stored in your mysql from the info in the configure file. What happens if you clear out those sessions? (back up first as I am not sure this is the answer, but is probably what I would try next)

 

Steve

 

Thanks for the tip, Steve. There's a couple of people checking out right now, when they leave I'll quickly empty the table (after backing it up of course) to see if that resolves it.

 

Weird thing is that the "Update" button works as far as changing the quantity of items, just not removing them. Very odd.

Link to comment
Share on other sites

Thanks for the tip, Steve. There's a couple of people checking out right now, when they leave I'll quickly empty the table (after backing it up of course) to see if that resolves it.

 

Weird thing is that the "Update" button works as far as changing the quantity of items, just not removing them. Very odd.

 

Just in case anyone runs into this same problem in the future - here is the issue:

 

There is a bug in some versions of PHP that prevents the unset() command from working properly. The version I am using is 4.3.10

 

Here is a link to the issue:

 

PHP unset() persistence

 

The unset() command is used in the includes/classes/shopping_cart.php method titled "remove"

 

This bit of code simply removes an entry from the cart. However, since the unset() doesn't work this doesn't happen.

 

I got around it for now by uncommenting the unset() command, creating a temporary array, spinning thru the existing cart array and copying only the products not being removed, then resetting the shopping cart array using the temporary array. If anyone needs the logic, here it is:

 

	function remove($pid) {
  global $customer_id; 

  //unset($this->contents[$products_id]);

  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  if ( ($pid != $products_id) && ($products_id != "0") && ($pid != "0") ) {
		$a[$products_id] = array('qty' => $this->contents[$products_id]['qty']);
	  }
	}  
  }  

  $this->contents = $a;

// remove from database
  if (tep_session_is_registered('customer_id')) {
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id 
  }

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
  $this->cartID = $this->generate_cart_id();
}

 

Not the slickest solution, I know, but it works.

 

Nor do I feel like installing a later version of PHP4 at the moment, being that this is a production store. This gets around the issue, for now.

 

Hope this helps someone out in the future....

Link to comment
Share on other sites

Paul, there have been 2 updates to the shopping cart class, one Nov 12, one last week. Have you applied both to your cart? If not, save your current file and do it. Retry then. May seem like magic ... I hope the result is what I expect it to be. Please keep me posted ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

  • 1 month later...
Paul, there have been 2 updates to the shopping cart class, one Nov 12, one last week. Have you applied both to your cart? If not, save your current file and do it. Retry then. May seem like magic ... I hope the result is what I expect it to be. Please keep me posted ...

 

Monika, reporting in.

 

I'm having the same problem after updating to MySQL 4.1.21-Standard and PHP 5.0.4.

The shopping cart will not update.

 

Unfortunately, I didn't see any change after updating to the new files ( catalog/shopping_cart.php and the catalog/includes/classes/shopping_cart.php ).

 

At least I know it's not add-in contributions in those files that are causing the problem.

Link to comment
Share on other sites

weird ... I think only step by step debugging will be able to solve this ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

weird ... I think only step by step debugging will be able to solve this ...

 

 

Update:

 

Changed admin settings to:

 

Use Search Engine -Safe URLs = False

 

and the Shopping cart updates, using the 2.2ms2-060817 version of the shopping_cart.php class file.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...