Show values greater than 0

acaddy 02 Feb, 2010
Hi everyone,

I have an order inventory form that has about 80 products listed. Each product has a minimum and maximum quantity (0-500). How do I only email the results of all fields with a result greater than 0.

ex input.

Pens qty selected = 50
folders qty selected = 0
letterhead qty selected = 1

Emailed result

Pens qty selected = 50
letterhead qty selected = 1

Thanks!
GreyHead 03 Feb, 2010
Hi acaddy,

Probably you need some PHP in the Email template to scan the results and only output those you want to see.

Bob
acaddy 03 Feb, 2010
Any idea on how this would be written?

Thanks!
GreyHead 03 Feb, 2010
Hi acaddy,

Impossible to say exactly without a lot more info. With 80 products I'd probably be storing the critical info in a db table.

But assuming something simpler. Let's just say that you have 4 products to save my typing.
<?php
$products = array (
  'product1_id' => 'Product 1 title', 
  'product2_id' => 'Product 2 title', 
  'product3_id' => 'Product 3 title', 
  'product4_id' => 'Product 4 title' );
foreach { $product as $k = > $v ) {
  $qty = JRequest::getInt($v, 0, 'post');
  if ( $qty ) {
    echo '<div>$v : qty $k</div>';
  }
}
?>

Bob
acaddy 04 Feb, 2010
Thanks, I'll give it a shot!
This topic is locked and no more replies can be posted.