I am leaning GI-Session-mysql
http://search.cpan.org/.../Session/CookBook.pm
below code confused me why it display only
Total Price:(this was printed):$total_price>
while the cart detail has been non displayed while it has exist in cart.
sub display_cart {
my ($cgi, $session) = @_;
# getting the cart's contents
my $cart = $session->param("CART") || [];
my $total_price = 0;
my $RV = q~<table><tr><th>Title</th><th>Price</th></tr>~;
if ( $cart ) {
for my $product ( @{$cart} ) {
$total_price += $product->{price};
$RV = qq~
<tr>
<td>$product->{name} **$product->{price}</td>
<td>$product->{price}</td>
</tr>~;
}
} else {
$RV = qq~
<tr>
<td colspan="2">There are no items in your cart
yet</td>
</tr>~;
}
$RV = qq~
<tr>
<td><b>Total Price:(this was printed):</b></td>
<td><b>$total_price></b></td>
</tr></table>~;
return $RV;
}
http://search.cpan.org/.../Session/CookBook.pm
below code confused me why it display only
Total Price:(this was printed):$total_price>
while the cart detail has been non displayed while it has exist in cart.
sub display_cart {
my ($cgi, $session) = @_;
# getting the cart's contents
my $cart = $session->param("CART") || [];
my $total_price = 0;
my $RV = q~<table><tr><th>Title</th><th>Price</th></tr>~;
if ( $cart ) {
for my $product ( @{$cart} ) {
$total_price += $product->{price};
$RV = qq~
<tr>
<td>$product->{name} **$product->{price}</td>
<td>$product->{price}</td>
</tr>~;
}
} else {
$RV = qq~
<tr>
<td colspan="2">There are no items in your cart
yet</td>
</tr>~;
}
$RV = qq~
<tr>
<td><b>Total Price:(this was printed):</b></td>
<td><b>$total_price></b></td>
</tr></table>~;
return $RV;
}