Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Inserting IF statement into an array


solarplexus

Recommended Posts

Hey there.. I seriously need help with this :( Can't take it anymore, lol.

 

I've been trying to replace this code:

 

<a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$products_new['products_id']).'">'.Tep_Image_Button('button_add_to_cart1.gif').'</a>

 

with this code:

 

<?php 
   if ($products_new['products_quantity'] <=0) { ?>
     <td align="right" valign="middle" class="main"><?php echo  tep_image_button('button_in_cart_na.gif', IMAGE_BUTTON_IN_CART_NA) ; ?></td>
     <?php 
   } else { ?>
     <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
     <?php 
   } ?>

 

in this code:

 

$info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => ' valign="top"',
                                          'text' => '
				 <table border="0" cellspacing="0" cellpadding="0" width="443" align="center">
					  <tr>
					  	  <td>'.tep_draw_Separator('spacer.gif', '10', '1').'</td>
						  <td width="114" valign="top">
							   <table border="0" cellspacing="0" cellpadding="0" style="width:114px;">
									<tr><td>'.tep_image(DIR_WS_IMAGES.'m25.gif').'</td><td width="100" class="bg5"></td><td>'.tep_image(DIR_WS_IMAGES.'m32.gif').'</td></tr>
									<tr><td class="bg7" valign="bottom">'.tep_image(DIR_WS_IMAGES.'m27.gif').'</td>
										<td width="100" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>
										<td class="bg8" valign="bottom">'.tep_image(DIR_WS_IMAGES.'m28.gif').'</td></tr>
									<tr><td>'.tep_image(DIR_WS_IMAGES.'m29.gif').'</td><td width="100" class="bg6"></td><td>'.tep_image(DIR_WS_IMAGES.'m31.gif').'</td></tr>
							   </table>
						  </td>
						  <td width="33">'.tep_draw_Separator('spacer.gif', '33', '1').'</td>
						  <td width="278" valign="top">
							   <table border="0" cellspacing="0" cellpadding="0" style="width:278px;">
									<tr><td class="ml1" colspan="2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . $products_new['products_name'] . '</a></td></tr>
									<tr><td height="10" colspan="2"></td></tr>
									<tr><td colspan="2">'.preg_replace('/\s\S*$/i', '', substr($p_desc, 0, MAX_DESCR_1)).'...</td></tr>
									<tr><td height="18" colspan="2"></td></tr>
									<tr><td><a href="' . tep_href_link('product_info.php?products_id='.$products_new['products_id']) . '">'.tep_image_button("button_details.gif").'</a>  <a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$products_new['products_id']).'">'.Tep_Image_Button('button_add_to_cart1.gif').'</a></td>
										<td class="tx2">'.$currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])).'</td></tr>
							   </table>
						  </td>
						  <td width="8">'.tep_draw_Separator('spacer.gif', '8', '1').'</td>
						</tr>
				 </table>
				');

 

If I sound helpless, I really am :'(

 

Help!!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...