Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change default sort on product page?


Bryan

Recommended Posts

Posted

Hi,

 

Yes, thanks for the thought, :thumbsup: I did look at it, but it isn't quite what I need. I have over 1500 products in 8 main categories - all I need is for the newest items (e.g. this years new rubber stamps) to be at the top of the list and because of the way they are coded, the latest ones have higher model numbers.

 

I thought I had it sussed last night, the first page comes up sorted by 'model number descending' exactly as I want... but subsequent pages are sorted by 'name ascending' again :'(

 

 

dcmo

  • 1 year later...
Posted

Is it possible to set the sort order of product options?

I have a site that no matter what I do I cannot get the Available Options to go in asending order from the base price to the highest price.

Is this possible by adding some additional code to the product_info.php.

 

I've also tried changing the data in the database table products_options_values

but no effect.

 

Help appreciated.

Thanks

Paoloie

  • 2 weeks later...
Posted
I changed this code in catalog/index.php (line 191 on mine)

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

break;

to this

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by final_price desc";

break;

 

if you want lowest price first, then dont use 'desc'

 

it worked for me :D

 

:thumbsup:

 

If you want product name desc then just adding 'desc' should work for you on the line

$listing_sql .= " order by pd.products_name";

 

change it to

 

$listing_sql .= " order by pd.products_name desc";

 

not tested tho' I wanted it by price.. and it worked...

 

This worked well for sorting by price, minus the 'desc'. Although small small 'problem', the page initially still shows Product Name+. Is it possible to have Price with + instead?

  • 5 months later...
Posted
Hi,

 

I tried this to sort by model descending, using

 

$listing_sql .= " order by p.products_model desc";

 

which works fine, except the product name column heading still has the little + next to it. How can I set this properly?

 

thanks

 

:blink:

Change:

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

to

$HTTP_GET_VARS['sort'] = $i . 'a';

Posted

I would like to install this contribution, but I am little scared to try it. I'm new at this stuff and I don't want to screw things up.

 

What does it mean to always run product_sort.sql? Can I do this with an FTP connection?

 

Also, the readme files seem to give a lot of options. Is there any clear, step-by-step instructions on installing this?

 

Thank you!

Posted

Hi guys,

 

I also would like to display my products by newest first. (Site looks stale otherwise.) Any ideas on how to change the default display for a 'date added' parameter?

 

Angel

  • 2 months later...
Posted
Boulder et.al.

Got it!

In index.php find the following

 

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

I've changed in first line _NAME to _MODEL

and in third line pd.products_name to p.products_model

 

Wonder if this wouldnt work for PRICE too??

BACK-UP, then give it a try :-)

damsbo

 

 

THANK YOU! Exactly what I was after (sorting by model #)

  • 1 month later...
Posted

I've been trying to get this bit of code to work

 

	if ( !$HTTP_GET_VARS['sort'] ) {
	//
	$HTTP_GET_VARS['sort'] = '3a';
	$sort_order='a';
	//
}

 

I like how it's very simple and apparenlty you just need to add it into default.php? :blink: Well i've been trying but it dosen't seem to do anything ... the code seems right but it might be where i've placed it? Anyone got suggestions on how to make this work.

 

I'm trying to set the default to SORT DOWN by PRICE (price column 3).

 

thanks :thumbsup:

Posted

I'm still trying to set the default sort order by price decending ... any more suggestions for a simple code change?

Posted
I'm still trying to set the default sort order by price decending ... any more suggestions for a simple code change?

 

 

Spencer, I think the change is supposed to be made in the index.php. Someone correct me if that is wrong.

  • 2 weeks later...
Posted

I am trying to order my prices in acsending order in the options box on my product page like everyone else here but I have 10 different "index.php" documents in my site and need to know which one to make the changes in.

 

Cheers,

 

David

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...