OSC-Sevilla Posted September 14, 2011 Posted September 14, 2011 <?php $products_name .= '<td>'.$products_options . if ($products[$i] ) >1){[/color] '<br> <div class="cart_products_options">'.TEXT_PRODUCT_PART_NUMBER .'<br><p style=" font-weight:bold;">'. $products[$i][code].'</p></div>'; [color=#b22222] }[/color] '</td> </tr> </table>' ?> ------------------------------------Right after product options I would like a DIV do display but only when $products[$i][code] has a value. Thanks
multimixer Posted September 14, 2011 Posted September 14, 2011 Try this <?php $products_code = $products[$i][code]) >1 ? '<div class="cart_products_options"><p>' . TEXT_PRODUCT_PART_NUMBER . '</p><p>'. $products[$i][code].'</p></div>' : ''; $products_name .= '<td>'.$products_options . $products_code'</td> </tr> </table>' ?> How you set the condition (ie >1 or !empty or whatever) depends on what the $products[$i] is. Is it a number? Better you do the styling in the css than all this br and inline styles My community profile | Template system for osCommerce - New: Responsive | Feedback channel
OSC-Sevilla Posted September 14, 2011 Author Posted September 14, 2011 Perfect - Big Thanks: $products_options .= '</div>'; } if (($products[$i] ) >1){ $products_code = '<div class="cart_products_options"><p>' . TEXT_PRODUCT_PART_NUMBER . '</p><p>'. $products[$i][code].'</p></div>'; } $products_name .= '<td>'.$products_options . $products_code . '</td> </tr> </table>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.