Remitur Posted February 6, 2018 Share Posted February 6, 2018 If a customer has not enough credit for full payment of a proforma, and so he pays it partly by credit and partly in other ways (i.e. credit card or paypal), it's usually a mess... you'll need a double registration in accountancy for that invoice it may happen that the second payment (made i.e. by Paypal) is ridiculous low (few cents...) it may happen that you issue an invoice for only few cents... So it would be great that a user is allowed to apply credit to a proforma, only if his credit is sufficient for a full payment of the invoice (you have no sufficient credit for full payment? Pay full by Paypal, and use the credit later... or do a credit recharge and the pay in full with credit) I guess that should be sufficient to modify viewinvoice.tpl Someone in the web suggest a simple (but uneffective) correction: change this line: <input type="text" name="creditamount" value="{$creditamount}" class="form-control" /> replacing it with: <input type="hidden" name="creditamount" value="{$creditamount}" class="form-control" /> but it doesn't work: it hidden to the customer the option to pay with credit if credit is not sufficient to full payment, but it partly applies credit authomatically and without any alerto to the customer... so it's even worst. I guess would be necessary to modify all the "if" clause of this block of code: {if $manualapplycredit} <div class="panel panel-success"> <div class="panel-heading"> <h3 class="panel-title"><strong>{$LANG.invoiceaddcreditapply}</strong></h3> </div> <div class="panel-body"> <form method="post" action="{$smarty.server.PHP_SELF}?id={$invoiceid}"> <input type="hidden" name="applycredit" value="true" /> {$LANG.invoiceaddcreditdesc1} <strong>{$totalcredit}</strong>. {$LANG.invoiceaddcreditdesc2}. {$LANG.invoiceaddcreditamount}: <div class="row"> <div class="col-xs-8 col-xs-offset-2 col-sm-4 col-sm-offset-4"> <div class="input-group"> <input type="hidden" name="creditamount" value="{$creditamount}" class="form-control" /> <span class="input-group-btn"> <input type="submit" value="{$LANG.invoiceaddcreditapply}" class="btn btn-success" /> </span> </div> </div> </div> </form> </div> </div> {/if} in order to insert another .and. condition, but I can't imagine how to do it using the "available credit amount" and the "invoice amount", and comparing them ... Link to comment Share on other sites More sharing options...
Solution brian! Posted February 6, 2018 Solution Share Posted February 6, 2018 if you wanted to do this in checkout.tpl, you could change... {if $canUseCreditOnCheckout} to... {if $canUseCreditOnCheckout & $total->toNumeric() lte $creditBalance->toNumeric()} which basically checks if the order total is less than the credit balance, and if it is, the customer has the option to use credit... if the order value is greater than the credit balance, then they can't pay it partially with credit - the entire block of code wouldn't be displayed. then to do something similar in viewinvoice.tpl, you would change... {if $manualapplycredit} to... {if $manualapplycredit & $total->toNumeric() lte $clientsdetails.credit} it occurred to me that you could do this as hooks too... e.g do the comparison in the hook (clientareapageviewinvoice and/or clientareapagecart), and if statement is true, set $manualyapplycredit (or $canUseCreditOnCheckout) to false - that would automatically not show the credit block in the invoice / cart templates. 1 Link to comment Share on other sites More sharing options...
Recommended Posts