Jump to content

How to display individual TLD and Product price without using Data Feed


cyben76

Recommended Posts

Is there a way to get individual TLD and product price to display on a page without using Data Feed?

My WHMCS is installed in the root folder, created several pages, i don't know why but using Data Feed in the tpl file messed up my layout a bit, the price appears at both where i want it to display and at the bottom of my page.

 

Wondering if there is a way to get individual TLD and Product price to display without using Data Feed

Link to comment
Share on other sites

11 hours ago, cyben76 said:

Is there a way to get individual TLD and product price to display on a page without using Data Feed?

depends where... if it's a WHMCS page, then you could use a hook... if it's outside of WHMCS, then a data feed is the simplest way.

11 hours ago, cyben76 said:

My WHMCS is installed in the root folder, created several pages, i don't know why but using Data Feed in the tpl file messed up my layout a bit, the price appears at both where i want it to display and at the bottom of my page.

that shouldn't occur - certainly, if I use a product pricing feed from your website, it just displays the price as normal... so there must be something weird about either your template, or how you're calling the feed, for it to be displayed twice.

Link to comment
Share on other sites

Yes the page is within whmcs, I'm using the RedoNet template from marketplace..

 

I used the tld data feed on the homepage on one of the sliders, and the output is fine, but when i scroll down to the bottom of page it appears there as well.

 

I haven't contacted the template developer yet though. But using the data feed on other parts of the page is ok.

Link to comment
Share on other sites

33 minutes ago, cyben76 said:

Yes the page is within whmcs, I'm using the RedoNet template from marketplace..

then i'm not sure if i'm looking at your website - I thought it ended sg.net - but I can't see any sliders on the homepage. :?:

34 minutes ago, cyben76 said:

I used the tld data feed on the homepage on one of the sliders, and the output is fine, but when i scroll down to the bottom of page it appears there as well.

difficult to say without seeing the site - you can PM me a link if you don't want to make it public (and i'm looking at the wrong one)... also, I don't know if it's a slider in the sense of an image slider, or a cart-type slider.

37 minutes ago, cyben76 said:

I haven't contacted the template developer yet though. But using the data feed on other parts of the page is ok.

if it's a slider that comes with the template, then the developer might be a good first port of call on this - they may have ran into this before.

Link to comment
Share on other sites

2 minutes ago, brian! said:

then i'm not sure if i'm looking at your website - I thought it ended sg.net - but I can't see any sliders on the homepage. :?:

2

My WHMCS is in the subdomain so u have to add a my. in front and index.php?systpl=redo&carttpl=redo-default at the end

 

Still working on the template so it's not live yet, current site u seeing will be replaced once done.

Yup I've already open a ticket with them, thought i'd post here first to find an alternative solution.

Link to comment
Share on other sites

28 minutes ago, cyben76 said:

My WHMCS is in the subdomain so u have to add a my. in front and index.php?systpl=redo&carttpl=redo-default at the end

ah ok - I can see the slider you're talking about now.... nice template.

i'm not really noticing any issues with it though... I can see four domain pricing feeds being used on the opening slider and, as you say, it's working fine - but I can't see that output being duplicated anywhere else (checked on Firefox & Edge).

if you had to, you could write a hook to either pass the prices to the page as Smarty variables, or to create the slider entirely in the hook... but i'd hold off doing either unless you continue to see an issue with the feeds.

Link to comment
Share on other sites

1 hour ago, brian! said:

ah ok - I can see the slider you're talking about now.... nice template.

i'm not really noticing any issues with it though... I can see four domain pricing feeds being used on the opening slider and, as you say, it's working fine - but I can't see that output being duplicated anywhere else (checked on Firefox & Edge).

if you had to, you could write a hook to either pass the prices to the page as Smarty variables, or to create the slider entirely in the hook... but i'd hold off doing either unless you continue to see an issue with the feeds.

I'm using FireFox as well.
It's right at the bottom of the page, you have scroll all the way down, its at the left corner bottom. I missed it too initially..

Screen Shot 2018-02-12 at 11.30.45 PM.png

Link to comment
Share on other sites

25 minutes ago, cyben76 said:

It's right at the bottom of the page, you have scroll all the way down, its at the left corner bottom. I missed it too initially..

I think you have unclosed <divs> on the homepage... i'm counting 233 <div> but only 231 </div> ... so i'm wondering if one of the missing divs is causing the duplication. :?:

