ServWise.com Posted June 4, 2009 Share Posted June 4, 2009 I small mod I just made to make the cart page show correctly for tax exempt customers (Mod is for web20cart but should be easy to modify to work with others). Replace the following in your viewcart.tpl {if $taxrate} <tr class="carttablesummary"> <td align="right">{$taxname} @ {$taxrate}%: </td> <td align="center">{$taxtotal}</td> </tr> {/if} {if $taxrate2} <tr class="carttablesummary"> <td align="right">{$taxname2} @ {$taxrate2}%: </td> <td align="center">{$taxtotal2}</td> </tr> {/if} <tr class="carttabledue"> <td align="right">{$LANG.ordertotalduetoday}: </td> <td align="center">{$total}</td> </tr> {if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially} <tr class="carttablerecurring"> <td align="right">{$LANG.ordertotalrecurring}: </td> <td align="center">{if $totalrecurringmonthly}{$totalrecurringmonthly} {$LANG.orderpaymenttermmonthly}<br /> {/if} {if $totalrecurringquarterly}{$totalrecurringquarterly} {$LANG.orderpaymenttermquarterly}<br /> {/if} {if $totalrecurringsemiannually}{$totalrecurringsemiannually} {$LANG.orderpaymenttermsemiannually}<br /> {/if} {if $totalrecurringannually}{$totalrecurringannually} {$LANG.orderpaymenttermannually}<br /> {/if} {if $totalrecurringbiennially}{$totalrecurringbiennially} {$LANG.orderpaymenttermbiennially}<br /> {/if}</td> </tr> {/if} replace with {if $clientsdetails.taxexempt eq "on"} {php} function scur($val,$c){ $val = str_replace($c["code"],"", $val); $val = str_replace($c["prefix"],"", $val); return $val; } function fcur($val,$c,$r1,$r2){ $val = ($val * 100) / ($r2+$r1+100); $val = $c["prefix"] . number_format($val, 2) . $c["code"]; return $val; } $c = $this->get_template_vars('currency'); $r1 = $this->get_template_vars('taxrate'); $r2 = $this->get_template_vars('taxrate2'); $total_lesstax = fcur(scur($this->get_template_vars('total'),$c),$c,$r1,$r2); $totalrecurringmonthly_lesstax = fcur(scur($this->get_template_vars('totalrecurringmonthly'),$c),$c,$r1,$r2); $totalrecurringquarterly_lesstax = fcur(scur($this->get_template_vars('totalrecurringquarterly'),$c),$c,$r1,$r2); $totalrecurringsemiannually_lesstax = fcur(scur($this->get_template_vars('totalrecurringquarterly'),$c),$c,$r1,$r2); $totalrecurringannually_lesstax = fcur(scur($this->get_template_vars('totalrecurringquarterly'),$c),$c,$r1,$r2); $totalrecurringbiennially_lesstax = fcur(scur($this->get_template_vars('totalrecurringbiennially'),$c),$c,$r1,$r2); {/php} <tr class="carttabledue"> <td align="right">{$LANG.ordertotalduetoday}: </td> <td align="center">{php}echo $total_lesstax;{/php}</td> </tr> {if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially} <tr class="carttablerecurring"> <td align="right">{$LANG.ordertotalrecurring}: </td> <td align="center">{if $totalrecurringmonthly}{php}echo $totalrecurringmonthly_lesstax;{/php} {$LANG.orderpaymenttermmonthly}<br /> {/if} {if $totalrecurringquarterly}{php}echo $totalrecurringquarterly_lesstax;{/php} {$LANG.orderpaymenttermquarterly}<br /> {/if} {if $totalrecurringsemiannually}{php}echo $totalrecurringsemiannually_lesstax;{/php} {$LANG.orderpaymenttermsemiannually}<br /> {/if} {if $totalrecurringannually}{php}echo $totalrecurringannually_lesstax;{/php} {$LANG.orderpaymenttermannually}<br /> {/if} {if $totalrecurringbiennially}{php}echo $totalrecurringbiennially_lesstax;{/php} {$LANG.orderpaymenttermbiennially}<br /> {/if}</td> </tr> {/if} {else} {if $taxrate} <tr class="carttablesummary"> <td align="right">{$taxname} @ {$taxrate}%: </td> <td align="center">{$taxtotal}</td> </tr> {/if} {if $taxrate2} <tr class="carttablesummary"> <td align="right">{$taxname2} @ {$taxrate2}%: </td> <td align="center">{$taxtotal2}</td> </tr> {/if} <tr class="carttabledue"> <td align="right">{$LANG.ordertotalduetoday}: </td> <td align="center">{$total}</td> </tr> {if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially} <tr class="carttablerecurring"> <td align="right">{$LANG.ordertotalrecurring}: </td> <td align="center">{if $totalrecurringmonthly}{$totalrecurringmonthly} {$LANG.orderpaymenttermmonthly}<br /> {/if} {if $totalrecurringquarterly}{$totalrecurringquarterly} {$LANG.orderpaymenttermquarterly}<br /> {/if} {if $totalrecurringsemiannually}{$totalrecurringsemiannually} {$LANG.orderpaymenttermsemiannually}<br /> {/if} {if $totalrecurringannually}{$totalrecurringannually} {$LANG.orderpaymenttermannually}<br /> {/if} {if $totalrecurringbiennially}{$totalrecurringbiennially} {$LANG.orderpaymenttermbiennially}<br /> {/if}</td> </tr> {/if} {/if} 0 Quote Link to comment Share on other sites More sharing options...
ServWise.com Posted June 4, 2009 Author Share Posted June 4, 2009 Missed a rather large bug in Recurring amounts, fix below {if $clientsdetails.taxexempt eq "on"} {php} function scur($val,$c){ $val = str_replace($c["code"],"", $val); $val = str_replace($c["prefix"],"", $val); return $val; } function fcur($val,$c,$r1,$r2){ $val = ($val * 100) / ($r2+$r1+100); $val = $c["prefix"] . number_format($val, 2) . $c["code"]; return $val; } $c = $this->get_template_vars('currency'); $r1 = $this->get_template_vars('taxrate'); $r2 = $this->get_template_vars('taxrate2'); $total_lesstax = fcur(scur($this->get_template_vars('total'),$c),$c,$r1,$r2); $totalrecurringmonthly_lesstax = fcur(scur($this->get_template_vars('totalrecurringmonthly'),$c),$c,$r1,$r2); $totalrecurringquarterly_lesstax = fcur(scur($this->get_template_vars('totalrecurringquarterly'),$c),$c,$r1,$r2); $totalrecurringsemiannually_lesstax = fcur(scur($this->get_template_vars('totalrecurringsemiannually'),$c),$c,$r1,$r2); $totalrecurringannually_lesstax = fcur(scur($this->get_template_vars('totalrecurringannually'),$c),$c,$r1,$r2); $totalrecurringbiennially_lesstax = fcur(scur($this->get_template_vars('totalrecurringbiennially'),$c),$c,$r1,$r2); {/php} <tr class="carttabledue"> <td align="right">{$LANG.ordertotalduetoday}: </td> <td align="center">{php}echo $total_lesstax;{/php}</td> </tr> {if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially} <tr class="carttablerecurring"> <td align="right">{$LANG.ordertotalrecurring}: </td> <td align="center">{if $totalrecurringmonthly}{php}echo $totalrecurringmonthly_lesstax;{/php} {$LANG.orderpaymenttermmonthly}<br /> {/if} {if $totalrecurringquarterly}{php}echo $totalrecurringquarterly_lesstax;{/php} {$LANG.orderpaymenttermquarterly}<br /> {/if} {if $totalrecurringsemiannually}{php}echo $totalrecurringsemiannually_lesstax;{/php} {$LANG.orderpaymenttermsemiannually}<br /> {/if} {if $totalrecurringannually}{php}echo $totalrecurringannually_lesstax;{/php} {$LANG.orderpaymenttermannually}<br /> {/if} {if $totalrecurringbiennially}{php}echo $totalrecurringbiennially_lesstax;{/php} {$LANG.orderpaymenttermbiennially}<br /> {/if}</td> </tr> {/if} {else} {if $taxrate} <tr class="carttablesummary"> <td align="right">{$taxname2} @ {$taxrate}%: </td> <td align="center">{$taxtotal}</td> </tr> {/if} {if $taxrate2} <tr class="carttablesummary"> <td align="right">{$taxname2} @ {$taxrate2}%: </td> <td align="center">{$taxtotal2}</td> </tr> {/if} <tr class="carttabledue"> <td align="right">{$LANG.ordertotalduetoday}: </td> <td align="center">{$total}</td> </tr> {if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially} <tr class="carttablerecurring"> <td align="right">{$LANG.ordertotalrecurring}: </td> <td align="center">{if $totalrecurringmonthly}{$totalrecurringmonthly} {$LANG.orderpaymenttermmonthly}<br /> {/if} {if $totalrecurringquarterly}{$totalrecurringquarterly} {$LANG.orderpaymenttermquarterly}<br /> {/if} {if $totalrecurringsemiannually}{$totalrecurringsemiannually} {$LANG.orderpaymenttermsemiannually}<br /> {/if} {if $totalrecurringannually}{$totalrecurringannually} {$LANG.orderpaymenttermannually}<br /> {/if} {if $totalrecurringbiennially}{$totalrecurringbiennially} {$LANG.orderpaymenttermbiennially}<br /> {/if}</td> </tr> {/if} {/if} 0 Quote Link to comment Share on other sites More sharing options...
redrat Posted June 4, 2009 Share Posted June 4, 2009 Thanks for this Sam. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.