Jump to content

customization - modern theme configureproductdomain.tpl


Recommended Posts

modern theme 
configureproductdomain.tpl

I have just 2 questions ;-)
how can the configureproductdomain.tpl be adjusted to show the price for free domains (included domain name) with $ 0.00 after a availability check?

is it possible to display the output of the availability check without a popup (modal) at the bottom of the page?

Edited by cluster
Link to comment
Share on other sites

52 minutes ago, cluster said:

how can the configureproductdomain.tpl be adjusted to show the price for free domains (included domain name) with $ 0.00 after a availability check?

I might need to see a screenshot so I know exactly where you're referring to...

52 minutes ago, cluster said:

is it possible to display the output of the availability check without a popup (modal) at the bottom of the page?

it would need some rewriting to do that... if you're getting to the stage where you don't want a modal window (which Modern has always used), it might be time to switch to Standard_cart ! :idea:

Link to comment
Share on other sites

Thanks Brian,
if you order a hosting package with a mandatory domain name e.g.

cart.php?a=add&pid=83

after the domain check availability the price will be displayed ...
but if it's an included (free with package) domain name, then the full price will still be displayed

4uOHbHd.png

Edited by cluster
Link to comment
Share on other sites

oh ok "Free Domain" in that sense, I thought you might be referring to a TLD that was priced at $0.00 - my mistake... especially after answering your other question about freedomtlds. facepalm-24.png

5 hours ago, cluster said:

if it's an included (free with package) domain name, then the full price will still be displayed

this would be very difficult to do in Modern... and probably not much easier in Standard_cart either...

with Modern, you're actually dealing with two templates... configureproductdomain.tpl (the one where you enter the domain you're looking for), and then domainoptions.tpl (which displays the results in the modal window)... the big problem is that while configureproductdomain contains a list of free domain TLDs, domainoptions doesn't have that list - in fact, it doesn't even know which product that it's searching a domain for... if it at least knew that, then you could query the db to get the freedoms list... but without knowing the product, you can't determine the free TLDs.... and thus can't alter the pricing display... or even a custom message stating that the price will be discounted.

whilst you could use http_referrer in Smarty to get the previous page URL (which will include the PID value), it can be faked - so i'm reluctant to even use that as a starting point in the process.

on the one hand, standard_cart is just one template, but you'd still have to rewrite the js to do the checks and show different pricing... that's going to be a lot more than a minor tweak!

Link to comment
Share on other sites

thanks, I can not use the standard cart because of SEO pages for any domain endings which are pointed to an domain details page for that ending (selected in dropdown)

what about {if $freedomaintlds} can this be used w/ a condition to show prices for freedomains as free ($ 0.00)?

Link to comment
Share on other sites

7 hours ago, cluster said:

thanks, I can not use the standard cart because of SEO pages for any domain endings which are pointed to an domain details page for that ending (selected in dropdown)

fair enough... but i'd be really surprised if Modern is even going to be shipped with v8... and if it is, then that's means that v8 won't be that different from v7... :wall1:

7 hours ago, cluster said:

what about {if $freedomaintlds} can this be used w/ a condition to show prices for freedomains as free ($ 0.00)?

not in domainoptions because the array doesn't exist... also, domainoptions is used by the main domain search too... which complicates doing any customising in there unless you can differentiate when it's being used for a domain search or product domain search...

ok, this is a little hacky, but it's about the simplest way I can think to do it... (only changed code for register, so transfer/own domain etc not included in this) - in domainoptions.tpl, you can replace the {if $status eq "available"} block to add a condition to change the price to FREE! for free domain tlds...

{if $status eq "available" || $status eq "error"}

<div class="domainavailable">{$LANG.cartcongratsdomainavailable|sprintf2:$domain}</div>
<input type="hidden" name="domains[]" value="{$domain}" />
<div class="domainregperiod">{$LANG.cartregisterhowlong} <select name="domainsregperiod[{$domain}]" id="regperiod" class="form-control select-inline">{foreach key=period item=regoption from=$regoptions}{if $regoption.register}<option value="{$period}">{$period} {$LANG.orderyears} @ {if is_numeric($productid) AND in_array($tld,$freedomtlds) AND $regoption@iteration == 1}{$LANG.orderfree}{else}{$regoption.register}{/if}</option>{/if}{/foreach}</select></div>

{assign var='continueok' value=true}

then you'll need an action hook that passes the variables to the domainoptions template...

<?php

/**
* Domain Options Free Domain Pricing Hook
* @author brian!
*/

use Illuminate\Database\Capsule\Manager as Capsule;

