The following statement can be used to test if the stock level is less than 0:
<?php
if (uc_stock_level($node->model) <= 0) {
}
?> Is there any way to extend this statement, so the add to cart button is hidden if the stock level is less than 0?
Using the code posted in this thread[*] (and this thread[*]) as a guide, I tried to create the following code:
<?php
if (uc_stock_level($node->model) <= 0) {
$output = '<div class="outofstock">';
$output .= <p> This product is out of stock </p>
$output .= '</div>';
} else {
$output = $node->content['add_to_cart']['#value'] ;
}
return $output;
}
?> However, I am new to PHP, so I think my code is written wrong.
Does anyone have any ideas/pointers?
([*] These threads deal with hiding prices, but I'm guessing the underlying principle must be the same)




Joined: 01/20/2008