if it helps, the split in each template is (<div> / </div>)...

header.tpl - 40 / 35

homepage.tpl - 134 / 133

footer.tpl - 59 / 63

looking at the Redo demo site, there are 190 <div> and </div> in total - so somewhere you haven't closed 2 <divs>... happy hunting !

i'd suggest going back to the redo download zip and doing a count within those 3 template files to see what the correct split should be... I would assume homepage.tpl should be equal in opening/closing divs, so that might be one to check first.

Link to comment
Share on other sites

1 hour ago, brian! said:

I think you have unclosed <divs> on the homepage... i'm counting 233 <div> but only 231 </div> ... so i'm wondering if one of the missing divs is causing the duplication. :?:

if it helps, the split in each template is (<div> / </div>)...

header.tpl - 40 / 35

homepage.tpl - 134 / 133

footer.tpl - 59 / 63

looking at the Redo demo site, there are 190 <div> and </div> in total - so somewhere you haven't closed 2 <divs>... happy hunting !

i'd suggest going back to the redo download zip and doing a count within those 3 template files to see what the correct split should be... I would assume homepage.tpl should be equal in opening/closing divs, so that might be one to check first.

Thanks Brian! I forgot to check for unclosed divs, i have a feeling it should be somewhere in the slider....

Link to comment
Share on other sites

Used https://www.diffnow.com/ to compare orginal code with edited one, found some missing tags, closed them but still the same price still appear at bottom.

Check using https://validator.w3.org/ everything seems ok, tried this Div checker thingy at http://www.tormus.com/tools/div_checker all seems ok...

Finally did the last thing which i should have done first :wall1:

Uploaded the header.tpl, homepage.tpl, and footer.tpl. Inserted the Data Feed, still same result... output at bottom of page. Now still waiting for the template developer to get back to me. O.o

 

Link to comment
Share on other sites

13 hours ago, cyben76 said:

Uploaded the header.tpl, homepage.tpl, and footer.tpl. Inserted the Data Feed, still same result... output at bottom of page. Now still waiting for the template developer to get back to me. O.o

while you're waiting for the reply, you could try two things (one of which you probably have already)...

  1. if you enter a value, e.g $19.00 instead of the feed url, does that hard-coded price appear at the bottom... if not, then there is an issue with how the sliders are handling the feeds... which is probably fair enough as you have js calling js and that can always lead to issues... if it still shows $19.00 in the footer, then it's an issue with the template/slider.
  2. try using a Smarty variable in there, any will do, instead of the feed code...
    <script language="javascript" src="feeds/domainprice.php?tld=.com&type=register&regperiod=1&format=1"></script>

    so, even a language string will do...

    <span class="text-secondary">{$LANG.search}</span>

    if the language string only shows up in the slider and not in the footer, then you know the slider will accept Smarty variables - which means you can use a hook to obtain the prices; if the language string appears in the footer too, then there is an issue with the sliders.

update - just as a quick follow-up, curiosity got the better of me and if you try using a data feed (e.g yours) in an Owl Carousel slider (which is what that template is using), it works fine with no duplication anywhere...

JW4PJfd.png

Link to comment
Share on other sites

7 hours ago, brian! said:

if the language string only shows up in the slider and not in the footer, then you know the slider will accept Smarty variables - which means you can use a hook to obtain the prices; if the language string appears in the footer too, then there is an issue with the sliders.

 

Yes using Smarty works.. Does not show up at the bottom

8 hours ago, brian! said:

update - just as a quick follow-up, curiosity got the better of me and if you try using a data feed (e.g yours) in an Owl Carousel slider (which is what that template is using), it works fine with no duplication anywhere...

 

The problem was actually the Owl Carousel, if i disable loop and used Data Feed the price does not show up at the bottom of the page.

$("#Redo-Slider-home").owlCarousel({
      		//loop: true,
      		autoplay:true,
      		autoplayHoverPause:true,
      		items: 1
      
      	});	
      

But with loop disabled the slider stops at the last image...

 

I think best solution is enable loop on owl carousel and use smarty to get the price... But i looked thru the documentation, can't find how to do that...

Link to comment
Share on other sites

19 hours ago, cyben76 said:

I think best solution is enable loop on owl carousel and use smarty to get the price... But i looked thru the documentation, can't find how to do that...

