Jump to content

Change the order of appearance for addons


Go to solution Solved by brian!,

Recommended Posts

Hello,

I'm trying to modifythe order of appearance of the addons on this page (cart.php?a=confproduct&i=1) under "Avalaible addons" :

  1. I want weebly first, instead of SSL,
  2. I want change the order inside weebly addon himself 

Under admin configaddons.php, "Addon Weighting"    doesn't change anything...

I let an image to show the problem.

I'm using Six template / standarc_cart / v7.10.0

Thanks for your help, god bless you.

 

addons-order-of-appearance.png

Link to comment
Share on other sites

On 09/04/2020 at 08:35, iSurcouf said:

Under admin configaddons.php, "Addon Weighting"    doesn't change anything...

I don't think MarketConnect products have ever used/obeyed the weighting values when displayed on the products configuration page - I suspect they're just being listed in the order the query finds them in the database, e.g their table ID value rather than weighing.

On 09/04/2020 at 08:35, iSurcouf said:

I'm trying to modify the order of appearance of the addons on this page (cart.php?a=confproduct&i=1) under "Available addons" :

  1. I want weebly first, instead of SSL,
  2. I want change the order inside weebly addon himself 

putting Weebly before SSL can be achieved by reverse sorting the array using a simple action hook...

tVMeNIm.png

the second part of re-arranging the order within the Weebly block is more tricky - I think your main options would be to manipulate the content of the array elements for your preferred output, or recreate the entire array from scratch.

i'm tempted to think that it would just be simpler to just recreate the array - and that's not a simple hook.

Link to comment
Share on other sites

Thank four your answer @brian!

20 hours ago, brian! said:

I suspect they're just being listed in the order the query finds them in the database, e.g their table ID value

That's it ... 🙈

20 hours ago, brian! said:

putting Weebly before SSL can be achieved by reverse sorting the array using a simple action hook

Yes, but Weebly is between SSL and Codeguard... 😫

20 hours ago, brian! said:

recreate the entire array from scratch

I'm sure this is a way to achieve my need, but many clients are using theses produts, so it means I have to move addons for each clients, deletes all the addons, recreate them... 😫😫 no way...

I hope that WHMCS will improve this... UX is so important especially to get clients more confortable with usage of webhostings configuration ...

Link to comment
Share on other sites

  • Solution
2 minutes ago, iSurcouf said:

Yes, but Weebly is between SSL and Codeguard... 

try the hook below to resort the MC addons - it's the one I quickly wrote yesterday for that screenshot and is just a reverse alphabetical sort, so Weebly should appear first, SSL second etc...

<?php

# Re-Sort MarketConnect Addons Hook v1.0
# Written by brian!

function resort_marketconnect_addons_hook($vars) {
	
	if ($vars['templatefile'] == "configureproduct") {
		$cartaddons = $vars['addonsPromoOutput'];
		arsort($cartaddons);
		return array("addonsPromoOutput" => $cartaddons);
	}
}
add_hook("ClientAreaPageCart", 1, "resort_marketconnect_addons_hook");
?>

8L3NQ98.png

8 minutes ago, iSurcouf said:

I'm sure this is a way to achieve my need, but many clients are using theses produts, so it means I have to move addons for each clients, deletes all the addons, recreate them... 😫😫 no way...

there's no need to do anything that drastic...

someone posted on a similar topic in the v7.10 forums yesterday and I replied and linked to this thread.... because v7.10 GA has just been released, in all likelihood there will be a v7.10.1 maintenance update release before the end of this month consolidating all/most the hotfixes and bug fixes not found during the beta period.

the point being that the WHMCS will now have to decide if this is a bug or not... if they think it's a bug, then they could hotfix it quickly or include it in the maintenance release... for them to solve it internally would only require a few lines of code... equally, they could say that it's not a bug and that they want to determine the order in which options within these addons are shown.

21 minutes ago, iSurcouf said:

I hope that WHMCS will improve this... UX is so important especially to get clients more comfortable with usage of webhostings configuration ...

it's now a waiting game to see what they say in that other thread...

it would be far easier for them to "fix" this themselves, but if they don't think it's an issue (and it has been around for a long while), then it can be fixed externally - I know how it could be done (either a quicker external fix to address your very specific issue or a more thorough generic solution) - but there's no point in me thinking about spending time on that solution until WHMCS publicly decide whether they think this is an issue or not.

Link to comment
Share on other sites

1 hour ago, brian! said:

try the hook below

Brilliant @brian! Thank you very much, it's working very well !

Thank you for the time you have spent to make me a very complete answer. That's very kind of you. 😍

1 hour ago, brian! said:

WHMCS will now have to decide if this is a bug

I hope so !

Thank you again

Link to comment
Share on other sites

Hello,

Good news !

On 4/9/2020 at 9:35 AM, iSurcouf said:

I want change the order inside weebly addon himself 

It's fixed in v7.10.1 !

 

Regarding

On 4/9/2020 at 9:35 AM, iSurcouf said:

I want weebly first, instead of SSL

It works perfectly with the hook you provided @brian!

Thanks again !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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