BAJI26 Posted May 11, 2017 Author Share Posted May 11, 2017 (edited) I've done a few pages so far but I have a page with 2 groups, so I did this ->where('tblproducts.gid', '13,2') but group 2 doesn't show! How can I have 2 groups on 1 page? Also how to show the domain pricing on homepage? Edited May 11, 2017 by BAJI26 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 11, 2017 Share Posted May 11, 2017 I've done a few pages so far but I have a page with 2 groups, so I did this ->where('tblproducts.gid', '13,2') but group 2 doesn't show! How can I have 2 groups on 1 page? you could try using wherein.. ->whereIn('tblproducts.gid',[13,2]) Also how to show the domain pricing on homepage? that's not easy and frankly you would be better off using a feed for that... a feed I wrote to show the prices in the old v6 table (without categories) is in the thread below... https://forum.whmcs.com/showthread.php?122790-After-upgrading-to-v7-domain-suggessions-have-gone&p=498618#post498618 and if you wanted to use a separate page and query the database... https://forum.whmcs.com/showthread.php?119130-WHMCS-v7-explore-domain-TLDs btw - in v7.2, the register domain page will show the pricing table... but I doubt you could use it outside of the cart. 1 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted May 11, 2017 Author Share Posted May 11, 2017 I wanna use it for my homepage where I have those 6 or so domains! 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted May 11, 2017 Author Share Posted May 11, 2017 Question: Is there a way to have just enter the smarty tag with the product ids.... like for product 1= {$myproduct.pid=18}, product 2= {$myproduct.pid=19} So if I have more than one groups on the page I can just enter the PID for the product.?? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 12, 2017 Share Posted May 12, 2017 I wanna use it for my homepage where I have those 6 or so domains! there's nothing to stop you from using a hook to get those six amounts from the database - it wouldn't be a million miles away from the hook for products, but you'd be querying the domain tables instead... I suspect it would be much faster than using a feed too. I can see your page is doing 5 separate calls to the feed - if you were going to use a feed, i'd have just called it once and have it output all five prices at the same time. Question:Is there a way to have just enter the smarty tag with the product ids.... like for product 1= {$myproduct.pid=18}, product 2= {$myproduct.pid=19} So if I have more than one groups on the page I can just enter the PID for the product.?? i'm tempted to say the short answer would be no! the longer answer would be that you theoretically could do something similar to that (not like your code though), but it would complicate the hook coding just for the sake of simplifying the smarty... in an ideal world, you should never really need to do that - you should be looping through the newly created array in the template, so referencing a variable directly in the way you describe shouldn't be necessary... the only reason I told you to reference them directly was because I could see you had already designed your layout, and it would probably have taken longer for you to try and integrate a foreach loop into it, so it was simpler to tell you how to reference the array directly. going forward, you should probably bear this in mind when designing your pages - incorporate the loop into it from the start, rather than design the page and they try to fit the array into the output by accessing directly like a feed... you can do that, I just wouldn't make a habit of doing it. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted May 12, 2017 Author Share Posted May 12, 2017 (edited) In WHMCS Admin you can put extensions on [highlight]sale[/highlight], I only want to display 6 manually chosen extensions with their prices. Like I have on my homepage! Edited May 12, 2017 by BAJI26 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 12, 2017 Share Posted May 12, 2017 In WHMCS Admin you can put extensions on [highlight]sale[/highlight], I only want to display 6 manually chosen extensions with their prices.Like I have on my homepage! ... and that hook you posted was remarkably close to what it should be - i'll give you 6/10 as i'll knock 4 marks off because the table you chose is wrong (as is the join), you don't need the hidden line, nor the groupBy... and ultimately, you'll need to join a 3rd table to it too! I quickly wrote the rough hook before lunch and then realised how potentially useful it is - especially for v7.2 - so i'll be working on expanding it to multiple flavours over the weekend in anticipation of the eventual v7.2 launch. with regards to sale, you can either specify the TLDs individually as you have done, or just use a where to specify the sale group... though you might as well stick to using feeds for now. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted May 12, 2017 Author Share Posted May 12, 2017 Cool... I'll wait then... Thanks! 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted May 15, 2017 Author Share Posted May 15, 2017 @brian! Drop me a link when you complete it! 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 29, 2017 Author Share Posted July 29, 2017 @brian! Hi Brian, any progress on the addon? 0 Quote Link to comment Share on other sites More sharing options...
cyben76 Posted November 15, 2019 Share Posted November 15, 2019 (edited) On 5/11/2017 at 5:03 PM, brian! said: On 5/11/2017 at 5:03 PM, brian! said: <?php use Illuminate\Database\Capsule\Manager as Capsule; function homepage_products_hook($vars) { $products = Capsule::table('tblproducts') ->join('tblpricing', 'tblproducts.id', '=', 'tblpricing.relid') ->select('tblproducts.*','tblpricing.*') ->where('tblproducts.gid','x') ->where('tblpricing.type', 'product') ->get(); $encodedata = json_encode($products); $decodedata = json_decode($encodedata, true); return array("myproducts" => $decodedata); } add_hook("ClientAreaPage", 1, "homepage_products_hook"); ?> Hey brian!, How do I change the hook so that I could use {$myproducts.'pid'.name} instead of {$myproducts.0.name} Edited November 15, 2019 by cyben76 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 2, 2022 Author Share Posted July 2, 2022 On 5/11/2017 at 12:23 PM, BAJI26 said: Thanks! So I can use what you did and apply it to other pages just create another hook php file correct? @brian! Hi there, digging up an old post here bud. Based on the Hook below how can I get the pricing options so that when the client chooses a price option and click buy that chose get transferred to the cart! <select name="billingcycle" class=""> <option value="monthly">1 Month - $15.99</option> <option value="quarterly">3 Months - $47.97</option> <option value="semiannually">6 Months - $95.94</option> <option value="annually">1 Year - $191.88</option> </select> <?php use Illuminate\Database\Capsule\Manager as Capsule; function RG_cloud_hosting_hooks($vars) { if ($vars['templatefile'] == "cloud_hosting") { $myproducts = Capsule::table('tblproducts') ->join('tblpricing', 'tblproducts.id', '=', 'tblpricing.relid') ->select('tblproducts.*','tblpricing.*') ->where('tblpricing.type', 'product') ->where('tblproducts.hidden','0') ->where('tblproducts.gid', '36') ->groupBy('tblproducts.id') ->get(); $encodedata = json_encode($myproducts); $decodedata = json_decode($encodedata, true); return array("myproducts" => $decodedata); } } add_hook("ClientAreaPage", 1, "RG_cloud_hosting_hooks"); ?> 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 2, 2022 Share Posted July 2, 2022 9 hours ago, BAJI26 said: @brian! Hi there, digging up an old post here bud. Have you read his signature? 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 2, 2022 Author Share Posted July 2, 2022 I dont see it, what does it say? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 2, 2022 Share Posted July 2, 2022 This: Quote As of 1st July 2021, I am no longer actively replying to (or even reading) threads. nor do I receive emails of new posts (or mentions of my name @brian! ). I will only be visiting here infrequently. 0 Quote Link to comment Share on other sites More sharing options...
M D Posted September 18, 2022 Share Posted September 18, 2022 On 5/11/2017 at 5:00 PM, brian! said: (apart from the taglines which aren't in the database how can you pull product tagline 0 Quote Link to comment Share on other sites More sharing options...
Khaled Alkhamesi Posted August 5, 2024 Share Posted August 5, 2024 There is code work for me as well i want get id plan {$myproducts.id} but function give to me id price , how i can do this? 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.