boyler1 Posted September 4, 2010 Posted September 4, 2010 Hi, I am new to oscommerce and i am having a problem trying to hide the 'RRP' for certain products. I was able to hide the actual price e.g. "£23.00" but i am not able to hide the RRP: text. $products_rrp = (($products_new['products_rrp'] > 0) ? $currencies->display_price($products_new['products_rrp'], tep_get_tax_rate($products_new['products_tax_class_id'])) : ''); This shows the code i used to hide price if it was equal to 0.. <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<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 valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '" class="categories"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'].' <br> ' . '<font size=5>' . '<font color ="#FF0000">' . TEXT_PRICE . ' </font> ' . ' ' . $products_price. ' </font> ' . '</font> ' . '<br>' .TEXT_RRP. ' ' . $products_rrp ?> The code above was used to display the RRP text, do i have to create an 'if' statement to hide this when price equals 0 help would be much appricated
boyler1 Posted September 4, 2010 Author Posted September 4, 2010 Hi, I am new to oscommerce and i am having a problem trying to hide the 'RRP' for certain products. I was able to hide the actual price e.g. "£23.00" but i am not able to hide the RRP: text. $products_rrp = (($products_new['products_rrp'] > 0) ? $currencies->display_price($products_new['products_rrp'], tep_get_tax_rate($products_new['products_tax_class_id'])) : ''); This shows the code i used to hide price if it was equal to 0.. <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<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 valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '" class="categories"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'].' <br> ' . '<font size=5>' . '<font color ="#FF0000">' . TEXT_PRICE . ' </font> ' . ' ' . $products_price. ' </font> ' . '</font> ' . '<br>' .TEXT_RRP. ' ' . $products_rrp ?> The code above was used to display the RRP text, do i have to create an 'if' statement to hide this when price equals 0 help would be much appricated Anyone, i know its something simple but just cant figure it out.. many thanks
♥geoffreywalton Posted September 4, 2010 Posted September 4, 2010 Have you looked at the if command in the php section of www.w3schools.com? HTH G Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
boyler1 Posted September 4, 2010 Author Posted September 4, 2010 Have you looked at the if command in the php section of www.w3schools.com? HTH G Cheers for replying I looked at that site and make an attempt at creating an if statement. if ($products_rrp = (($products_new['products_rrp'] > 0) ?)) { <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '" class="categories"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'].' <br> ' . '<font size=5>' . '<font color ="#FF0000">' . TEXT_PRICE . ' </font> ' . ' ' . $products_price ?> }else{ <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '" class="categories"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'].' <br> ' . '<font size=5>' . '<font color ="#FF0000">' . TEXT_PRICE . ' </font> ' . ' ' . $products_price. ' </font> ' . '</font> ' . '<br>' .TEXT_RRP. ' ' . $products_rrp ?> } Its not displying right on screen. The condition for the statement isn't right but cant find why. if you could take a look that would help cheers
♥geoffreywalton Posted September 4, 2010 Posted September 4, 2010 Might be better to always display first part. <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '" class="categories"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'].' <br> ' . '<font size=5>' . '<font color ="#FF0000">' . TEXT_PRICE . ' </font> ' . ' ' . $products_price ?> ........................................................ If rrp > 0 { display rrp } else { display other message } G Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.