Jump to content
robetus

Display one time amount at checkout?

Recommended Posts

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>

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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'... :P

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.

Share this post


Link to post
Share on other sites
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>

FkUaBfi.png

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. :idea:

  • Thanks 1

Share this post


Link to post
Share on other sites

That did the trick. Thank you very much! I'm sure others will find this useful as well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines