X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   How TO Order Products List By Field (https://forum.x-cart.com/showthread.php?t=802)

funkydunk 07-29-2003 09:49 PM

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.

aguy2no 07-30-2003 01:07 AM

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...? :oops:

funkydunk 07-30-2003 01:40 AM

Sorry my mistake :oops: 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) {


aguy2no 07-30-2003 03:03 AM

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

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! :D :D 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! :D

PhilJ 08-28-2003 12:02 PM

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

funkydunk 08-28-2003 10:21 PM

Have you tried ticking or unticking the list products in reverse order in admin?

PhilJ 08-29-2003 06:11 AM

That works now, thanks Funkydunk

Should have spotted that one :roll:

funkydunk 08-29-2003 06:34 AM

:lol:

jimskodi 01-08-2004 12:29 PM

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?

funkydunk 01-08-2004 01:23 PM

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


All times are GMT -8. The time now is 08:02 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.