Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

currentSort order in FX.php

Featured Replies

I've read throught the documentation in FX.php as well as the FX.php in 8 hours booklet and can not find a way to specify the sort order in my query.

for example I have a link that has

<a href="clearance.php?currentSort=prod_sku<?php echo $currentSearch; ?>" class="whitetxt">Model #</a>

What I would like to add is a descend sort order.

I understand how to use the AddSortParam but I do not know how to have this work in a link.

Would you do this:

<a href="clearance.php?currentSort=prod_sku<?php echo $currentSearch; ?>&sortOrder=<?php echo $sortOrder ?>" class="whitetxt">Model #</a>

Good Luck.

Garry

  • Author

Well I was thinking more of simply having the sortOrder in the link itself.

<a href="clearance.php?currentSort=prod_sku&sortOrder=:??" class="whitetxt">Model #</a>

If your link is initiating the search then you could have:

<a href="clearance.php?currentSort=prod_sku&sortOrder=ascend" class="whitetxt">Model #</a>

You would then have in the "clearance.php" file:

$MyQuery->AddSortParam($_GET['currentSort'], $_GET['sortOrder']);

All the best.

Garry

  • Author

I had forgotten to add the $_Get['sortOrder'] in my query. (Doh!) Thanks again, Garry for your help.

Now would it be possible to have it so the sort toggles from ascend to descend on the same link?

also what does $performOrder do in the AddSortParam function?

The "$performOrder" is used if you have more than one sort. You can determine in which order the sorts occur.

What do you mean by "toggle on the same link"? Would you like some HTML/Javascript that toggles the value of the "sortOrder" parameter in the link?

All the best.

Garry

  • Author

Example of toggle on a link would be

HTML Table with several columns.

First name, last name, date started, date finished etc.

When you click on the First Name header in the table it would list the current first name query in alphabetical order a-z. When you clicked on the link again it would sort it in alphabetical order z-a. In essence changing the "sortOrder" parameter.

I thought there would possibly be a way to toggle from ascend to descend.

********************

So how would $performOrder be used in a query?

would it look something like this

<a href="clearance.php?currentSort=prod_sku&sortOrder=ascend&performOrder=1&currentSort=prod_name&performOrder=2" class="whitetxt">Model #</a>

Re: <a href="clearance.php?currentSort=prod_sku&sortOrder=ascend&performOrder=1&currentSort=prod_name&performOrder=2" class="whitetxt">Model #</a>

You cannot use the same paramenter name more than once is a URL. Hence:

<a href="clearance.php?SortA=prod_sku&sortAOrder=ascend&SortAperform=1&SortB=prod_name&SortBperform=2" class="whitetxt">Model #</a>

Re: be a way to toggle from ascend to descend

You will have to write a way. This could be in either Javascript, DHTML/CSS or PHP. If it was Javascript or HTML this could be just a method of changing the value before the link is submitted. Else, with PHP you can rewrite the link depending on the previous order.

All the best.

Garry

  • Author

I sort of understand the sort order but I thought that currentSort, sortOrder, and performOrder are functions in fx.php. How would I use the SortA, SortAOrder and SortAperform. With the fx.php functions?

My apologies for the "newbie" questions.

Re: I thought that currentSort, sortOrder, and performOrder are functions in fx.php

No, they are just variables used within the FX Class (FX.php). Hence, you shouldn't really use them.

You should use your own variable/parameter names, then assign them to the FX object via the various Class Methods; such as "AddSortParam()".

You might use them like this:

$MyQuery->AddSortParam($_GET['SortA'], $_GET['SortAOrder'],$_GET['SortAperform']);

$MyQuery->AddSortParam($_GET['SortB'], $_GET['SortBOrder'],$_GET['SortBperform']);

All the best.

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.