RE: Display "You save n%"
DanBiel <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.features |
|---|---|
| Message-ID | <5cec857661c1ee209b7295b179486ebb@osCommerce-Forums> |
This message was sent from: Features http://forums.oscommerce.com/viewtopic.php?p=181527#181527 ---------------------------------------------------------------- [quote="[email protected]"]how to use this code? i past to product_info page and got a lot errors thanks[/quote] Replace everything between <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info_values['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_info_values['products_image'], $product_info_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript><p align="right"> and </table><p><?php echo stripslashes($product_info['products_description']); ?></p> You should be replacing: </td> </tr> <?php } ?> with all of this code: <p align="right"> <?php } if ($new_price = tep_get_products_special_price($product_info_values['products_id'])) { $list_price = '<s>' . $currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) . '</s>'; $our_price = '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info_values['products_tax_class_id'])) . '</span>'; //get the list price and special price and then display the savings $no_savings = substr(($currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id']))), 1); $no_savings = $no_savings + 0.0; $now_savings = substr(($currencies->display_price($new_price, tep_get_tax_rate($product_info_values['products_tax_class_id']))), 1); $now_savings = $now_savings + 0.0; $savings = (($now_savings / $no_savings) * 100); $savings = round($savings); } else { $list_price = $currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])); }?> <center>List Price: <? echo $list_price; ?><br> Our Price: <? echo $our_price; ?><br> You Save: <? echo $savings. "%"; ?> </td> </tr> I think that should take care of your problems. NOTE: this only works IF you have made a special price for your product. I don't have it configured so that your page will still work if you do not have a special price for your product.