Jump to content

Upgrade Package/Products


web2008

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

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