add_hook('ClientAreaPageCart', 1, function($vars) {
    
	$templatefile = $vars['templatefile'];
	$url = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY);
	$productid = str_replace("a=add&pid=","",$url);
	$tld = strchr($vars['domain'],".");
	
	if(is_numeric($productid)) {
      
		$freedomaintlds = Capsule::table('tblproducts')
				->where('id', $productid)
				->value('freedomaintlds');
						
		$freedomtlds = 	explode(",",$freedomaintlds);
	
		if ($templatefile == "domainoptions") {
			return array("freedomtlds" => $freedomtlds, "productid" => $productid, "tld" => $tld);
		}
	}
});

so if there is a product with free domain TLDs...

qJsrzMt.png

if it's a product with no free domain TLDs, or it's a normal domain search...

9bOfySx.png

note that if a product has free domain TLDs, i've set it so that only the first year is shown as free...

ofworQe.png

in practice, if it's a free domain, they can only register it for one year anyway... so this might need some tweaking if you only want to show free TLDs for 1 year... all the variables are there, so it's just another if statement. :idea:

I can see at least two obvious flaws with this method - firstly, you don't know the billingcycle value at this stage (because it doesn't get chosen until the next step) - if you're offering free domain TLDs with all billingcycles for a product, then this won't matter... but if the free domain TLD is only for specific cycles, then you'll be showing the price as free, but if they later choose a cycle that doesn't include a free domain, they'll get charged for it... which they might not be happy about as they added it as "free".

I can't really see a simple way around this - you could expand the hook and show which cycles include free domains, but beyond that.... :?:

secondly, this method wouldn't work if you were using direct URLs to link to the products...

Link to comment
Share on other sites

Sorry for my late reply, we had some ddos attacks ...
The problem is I need to call it via a product url.
I have a domain price list and I only use 12 month periods, maybe there is a possibility to hide the dropdown completely with the price from configureproductdomain.tpl?
Thanks for your suggestions

Link to comment
Share on other sites

50 minutes ago, cluster said:

The problem is I need to call it via a product url.

then I don't think it can be done.

50 minutes ago, cluster said:

I have a domain price list and I only use 12 month periods, maybe there is a possibility to hide the dropdown completely with the price from configureproductdomain.tpl?

yes you could do that using the above method - but by linking direct to the product, you can't tell what the product ID is, and therefore you can't generate the freedoms list for that product... it's not in the current URL; it's not in the referrer URL (because there won't be one); it's in the session array, but that's unreliable because it's still in there if you add a product and then later search for a domain separately (so you'd end up showing domain registrations as free even though they won't be) - if you can find a way to get the product ID value in the domainoptions template, then your customisation can continue... until you do, I think it's dead in the water.

ironically, if you were using another dead orderform template, Boxes, this would work fine because there's only one template and that has access to both the pid value and the freedoms array - so I doubt you'd even need a hook with that.

Link to comment
Share on other sites

2 minutes ago, cluster said:

what about a "hidden field" parameter for the dropdown list, is that possible?

yes - but you're missing the point... domainoptions is used for all domain searches, so unless you can identify when its being used as a product domain search, whatever you add as a hidden field will apply to all products and separate domain registrations too.

Link to comment
Share on other sites

maybe this JS function at the bottom of configureproductdomain.tpl can be adjusted like the last part?

.hide().removeClass('hidden').slideDown();

It should only show "available or not" and the button "Next"

    function(data){
        if (data=='') {
            window.location='cart.php?a=view';
        } else if (data=='nodomains') {
            jQuery("#domainpopupcontainer").slideUp('slow',function() {
                jQuery("#greyout").fadeOut();
            });
        } else {
            jQuery("#prodconfigcontainer").html(data);
            jQuery(".domain-fade-out").fadeOut();
            jQuery("#domainpopupcontainer").slideUp('slow',function() {
                jQuery("#greyout").fadeOut();
            });
            jQuery("#prodconfigcontainer").hide().removeClass('hidden').slideDown();
        }
    });

 

Link to comment
Share on other sites

57 minutes ago, cluster said:

thanks I understand, I thought that the dropdown list are included in the configureproductdomain.tpl

no - that modal window is domainoptions.tpl... configureproductdomain just deals with the register/transfers/own & subdomain options... any searching is handled in domainoptions... only Modern uses domainoptions now - ajaxcart, comparison and slider used to in ye olden times, but they died a while back and aren't compatible with v7 (and possibly even v6) anyway. :661_coffin:

53 minutes ago, cluster said:

maybe this JS function at the bottom of configureproductdomain.tpl can be adjusted like the last part?

no that just closes the modal window and has nothing to do with the search...

3 minutes ago, cluster said:

for now I was able to hide it from style.css, maybe I can use a second style2.css instead and it should work then ;-)

if you're using a recent version of WHMCS, you should be adding custom css into six(or your custom)/css/custom.css - putting it in style.css means it could get overwritten during an update - though so will custom.css if you haven't renamed 'six' - so keep a look out either way.

if you just wanted to hide the pricing dropdown for everyone, regardless of product/domain search, then hiding it in css is one way to do it, hidden field would be another if you only offer 1-yr registrations anyway.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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