Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php guru needed


khoking

Recommended Posts

Hi,

 

I tried to use the following double IF command, but it doesn't seems to be working.

 

<?php if ($product_info['products_hideprice'] == '0'){ ?>

<?php if ($product_info['products_price']> 0 and $product_info['products_price']<999998){ ?>
           <td class="pageHeadingPrice"><?php echo $products_price; ?></td>
         </tr>
<?php } else { ?> 
           <td class="pageHeadingPrice">To be Announced</td>
         </tr>
<?php } ?> 

<?php } else { ?> 
           <td class="main">Too Low to Show (Add to Cart to See Price)</td>
         </tr>
<?php } ?> 

 

The codes above is ignoring this command:

 

<?php } else { ?>

<td class="pageHeadingPrice">To be Announced</td>

</tr>

<?php } ?>

 

Can someone help me?

Best regards,

Koh Kho King

Link to comment
Share on other sites

that is some miserable code you have there, im not gonna redo the whole thing the way it's supposed to be, but this should work, or give you an idea of how its supposed to work...

 

<?php 

if ($product_info['products_hideprice'] == '0'){ 
 if (($product_info['products_price'] > 0) && ($product_info['products_price'] < 999998)){ ?>
           <td class="pageHeadingPrice"><?php echo $products_price; ?></td>
         </tr>
<?php } else { ?> 
           <td class="pageHeadingPrice">To be Announced</td>
         </tr>
<?php 	} 
  } else { ?> 
         <td class="main">Too Low to Show (Add to Cart to See Price)</td>
         </tr>
<?php } ?> 

Professionally Done Module Install's

Custom Modules

Support USA Coder's. And Get The Job Done Right!

Link to comment
Share on other sites

I have another PHP code cleaning problem below...it works but I find the codes to be duplicating and messy. Can someone guides me on how to clean it up? Many thanks.

 

<?php
 if ($products_new['products_price'] > 999998) {
?>
<b><font color="#FF0000" size="5">Coming Soon!</font></b>
<?php
} else {
?>
<?php echo (($products_new['products_price'] > 0 and $products_new['products_price'] < 999998 && $products_new['products_quantity'] > -5001) ? '<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>': '<b><font color="#FF0000" size="5">SOLD</font></b>'); ?></td>
<?php      }
?>

Best regards,

Koh Kho King

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...