Jump to content

domainregister.tpl - add company country tax (gross price)


cluster

Recommended Posts

that worked in my old domainregister.tpl

<span class="pricing">{math equation="netprice + netprice * percentage / 100" netprice=$tldpricing.{$tld->tld}.register|replace:' EUR':'' percentage=17 format="%.2f"}</span>

it seems variable for $tldpricing is no longer compatible w/ 8.1

any idea what variable works in v 8 standard-card?

Link to comment
Share on other sites

you shouldn't need to use math equation in Smarty3 - once you make it a number, you should be able to perform calculations on it directly... e.g in the pricing table...

{(((current($price.register)|replace:',':'.')*1.17)|number_format:2)}

.... would take the registration price for a TLD, multiply it by 1.17 (add 17%) and set it to 2 decimal places... I supposed you might then need to add the currency prefix/suffix vack to the output.

Link to comment
Share on other sites

2 hours ago, cluster said:

it seems $price.register variable are ignored in .tpl file

it was taken from the v8.1 version of standard_cart/domainregister.tpl, so it definitely works if you're inside the pricing table loop.

2 hours ago, cluster said:

no output, I use own pricing - not connected to an external provider

you mean pricing within WHMCS? so does the above page... the problem I had was I didn't recognise where <span class="pricing"> is used (because it's not in v8.1 - or 8 or v7.10 I think - so I wasn't sure how far you were going back or whether you were talking about the pricing table, or when it returns a price after a search?

just checked and $tldpricing doesn't exist... perhaps open a {debug} in the template to see what's available.

Link to comment
Share on other sites

ok, if I replace the <span class="price"> part with:

{(((current($price.register)|replace:',':'.')*1.17)|number_format:2)}

it shows the price as 0.00

could this be caused when two  currencies are activated?

I use EUR as main currency & suffix second currency is $ but only used in whmcs backend for marketplace, in my frontend only EUR is shown.

Link to comment
Share on other sites

11 minutes ago, brian! said:

are we in the pricing table?

both, in search result part &  suggestions part

<div id="DomainSearchResults" class="w-hidden">
  ...
<p class="domain-price">
<span class="price">{((current($pricing.register)))}</span>
                            <button class="btn btn-primary btn-add-to-cart" data-whois="0" data-domain="">
                                <span class="to-add">{$LANG.addtocart}</span>
                                <span class="loading">
                                  
###
                                  
<div id="domainSuggestions" class="domain-lookup-result list-group w-hidden">
  ...
<span class="price">{(((current($pricing.register)|replace:',':'.')*1.17)|number_format:2)}</span>
                                <button type="button" class="btn btn-add-to-cart" data-whois="1" data-domain="">
                                    <span class="to-add">{$LANG.addtocart}</span>
                                    <span class="loading">
                                        <i class="fas fa-spinner fa-spin"></i> {lang key='loading'}
                                    </span>
                                  

 

Link to comment
Share on other sites

can it be added into the jQuery part from scripts.js?

            // primary lookup handler
            lookup.done(function (data) {
                jQuery.each(data.result, function(index, domain) {
                    var pricing = null,
                        result = jQuery('#primaryLookupResult'),
                        available = result.find('.domain-available'),
                        availablePrice = result.find('.domain-price'),
                        unavailable = result.find('.domain-unavailable'),
                        invalid= result.find('.domain-invalid'),
                        contactSupport = result.find('.domain-contact-support'),
                        resultDomain = jQuery('#resultDomain'),
                        resultDomainPricing = jQuery('#resultDomainPricingTerm'),
                        error = result.find('.domain-error');
                    result.show();
                    jQuery('.domain-lookup-primary-loader').hide();
                    if (typeof domain !== 'string' && !domain.error && domain.isValidDomain) {
                        error.hide();
                        pricing = domain.pricing;
                        if (domain.isAvailable && typeof pricing !== 'string') {
                            if (domain.domainName !== domain.idnDomainName && idnLanguage.not(':visible')) {
                                idnLanguage.slideDown();
                            }
                            if (domain.preferredTLDNotAvailable) {
                                unavailable.show().find('strong').html(domain.originalUnavailableDomain);
                            }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated