rockhost Posted August 18, 2015 Share Posted August 18, 2015 Hello, I'm really liking the new WHMCS. Feels fresh. Anyway, I'm having a problem customizing the default cart.php page. As you can see the TLD table is missing prices here: https://my.rockhost.com/cart.php However, all kinds of neat pricing options appear at the search url: https://my.rockhost.com/domainchecker.php Can someone help me connect the dots? Everything else is in order. Let me know if you see otherwise. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 18, 2015 Share Posted August 18, 2015 have you updated to v6.0.2 ? that included a change to tablelist.tpl, so might be worth seeing if that fixes the issue - if not, come back and i'll take a look. 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 18, 2015 Author Share Posted August 18, 2015 Ah, no, I'm running v6.0.1. Is the next build related? I'll definitely go ahead and upgrade regardless. Hadn't seen that yet. - - - Updated - - - Ok cool, I just added about 10 tlds to my search as well. Guess we'll see what happens. Give me an hour... 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 18, 2015 Author Share Posted August 18, 2015 Hmm...No luck, didn't seem to make any visible changes. Maybe I'll clear out my templates_c dir, no? 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 18, 2015 Author Share Posted August 18, 2015 No dice. Any thoughts? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 18, 2015 Share Posted August 18, 2015 it might be something as simple as the variables/array not being available on that cart page - it looks like you're including domainchecker.tpl from the main template. what I would do is add a {debug} to your rockhost/products.tpl template and see if the $tldpricelist array is actually available - it looks not. if it isn't, then you may have to drop the idea of displaying the pricing table on the opening cart page; or obtain the array via a hook... or go old school and use a data feed to display the table. 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 19, 2015 Author Share Posted August 19, 2015 (edited) I am including domainchecker.tpl. It's inserted on line 47 of templates/orderforms/rockhost. I totally agree with you. Something is missing. I added {debug} to line 48 temporarily, but I'm not seeing any errors in the activity log or live on the page. Any thoughts? Or really, how do I "hook"? Grasping a new idea here. Love to learn. Thanks! Edited August 19, 2015 by rockhost typo 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 19, 2015 Share Posted August 19, 2015 I am including domainchecker.tpl. It's inserted on line 47 of templates/orderforms/rockhost. I totally agree with you. Something is missing. I added {debug} to line 48 temporarily, but I'm not seeing any errors in the activity log or live on the page. apologies - I should have said to add {debug} to the end of the file. it wouldn't have shown any errors in the logs or on the page, but it should have generated a popup box containing all variable/arrays available to that page... it seems you have left it in the template as it generated a popup when I visited just now - so you might want to remove that! i've imported your rockhost order-form template into my v6 dev and added the {debug} to products.tpl - as I suspected, $tldpricelist doesn't exist and that explains why the table is empty. actually, you'd also run into an issue if you were using multiple currencies, but you aren't - so never mind! Any thoughts? Or really, how do I "hook"? Grasping a new idea here. Love to learn. with the way you're including the domainchecker template, hooking to get this array is really awkward to do. for your issue, i'd be tempted to come at this from entirely another angle and embed a Data Feed inside the final table of domainchecker.tpl - it is that table that is being used when including domainchecker in your products template. so at ~line 120 in domainchecker.tpl, I would replace the following... {foreach $tldpricelist as $tld} <tr> <td>{$tld.tld}</td> <td class="text-center">{$tld.period}</td> <td class="text-center">{if $tld.register}{$tld.register}{else}{$LANG.domainregnotavailable}{/if}</td> <td class="text-center">{if $tld.transfer}{$tld.transfer}{else}{$LANG.domainregnotavailable}{/if}</td> <td class="text-center">{if $tld.renew}{$tld.renew}{else}{$LANG.domainregnotavailable}{/if}</td> </tr> {/foreach} with.. <script language="javascript" src="feeds/alltldpricing.php?currency={$currency.id}"></script> and then in the "Feeds" directory, create a new file called "alltldpricing.php" and add the following code within it... <?php require("../init.php"); require("../includes/domainfunctions.php"); $code = ''; if (!is_numeric($currency)) { $currency = array(); } else { $currency = getCurrency('', $currency); } if (!$currency || !is_array($currency) || !isset($currency['id'])) { $currency = getCurrency(); } $freeamt = formatCurrency(0); $tldslist = getTLDList(); foreach ($tldslist AS $tld) { $tldpricing = getTLDPriceList($tld, true); $firstoption = current($tldpricing); $year = key($tldpricing); $transfer = ($firstoption["transfer"] == $freeamt) ? $_LANG['orderfree'] : $firstoption["transfer"]; $code .= sprintf( '<tr><td class="text-center">%s</td><td class="text-center">%d</td><td class="text-center">%s</td><td class="text-center">%s</td><td class="text-center">%s</td></tr>', htmlspecialchars($tld, ENT_QUOTES, 'UTF-8'), $year, htmlspecialchars($firstoption["register"], ENT_QUOTES, 'UTF-8'), htmlspecialchars($transfer, ENT_QUOTES, 'UTF-8'), htmlspecialchars($firstoption["renew"], ENT_QUOTES, 'UTF-8') ); } $code .= ''; echo "document.write('".$code."');"; you should now have a working "ALL TLD Pricing" table on both domainchecker.php and cart.php! there is a slight issue with the Data Feed generated table rows looking slightly squashed (only in cart.php not domainchecker.php), but that is being caused by a order-form css clash - the solution I think is to modify rockhost/style.css and change the padding from "2px 3px" to "8px" - however, this might well have untold consequences elsewhere in the cart (possibly viewcart?), so you might want to test that thoroughly. #order-slider table tr td { padding: 2px 3px; if the css solution turns out to be something else, let me know! 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 19, 2015 Author Share Posted August 19, 2015 Wow, thanks, that's a lot to take in. My brain's fried for today, but I'll certainly test this tomorrow. I did remove the debug code. Thanks for that! 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 19, 2015 Author Share Posted August 19, 2015 Couldn't wait! That did the trick! Holy ****************! Thanks! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 20, 2015 Share Posted August 20, 2015 just checked out the site - it looks ok doesn't it! with regards to the table padding being different on the cart page from domainchecker, it occurred to me that if you wanted to fix it, it's easier not to mess with your stylesheets but to add the specific styling to the data feed, e.g replace each... <td class="text-center"> with... <td class="text-center" style="padding: 8px;"> and the two tables should match (apart from that i've centred the TLD in the data feed, but it's not centred in the original table - though I think mine looks better!). 0 Quote Link to comment Share on other sites More sharing options...
rockhost Posted August 20, 2015 Author Share Posted August 20, 2015 Thanks for following up. Yeah, that works too. Just applied the inline style. 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.