you would do this in two parts... first a hook to get the pricing info and pass the resulting array to the template, and then edit the template to display it... you could do nearly all of it in the hook if you had to, but you'd still need to make a minor change to the template, so i'll keep things basic...

first the hook - create a .php file in /includes/hooks, give it a filename and paste the code below into it...

<?php

# Get Domain Pricing on Homepage
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;

function domains_price_list_hook($vars) {

	$myTLDs = array('.com','.net','.sg','.com.sg');
	$myCurrency = 1;

	$domains = Capsule::table('tbldomainpricing')
			->join('tblpricing','tbldomainpricing.id','=','tblpricing.relid')
			->where('tblpricing.type','domainregister')
			->where('tblpricing.currency',$myCurrency)
			->whereIn('tbldomainpricing.extension',$myTLDs)
			->select('tbldomainpricing.extension','tblpricing.msetupfee as price')
			->get();
				
	$encodedata = json_encode($domains);
	$decodedata = json_decode($encodedata, true);
	
	return array("domainprices" => $decodedata);
}
add_hook("ClientAreaPageHome", 1, "domains_price_list_hook");
?>

and then in your homepage.tpl template, you currently have...

                              <div class="Redo-animation domains-cost" data-delay-transtion="4">
                                <ul class="list-unstyled list-inline">
                                  <li>
                                    .com 
                                    <span class="text-secondary">
                                      <script language="javascript" src="feeds/domainprice.php?tld=.com&type=register&regperiod=1&format=1"></script>
                                    </span>
                                  </li>
                                  <li>
                                    .net 
                                    <span class="text-secondary">
                                      <script language="javascript" src="feeds/domainprice.php?tld=.net&type=register&regperiod=1&format=1"></script>
                                    </span>
                                  </li>
                                  <li>
                                    .sg 
                                    <span class="text-secondary">
                                      <script language="javascript" src="feeds/domainprice.php?tld=.sg&type=register&regperiod=1&format=1"></script>
                                    </span>
                                  </li>
                                  <li>
                                    .com.sg 
                                    <span class="text-secondary">
                                      <script language="javascript" src="feeds/domainprice.php?tld=.com.sg&type=register&regperiod=1&format=1"></script>
                                    </span>
                                  </li>
                                </ul>
                              </div>

I would change all that to just this...

<div class="Redo-animation domains-cost" data-delay-transtion="4">
	<ul class="list-unstyled list-inline">
		{foreach $domainprices as $domainprice}
			<li>{$domainprice.extension}
				<span class="text-secondary">${$domainprice.price}</span>
			</li>
		{/foreach}
	</ul>
</div>

the only lines you would need to change in the hook are...

	$myTLDs = array('.com','.net','.sg','.com.sg');
	$myCurrency = 1;

the first being a list of TLDs you want to show pricing for - if you add a new TLD to that list, e.g .org, save the hook and then refresh the site, the new TLD price should be visible on the slider.

the second is the currency ID value - if you haven't changed it, USD is usually 1 - but if not, just change the value to the correct currency ID for USD.

Link to comment
Share on other sites

3 hours ago, brian! said:

you would do this in two parts... first a hook to get the pricing info and pass the resulting array to the template, and then edit the template to display it... you could do nearly all of it in the hook if you had to, but you'd still need to make a minor change to the template, so i'll keep things basic...

first the hook - create a .php file in /includes/hooks, give it a filename and paste the code below into it...

 

3 hours ago, brian! said:

the first being a list of TLDs you want to show pricing for - if you add a new TLD to that list, e.g .org, save the hook and then refresh the site, the new TLD price should be visible on the slider.

the second is the currency ID value - if you haven't changed it, USD is usually 1 - but if not, just change the value to the correct currency ID for USD.

OMG brian!..Thank you so much once again

Link to comment
Share on other sites

  • 1 month later...
20 minutes ago, web2008 said:

How can you show prices only for the Default Base Slab?

if you're using the above hook, then just add another where statement to it...

	$domains = Capsule::table('tbldomainpricing')
			->join('tblpricing','tbldomainpricing.id','=','tblpricing.relid')
			->where('tblpricing.type','domainregister')
			->where('tblpricing.tsetupfee', '0')
			->where('tblpricing.currency',$myCurrency)
			->whereIn('tbldomainpricing.extension',$myTLDs)
			->select('tbldomainpricing.extension','tblpricing.msetupfee as price')
			->get();

 

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