sub cart_preview_conditional_element {
my ($key, $value) = @_;
if (!($key && $value)) { return; }
print qq{
${key}: $value
";
}
}
sub cart_preview_conditional_selection {
my ($key, $value) = @_;
if (!($key && $value)) { return; }
my @options = split(/\n/,$value);
print qq{
$key:
};
}
# Takes database handle and cart item ID
sub cart_previewitem {
my ($dbh, $id) = @_;
if ($id !~ /^\d+$/) { die "Invalid ID (not a number)"; }
my $sth = $dbh->prepare("select * from items where id='?'");
$sth->execute($id) || die $dbh->errstr;
my $row = $sth->fetchrow_hashref() || die "No such item";
print qq{