Jump to content

This topic is 7322 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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>

Posted

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

Posted

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?

Posted

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

Posted

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>

Posted

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

Posted

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.

Posted

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

This topic is 7322 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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