Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new_products adding "if" "else" help


Davee

Recommended Posts

Hi

 

I'm trying to add an if statement to a modified new_products file

 

'text' => '<table border="0" cellpadding="0" cellspacing="0" style=bordercolor="#111111" width="100%" height="196"><tr><td width="10" height="10"><img border="0" src="images/corners/lt.gif" width="10" height="10"></td><td width="98%" height="10" class="tline" colspan="2"></td><td width="10" height="10"><img border="0" src="images/corners/rt.gif" width="10" height="10"></td></tr><tr>
 <td width="10" height="180" class="lline" rowspan="4"></td><td width="98%" height="15" colspan="2">
 <p align="center"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><u>' . $new_products['products_name'] . '</u></a></b></td>
 <td width="10" height="180" class="rline" rowspan="4"></td></tr><tr><td width="49%" height="83"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_si'], $new_products['products_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '</a></td>    
   <td width="49%" height="83" align="center"><p align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_mi'], $new_products['products_mi_name']) . '</a></td></tr><tr>
   <td width="49%" class="main" height="41" valign="top">
'.if($new_products['sku']>0) {.'
 $price_list='<span class="priceText">' . $currencies->display_price($new_products['products_cost'] * $new_products['percentage'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span></td>;
}else{
  $price_list='<span class="priceText">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span></td>;
   }

Parse error: parse error, unexpected T_IF - line 82

 

 

'.if($new_products['sku']>0) {.'

 

Please can someone advise where I'm going wrong?

 

Thanks in advance

Link to comment
Share on other sites

Hi!

 

I recommend you to past this code in a program that can highlight the syntax. I recommend MAXHTML Beauty www.htmlbeauty.com (freeware).

<td width="49%" class="main" height="41" valign="top">
'.if($new_products['sku']>0) {.'

As far as I know, you can't put a "if" statement inside a array. You'll have to put if out of the arrays.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...