[ic] How to display quantity in stock

Gary Norton gnorton at broadgap.com
Tue Jan 25 22:32:32 EST 2005

Calgary Ecommerce Services wrote:

>Can anyone suggest a way to show the quantity in stock, on the results_grid?
>I can see that in-stock and out-of-stock conditions are detected in:
>my $q = $Tag->data('inventory', 'quantity', $sku);
>if ($q > 0) {
>     $record->{stock} = <<EOF;
>       .
>       .
>       .
>I'd like to display quantity in stock instead of or in addition to the Yes/No,
>    [L]SKU[/L]: {SKU}<br><br>
>    [L]Stock[/L]: {STOCK}<br>
>I'm not that familiar with perl. How can the quantity field in inventory be
>accessed directly, for each item that gets displayed?

You should be able to access $q directly for the value. Somethign like 
this should work (untested):

if ($q > 0) {
        $record->{stock} = <<EOF;
<span style="color: #008000; font-size:10px; font-family: san-serif; 
font-weight: bold;">We have $q of these in stock</span>


More information about the interchange-users mailing list