Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

How TO Order Products List By Field

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 07-29-2003, 09:49 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

The sort mechanism is already built by xcart just they haven't switched it on.

Just add a link to the top of the products.tpl

Sort this list by Price

And amend the navigation.tpl as shown

Then amend products.php by adding the assign to smarty code at the bottom.

You dont need to amend the sql query in any way.
__________________
ex x-cart guru
Reply With Quote
  #12  
Old 07-30-2003, 01:07 AM
 
aguy2no aguy2no is offline
 

Advanced Member
  
Join Date: Jan 2003
Location: The Netherlands
Posts: 37
 

Default

Thanks Funkydunk for being so helpfull!

Forgot to mention that I did this aswell. I kept the SQL query as it was initially brought by XCart. Then I amended the products.tpl with (like you proposed earlier)

Code:
* custom mod *} {if $products ne ""} <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr> <td valign="top" align="center" colspan="4"> Sort by: </td> </tr> <tr> <td valign="top" align="center"> Price </td> <td valign="top" align="center"> Product Name </td> <td valign="top" align="center"> Brand </td> <td valign="top" align="center"> Date Added </td> </tr> </table> {/if} {* end of custom mod *}

which is basically the same as amending :


When clicking; the list remains in the same sequence. So probably in my version sorting by price isn't switched on....

Where can I do that...?
Reply With Quote
  #13  
Old 07-30-2003, 01:40 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Sorry my mistake forgot what I did now... it was a while back

Code for func.php search for the func_search_products and replace the first line of that function declaration with
Code:
// function func_search_products($query, $membership,$first=0,$count_all=-1,$get_all=0, $orderby="orderby") { // funkydunk mod to add sort facilities function func_search_products($query, $membership,$first=0,$count_all=-1,$get_all=0, $orderby) {
__________________
ex x-cart guru
Reply With Quote
  #14  
Old 07-30-2003, 03:03 AM
 
aguy2no aguy2no is offline
 

Advanced Member
  
Join Date: Jan 2003
Location: The Netherlands
Posts: 37
 

Default

we are dealing here with a persistent little bastard.....

Amending the func.php, will result in:

Warning: Missing argument 6 for func_search_products() in c:\program files\apache group\apache\htdocs\shop\include\func.php on line 977

Warning: Missing argument 6 for func_search_products() in c:\program files\apache group\apache\htdocs\shop\include\func.php on line 977


However, changing the passage into:

Code:
function func_search_products($query, $membership,$first=0,$count_all=-1,$get_all=0, $orderby="price") {

Makes sure that every single category is sorted by price (ascending) by default! YEAHAAAAAAAAAAA! This is what I initially wanted.... Thank you funkydunk!

Other amendmends are not necessary anymore. However when you want the customer to choose his own sorting method, there is still one error as mentioned above.

Anyway...Funkydunk, you made a sunnyday out of myday today!
Reply With Quote
  #15  
Old 08-28-2003, 12:02 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,037
 

Default

I replaced the code

Code:
function func_search_products($query, $membership,$first=0,$count_all=-1,$get_all=0, $orderby="price") {

in func.php and my products are sorted by price DESCENDING when I really want them ascending.

How come yours are ascending and mine are descending?!

By the way this is in v3.4.5
Reply With Quote
  #16  
Old 08-28-2003, 10:21 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Have you tried ticking or unticking the list products in reverse order in admin?
__________________
ex x-cart guru
Reply With Quote
  #17  
Old 08-29-2003, 06:11 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,037
 

Default

That works now, thanks Funkydunk

Should have spotted that one
Reply With Quote
  #18  
Old 08-29-2003, 06:34 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

__________________
ex x-cart guru
Reply With Quote
  #19  
Old 01-08-2004, 12:29 PM
 
jimskodi jimskodi is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: florida, usa
Posts: 33
 

Default How would you sort by alphabetized in version 3.5.0

you had talked about being able to list the items via alphabetizing them from the data base instead of placing positions next to each item. what code do you have to implement and where?

I also need to do this for the items, but also for a subcatagories of names.
I have artists first and last names and want them to show up alphabetized.

Do I have to list them with their last name first or with a comma between first and last in order for this to work?
Reply With Quote
  #20  
Old 01-08-2004, 01:23 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

In version 3.5 the facility exists in admin to change the order of the products on the page by going into general settings.

The categories will need to be put into order by using the position field unless you want to list them all by last name then first name.

hth
__________________
ex x-cart guru
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:32 PM.

   

 
X-Cart forums © 2001-2020