Zen Follower
- Join Date:
- Mar 2005
- Location:
- Tempe, AZ
- Posts:
- 316
- Plugin Contributions:
- 0
MSRP contrib
iZilla_Pod:
I messed around with the code for awhile. Hopefully this will help someone.
Heres the original piece of code for the contribution you will be replacing:
if ($display_normal_price == 0) {
// don't show the $0.00
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">' . TEXT_PRODUCT_MSRP . '<s>' . $currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s></span><br><span class="save">' . TEXT_PRODUCT_SAVE .$currencies->display_price($save, '') . ' ('. number_format((($display_msrp_price - $display_normal_price) / $display_msrp_price), 2, '.', '') * 100 . '%)' . '</span><br><span class="norm">' . TEXT_PRODUCT_OUR.$show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_special_price . $show_sale_price . $show_sale_discount;
}
} else {
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">'.TEXT_PRODUCT_MSRP.'<s>'.$currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s></span><br><span class="save">'.TEXT_PRODUCT_SAVE .$currencies->display_price($save, '').' ('. number_format((($display_msrp_price - $display_normal_price) / $display_msrp_price), 2, '.', '') * 100 . '%)'.'</span><br><span class="norm">'.TEXT_PRODUCT_OUR.$show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount;
}
}
> This will show the "You Save" with dollar amount only:
> ```php
if ($display_normal_price == 0) {
// don't show the $0.00
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">' . TEXT_PRODUCT_MSRP . '<s>' . $currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s></span><br><span class="save">' . TEXT_PRODUCT_SAVE . $currencies->display_price($save, '') . '</span><br><span class="norm">' . TEXT_PRODUCT_OUR.$show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_special_price . $show_sale_price . $show_sale_discount;
}
} else {
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">'.TEXT_PRODUCT_MSRP.'<s>'.$currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s></span><br><span class="save">'.TEXT_PRODUCT_SAVE . $currencies->display_price($save, '') . '</span><br><span class="norm">'.TEXT_PRODUCT_OUR.$show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount;
}
}
This will show the "You Save" as a percentage only:
if ($display_normal_price == 0) {
// don't show the $0.00
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">' . TEXT_PRODUCT_MSRP . '<s>' . $currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s></span><br><span class="save">' . TEXT_PRODUCT_SAVE . number_format((($display_msrp_price - $display_normal_price)), 2, '.', '') . '%' . '</span><br><span class="norm">' . TEXT_PRODUCT_OUR.$show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_special_price . $show_sale_price . $show_sale_discount;
}
} else {
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">'.TEXT_PRODUCT_MSRP.'<s>'.$currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s></span><br><span class="save">'.TEXT_PRODUCT_SAVE . number_format((($display_msrp_price - $display_normal_price)), 2, '.', '') . '%' . '</span><br><span class="norm">'.TEXT_PRODUCT_OUR.$show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount;
}
}
> This will remove the "You Save" line completely:
> ```php
if ($display_normal_price == 0) {
// don't show the $0.00
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">' . TEXT_PRODUCT_MSRP . '<s>' . $currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s></span><br />' . '<span class="norm">' . TEXT_PRODUCT_OUR.$show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_special_price . $show_sale_price . $show_sale_discount;
}
} else {
if(($display_msrp_price!='')&&($display_msrp_price!='0')){
$save=$display_msrp_price-$display_normal_price;
$final_display_price = '<span class="smalltext1">'.TEXT_PRODUCT_MSRP.'<s>'.$currencies->display_price($display_msrp_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s></span><br />' . '<span class="norm">'.TEXT_PRODUCT_OUR.$show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
}else{
$final_display_price = $show_normal_price . $show_special_price . $show_sale_price . $show_sale_discount;
}
}
I'm also looking at moving the "You Save" line below the "MSRP Price" and "Our Price" so that it's in a more logical order. I need to get some rest right now though.
Thanks for sharing that info but i am not sure if you notice that the percent is the dollar amount saved in percent, for example if your saving 500.00 is will look like this 500% and the value is not the true percent of saving. To get the true percent all you have to is remove this section of the code
.$currencies->display_price($save, '')
In both lines as you shown
it should then look like this
.' ('. number_format((($display_msrp_price - $display_normal_price) / $display_msrp_price), 2, '.', '') * 100 . '%)'.'</span><br><span class="norm">'.TEXT_PRODUCT_OUR.$show_special_price . $show_sale_price . $show_sale_discount.'</span>' ;
You can view it in action at https://www.lextechs.com
Lextechs.com Powered By ZenCart