web2008 Posted September 7, 2018 Share Posted September 7, 2018 Seeing that the order of the products will be a bit random, on the Upgrade Package/Products page ( upgrade.php ). Anyone who knows how to change the order of the products? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 7, 2018 Share Posted September 7, 2018 3 hours ago, web2008 said: Seeing that the order of the products will be a bit random, on the Upgrade Package/Products page ( upgrade.php ). Anyone who knows how to change the order of the products? looking at the array, I think it's ordered by name - and it's case-sensitive in that sorting too which helps to make it look a little random! depending on how you want to sort the array, the quick fix might be to use the Smarty SortBy plugin that I posted an update to here.. and then in the upgrades.tpl template change... {foreach key=num item=upgradepackage from=$upgradepackages} to... {foreach key=num item=upgradepackage from=$upgradepackages|@sortby:"#pid"} that would sort the array by Product ID (increasing values)... to sort by decreasing Product ID values (e.g reverse order)... {foreach key=num item=upgradepackage from=$upgradepackages|@sortby:"-#pid"} to sort the array by Product Group and then by Product ID value in each group... {foreach key=num item=upgradepackage from=$upgradepackages|@sortby:"#gid,#pid"} if you wanted to sort by Product Group / Product Name, you could use.. {foreach key=num item=upgradepackage from=$upgradepackages|@sortby:"#gid,name"} if you needed more complicated sorting, then the alternative would be to use a ClientAreaPageUpgrade action hook - take the $upgradepackages array, re-sort it however you choose, and then send the sorted array back to the template. 1 Quote Link to comment Share on other sites More sharing options...
web2008 Posted September 7, 2018 Author Share Posted September 7, 2018 Thank you very much, it just became the way I wanted it! 0 Quote Link to comment Share on other sites More sharing options...
Code Sensei Posted August 29, 2021 Share Posted August 29, 2021 Hi, Can anyone help me Whmcs 8.2.1 need to sort products on upgrade.tpl according to pid the above mentioned solution is not working and the file on the provided link is missing as well. 0 Quote Link to comment Share on other sites More sharing options...
AzeDK Posted October 28, 2021 Share Posted October 28, 2021 (edited) @brian! Can you share your plugin file? edit: I found it, thanks again Brian! Edited October 28, 2021 by AzeDK 0 Quote Link to comment Share on other sites More sharing options...
AzeDK Posted October 28, 2021 Share Posted October 28, 2021 On 8/29/2021 at 8:57 PM, Code Sensei said: and the file on the provided link is missing as well. @Code Sensei I found it here: 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.