only show the buy form if there are variants to sell

This commit is contained in:
Colin Kuskie 2008-05-24 22:30:12 +00:00
parent 3428c3947d
commit 007693c2bd

View file

@ -1415,18 +1415,21 @@ sub view {
}); });
$variants{$id} = $collateral->{shortdesc}; $variants{$id} = $collateral->{shortdesc};
} }
$var{buy_form_header} = WebGUI::Form::formHeader($session, { action => $self->getUrl} ) if (scalar @variantLoop) {
. WebGUI::Form::hidden($session, { name=>'func', value=>'buy', } ); ##Don't display the form unless you have variants to sell.
$var{buy_form_footer} = WebGUI::Form::formFooter($session); $var{buy_form_header} = WebGUI::Form::formHeader($session, { action => $self->getUrl} )
$var{buy_options} = WebGUI::Form::selectBox($session, . WebGUI::Form::hidden($session, { name=>'func', value=>'buy', } );
{ $var{buy_form_footer} = WebGUI::Form::formFooter($session);
name => 'vid', $var{buy_options} = WebGUI::Form::selectBox($session,
label => $i18n->get('add to cart'), {
options => \%variants, name => 'vid',
value => [0], label => $i18n->get('add to cart'),
}, options => \%variants,
); value => [0],
$var{buy_button} = WebGUI::Form::submit($session, { value => $i18n->get('add to cart') } ); },
);
$var{buy_button} = WebGUI::Form::submit($session, { value => $i18n->get('add to cart') } );
}
if ($self->canEdit) { if ($self->canEdit) {
$var{'addvariant_url'} = $self->getUrl('func=editVariant'); $var{'addvariant_url'} = $self->getUrl('func=editVariant');
$var{'addvariant_label'} = $i18n->get('add a variant'); $var{'addvariant_label'} = $i18n->get('add a variant');