Product.pm no longer caches if a cart object has been created for this session.

This commit is contained in:
Kaleb Murphy 2008-07-18 16:11:21 +00:00
parent c754630de8
commit 6e97455afb
4 changed files with 6 additions and 5 deletions

View file

@ -1,5 +1,5 @@
7.5.18
- fixed: Product no longer shows "Continue Shopping" view when a different user adds the Product to their Cart. The issue was the Product cached itself when an item was added to the cart. Now it checks for if a cart asset exists for this session.
7.5.17
- fixed: Payment Methods Hover Help Incomplete
- fixed: Payment Method Titles Don't Match Buttons

View file

@ -349,6 +349,7 @@
# Specify the list of macros you wish to be processed on each page.
"macros" : {
"SessionId" : "SessionId",
"@" : "At_username",
"#" : "Hash_userId",
"/" : "Slash_gatewayUrl",

View file

@ -1392,7 +1392,7 @@ sub view {
my $self = shift;
my $error = shift;
my $session = $self->session;
if (!$session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
if (!$session->var->isAdminOn && $self->get("cacheTimeout") > 10){
my $out = WebGUI::Cache->new($self->session,"view_".$self->getId)->get;
return $out if $out;
}
@ -1588,7 +1588,7 @@ sub view {
$var{continueShoppingUrl} = $self->getUrl;
my $out = $self->processTemplate(\%var,undef,$self->{_viewTemplate});
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10) {
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10 && $self->{_hasAddedToCart} != 1){
WebGUI::Cache->new($self->session,"view_".$self->getId)->set($out,$self->get("cacheTimeout"));
}
return $out;

View file

@ -35,7 +35,7 @@ These subroutines are available from this package:
=cut
readonly session => my %session;
private properties => my %properties;
public properties => my %properties;
private error => my %error;
private itemCache => my %itemCache;
private addressBookCache => my %addressBookCache;
@ -454,7 +454,7 @@ sub newBySession {
WebGUI::Error::InvalidObject->throw(expected=>"WebGUI::Session", got=>(ref $session), error=>"Need a session.");
}
my $cartId = $session->db->quickScalar("select cartId from cart where sessionId=?",[$session->getId]);
return $class->new($session, $cartId) if (defined $cartId);
return $class->new($session, $cartId) if (defined $cartId and $cartId ne '');
return $class->create($session);
}