robetus Posted October 12, 2017 Share Posted October 12, 2017 Is possible to display the one time amount separately like you can with recurring amounts? How can I show the one time amount with the following (obviously what I wrote isn't working): <div class="recurring-totals clearfix"> <span class="pull-left">{$LANG.orderForm.totals}</span> <span id="recurring" class="pull-right recurring-charges"> <span id="recurringMonthly" {if !$totalrecurringmonthly}style="display:none;"{/if}> <span class="cost">{$totalrecurringmonthly}</span> {$LANG.orderpaymenttermmonthly}<br /> </span> <span id="recurringQuarterly" {if !$totalrecurringquarterly}style="display:none;"{/if}> <span class="cost">{$totalrecurringquarterly}</span> {$LANG.orderpaymenttermquarterly}<br /> </span> <span id="recurringSemiAnnually" {if !$totalrecurringsemiannually}style="display:none;"{/if}> <span class="cost">{$totalrecurringsemiannually}</span> {$LANG.orderpaymenttermsemiannually}<br /> </span> <span id="recurringAnnually" {if !$totalrecurringannually}style="display:none;"{/if}> <span class="cost">{$totalrecurringannually}</span> {$LANG.orderpaymenttermannually}<br /> </span> <span id="recurringBiennially" {if !$totalrecurringbiennially}style="display:none;"{/if}> <span class="cost">{$totalrecurringbiennially}</span> {$LANG.orderpaymenttermbiennially}<br /> </span> <span id="recurringTriennially" {if !$totalrecurringtriennially}style="display:none;"{/if}> <span class="cost">{$totalrecurringtriennially}</span> {$LANG.orderpaymenttermtriennially}<br /> </span> <span id="onetime" {if !$totalonetime}style="display:none;"{/if}> <span class="cost">{$totalonetime}</span> {$LANG.orderpaymenttermonetime}<br /> </span> </span> </div> 0 Quote Link to comment Share on other sites More sharing options...
robetus Posted October 12, 2017 Author Share Posted October 12, 2017 I forgot to mention that this is the standard_cart/viewcart.tpl 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 7 hours ago, robetus said: Is possible to display the one time amount separately like you can with recurring amounts? How can I show the one time amount with the following (obviously what I wrote isn't working): short answer is no - the variable you're looking for (whatever it's called!) doesn't exist... long answer is that you could *probably* calculate it in the template from other existing variables/arrays if you *had* to, but it wouldn't be straightforward. 0 Quote Link to comment Share on other sites More sharing options...
robetus Posted October 12, 2017 Author Share Posted October 12, 2017 Okay, I'm not to sure why a totalonetime wasn't programmed though. It seems like it should be there. The One Time fee items aren't even listed at in the summary at checkout with the standard cart and I'm not sure why WHMCS would leave something like that out. You have two possible pricing types recurring or one-time, free is free there is no price. Why would they create separate totals for all the recurring cycles and not one for one time products, makes no sense. I had to resort to hiding the listing completely when one time with smarty. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 I think the logic is that you want to show the customer the ongoing future costs... with one-time products, that's irrelevant as there are none. 0 Quote Link to comment Share on other sites More sharing options...
robetus Posted October 12, 2017 Author Share Posted October 12, 2017 There is a one-time cost and you should be able to show it at checkout, that makes sense. Customers have to pay something at checkout so that should be shown, don't you think? I think recurring should be shown too, don't get me wrong, both should be shown. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 18 minutes ago, robetus said: There is a one-time cost and you should be able to show it at checkout, that makes sense. sometimes it's best to abandon any hope of WHMCS 'making sense'... 20 minutes ago, robetus said: Customers have to pay something at checkout so that should be shown, don't you think? I think recurring should be shown too, don't get me wrong, both should be shown. i'm not necessarily disagreeing with you.. it's just the way things have always been (from memory) with the cart. I might have a closer look at this at the weekend... the info is there, but hidden deeply and it might be interesting to see if it can be extracted correctly. 0 Quote Link to comment Share on other sites More sharing options...
robetus Posted October 12, 2017 Author Share Posted October 12, 2017 That would be awesome, thank you! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 13, 2017 Share Posted October 13, 2017 15 hours ago, robetus said: That would be awesome, thank you! so one quick way to do it would be to add the following inside the {foreach $products as $num => $product} loop in standard_cart/viewcart.tpl... {if $product.productinfo.name eq "One-Time"} {assign totalonetime $totalonetime + $product.pricing.totaltoday->toNumeric()} {/if} that will give you a running total for one-time products, which you can then output in a similar way to your previous code... <span id="onetime" {if !$totalonetime}style="display:none;"{/if}> <span class="cost">{$currency.prefix}{$totalonetime|string_format:"%.2f"}{$currency.suffix}</span> {$LANG.orderpaymenttermonetime}<br /> </span> as it's currently written, it includes setup fees in the one-time amounts, but you could remove them by using $product.pricing.baseprice instead of $product.pricing.totaltoday, or $product.pricing.setup if you wanted a running total of just one-time setup fees. 1 Quote Link to comment Share on other sites More sharing options...
robetus Posted October 13, 2017 Author Share Posted October 13, 2017 That did the trick. Thank you very much! I'm sure others will find this useful as well. 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.