1 reply [Last post]
stewey's picture
Offline
Bug Finder
Joined: 05/14/2008
Juice: 54
Was this information Helpful?

Hi Folks,

I'm seeing a strange caching problem when adding to cart under Firefox 3. I have the redirect URL set to <none>, which causes Ubercart to send the user back to the product they just added.

Under FF3, however, the product page is not consistently reloaded on redirect. It might reload the product page once every 5 or 10 requests. This means that the cart block is not updated to reflect the newly added product.

The only solution I have been able to come up with, is to append a unique query string to the redirect url. This tricks firefox into reloading the page from the server every time.

Has anyone else encountered this problem? Do you have a fix that doesn't involve me modifying ubercart?

Thanks!
Stew

stewey's picture
Offline
Bug Finder
Joined: 05/14/2008
Juice: 54
Re: Add to cart problem with FF3

Update: I was able to work around this problem without modifying ubercart using the following hack. If anyone has a cleaner fix, please let me know.

/**
* Hook add to cart to touch up redirect for ff3's benefit.
*/
function yourmodule_add_to_cart($nid, $qty, $data)
{
register_shutdown_function( yourmodule_redirect_reload );
}
function yourmodule_redirect_reload()
{
header( "Location: " . $_SERVER['REDIRECT_URL'] . "?added" );
}