Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Sort by price with column display....

Sort by price with column display....

Views: 46,929

Results 1 to 20 of 101
18 Jan 2007, 5:00 AM
#1
barnamania avatar

barnamania

Zen Follower

Join Date:
Nov 2006
Location:
London, UK
Posts:
67
Plugin Contributions:
0

Sort by price with column display....

I am displaying my items in columns, and I want to create a drop-down box so the user can sort by price etc.

So far I have the following code in tpl_index_product_list.php:

<form name="sorter" action="http://www.dreamofrussia.com/index.php?main_page=index&cPath=7" method="get"><select name="sorter" onchange="this.form.submit();"> <OPTION SELECTED value="">Sort by... <OPTION value="&sortby=4a">Price <OPTION value="&sortby=3a">Artist Name <OPTION value="&sortby=2a">Size </SELECT> </FORM>

How can I make it so that the sorter will work for any category, ie. dynamically choose which category?

Thanks in advance.

28 Feb 2007, 9:02 PM
#2
manada avatar

manada

New Zenner

Join Date:
Dec 2005
Posts:
35
Plugin Contributions:
0

Re: Sort by price with column display....

Also looking for this solution but not by using pop-up menu. All I need is two links in a product listing header: "Price asc" and "Price desc". Anyone knows how I can accomplish this?

Adam

3 Mar 2007, 4:22 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sort by price with column display....

Change the + and - to asc and desc in the Configuration ... Product Listing ... :smile:

5 Mar 2007, 3:50 PM
#4
manada avatar

manada

New Zenner

Join Date:
Dec 2005
Posts:
35
Plugin Contributions:
0

Re: Sort by price with column display....

Ajeh:

Change the + and - to asc and desc in the Configuration ... Product Listing ... :smile:

Yes Ajeh, but in a columanar display there is no clickable "-" or "+" like was in row listing (row listing has a sorter on "Model", "Item Name" and "price -(+)".

Adam

7 Mar 2007, 9:58 AM
#5
barnamania avatar

barnamania

Zen Follower

Join Date:
Nov 2006
Location:
London, UK
Posts:
67
Plugin Contributions:
0

Re: Sort by price with column display....

Manada, thanks for raising this again. This is probably the feature I want more than any other for my inline store - the option to sort by price under column view... and I'm sure other zenners would like it too. I have tried to make my own workaround, but no success yet...

Any pointers Ajeh?

Cheers

8 Mar 2007, 3:25 PM
#6
manada avatar

manada

New Zenner

Join Date:
Dec 2005
Posts:
35
Plugin Contributions:
0

Re: Sort by price with column display....

OK, i just look on this problem closely. I think we could go around like this:

At the beggining of tpl_modules_product_listing.php I entered as follow:

For ascending sorting link

echo '<a href="' . zen_href_link(FILENAME_DEFAULT , "cPath=$cPath") . "&sort=2a" . '">' . "Sort By Price (Asc)" . '</a><br>';

For descending sort. link;

echo '<a href="' . zen_href_link(FILENAME_DEFAULT , "cPath=$cPath") . "&sort=2d" . '">' . "Sort By Price (Asc)" . '</a><br>';

I know , its a little bit "off-zen" but it works.

Adam

10 Mar 2007, 12:33 AM
#7
ogegoon avatar

ogegoon

New Zenner

Join Date:
Jan 2007
Posts:
5
Plugin Contributions:
0

Re: Sort by price with column display....

Hi ! I was also trying to add a combo in this page to sort on the various columns. But without success... Probably because I have never developed with php before tonight :/

I tried to include "tpl_modules_listing_display_order" as done in the header_php of the product_all page:

require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_LISTING_DISPLAY_ORDER));

But it does not even display the combo...

As I would like to avoid learning php (and everything about ZenCart) in one night... just to add this combo in one page. Someone can help me ?

Should I include more than just the "require(...)" ???

O.

10 Mar 2007, 1:03 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sort by price with column display....

If you want to sort by price can't you just set the sort order on the Product Listing to your Price column?

Click on the title above it and it will tell you the sort setting in the URL ...

10 Mar 2007, 6:10 AM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Sort by price with column display....

I believe the point is that that function doesn't exist in the column grid view. Would finding the sort number before installing the grid mod be relevant after the mod is installed?

10 Mar 2007, 2:34 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sort by price with column display....

I don't use that add-on so perhaps someone who does can better answer this for you ...

10 Mar 2007, 6:41 PM
#11
ogegoon avatar

ogegoon

New Zenner

Join Date:
Jan 2007
Posts:
5
Plugin Contributions:
0

Re: Sort by price with column display....

I my case, I would like to show a combo, so the customers know immediately that they can sort on the various column. Otherwise, some of them does not find the trick (click on the column title).

And indeed, I find the New Listing and All Listing clearer.

O.

13 Mar 2007, 4:21 AM
#14
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Sort by price with column display....

So that's what you mean by "combo"! The name for it is a dropdown menu.

You might look at the product info page attributes files to see how they display the dropdowns. The code ought to be transferable for a different purpose.

13 Mar 2007, 4:30 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sort by price with column display....

OgeGOon:

?

On this site for example, they have a "combobox" : http://www.moreaudistribution.be/index.php?main_page=products_all

See "Classement par" (= "Sort by").

It is more "sexy" than links...

O.

You have the same thing on your All Product page too ... :smile:

13 Mar 2007, 5:33 AM
#16
manada avatar

manada

New Zenner

Join Date:
Dec 2005
Posts:
35
Plugin Contributions:
0

Re: Sort by price with column display....

All my intention was to do this in "columnar listing". Didn't see on all forum that someone did that before for "columnar display". As a non-PHP programmer just figured out I can live with links :-). And yes, "All products", "Featured Products" and "New Products" have a dropdown menu with "sort by Price" but the the products listed on those are in row view.

Adam

14 Mar 2007, 11:34 AM
#17
barnamania avatar

barnamania

Zen Follower

Join Date:
Nov 2006
Location:
London, UK
Posts:
67
Plugin Contributions:
0

Re: Sort by price with column display....

Yup, see... this is the whole problem... no drop down box on columnar view. Surely it must be fairly simple to do - just copy / modify some code somewhere, since it's already standard on row view?

Anyone know how to do it? I tried and failed miserably :shocking: lol

14 Mar 2007, 10:26 PM
#18
ogegoon avatar

ogegoon

New Zenner

Join Date:
Jan 2007
Posts:
5
Plugin Contributions:
0

Re: Sort by price with column display....

Thx for your answer gjh42
And sorry for the wrong term... I am more confortable with the names used for the Microsoft's "fat" controls :blush:

I already tried to copy the code from "All Product". But as you advice, I will have a look on the attribute set to display/hide this dropdown and search how it is used...

O.

26 Mar 2007, 10:02 PM
#19
barnamania avatar

barnamania

Zen Follower

Join Date:
Nov 2006
Location:
London, UK
Posts:
67
Plugin Contributions:
0

Re: Sort by price with column display....

I'm guessing this thread's died with no solution eh...?:unsure:

27 Mar 2007, 9:20 PM
#20
ogegoon avatar

ogegoon

New Zenner

Join Date:
Jan 2007
Posts:
5
Plugin Contributions:
0

Re: Sort by price with column display....

Indeed, I was too lazy to try again... :blush:

O.