Product listing sort order
#141
Posted 29 January 2010, 21:55
#142
Posted 29 January 2010, 22:44
christianbright, on 29 January 2010, 21:55, said:
If you want to reomve the headings altogether I gave that in this post http://forums.oscommerce.com/topic/308798-product-listing-sort-order/page__view__findpost__p__1355844
To remove the sort function, find the line:
$lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text);
and delete.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#143
Posted 02 March 2010, 17:30
I am in the process of loading products onto my site and have discovered I need the ability to have different categories sorted in different ways. For example, in the spares categories, I need these to be sorted by part number (products_model) which is no problem as it's the default sort method I am using now. In other categories however, I need (and have yet to install) the sort number contribution as per the same sort method as the categories themselves.
What I need however, is the ability to select while creating and editing categories in the category definition, which of the several methods available, model, name, price, sort number etc. the category should be sorted by.
In your opinion, how much of a mod is this? also due to my not being overly proficient with php, I would really appreciate some help with it.
Cheers,
Peter.
#144
Posted 26 May 2010, 08:24
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_PRICE') {
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by final_price";
break;
}
}
} else {
$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
$sort_order = substr($HTTP_GET_VARS['sort'], 1);
$listing_sql .= ' order by ';
switch ($column_list[$sort_col-1]) {
case 'PRODUCT_LIST_MODEL':
$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_NAME':
$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= "pd.products_name";
break;
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_PRICE':
$listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : ''). ", pd.products_name";
break;
}
}
it did work sorting product by price, but it is not only sorting product by price , it is sorting by manufacture first then by price you can see here:
http://www.gamezone.co.id/pc-component-memory-c-261_250.html?osCsid=e089c923a064f6abe2da94247fa621f3
thing that i want is to sort only by price ignoring product name,manufacturer or other parameter.
thanks, and anyone have idea for this?? cause i have search in the forum and i can't find the solution.
Edited by byteeater, 26 May 2010, 08:25.
#145
Posted 22 July 2010, 16:49
Thanks.
#146
Posted 27 November 2010, 02:52
$HTTP_GET_VARS['sort'] = $i+1 . 'd';
but it isn't changing the way they sort. Not sure if this works for what I need. When I click on a category, I want the products to be displayed in reversed alphabetical order. Am I doing something wrong?
,
#147
Posted 07 March 2011, 00:43
I'm trying to randomize the product listing in categories... as I posted here:
http://forums.oscommerce.com/topic/370096-random-product-on-category-page
Is this possible at all? It's driving me crazy....
Thanks for any help.
Don't say I didn't worn ya.
n. pl. cans of worms Informal - A source of unforeseen and troublesome complexity.
#148
Posted 21 March 2011, 21:52
Thanks.
Don't say I didn't worn ya.
n. pl. cans of worms Informal - A source of unforeseen and troublesome complexity.
#149
Posted 19 July 2011, 21:30
I have ad the contri Easy Populate for 2.2
i want to sort on id is that possible?
greetz Edwin
edit:
i was looking for _ID and i want to sort on TABLE_HEADING_ID
low id first and so on
Edited by edensan, 19 July 2011, 21:40.
#150
Posted 11 September 2011, 21:16
Thank you for this really useful thread. I have just one noob question: will
if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
$_GET['sort'] = 0 . 'd';
$order_str = " order by p.products_date_added desc, pd.products_name";
} else {
work also on updated products?
#151
Posted 28 November 2011, 21:53
Forum, Thanks Designing New Themes the Easy Way, how-to-set-backgrounds.
my contributions Add Multiple Product In Product Listing 2.3.1 v.1.0 and Multiple Attribute entry boxes in product info page v1.0 for 2.3.1
#152
Posted 29 November 2011, 09:31
I did install the Ultimate SEO URLs contrib a while back. When I turn that off, my sort order problem goes away!!! Thanks so much for your help in pointing that out to me. I have not found the fix yet, but I see there are several versions after the one I installed, so it may be in one the new ones or in the thread somewhere. I guess will have to go find it.
Thanks again
Edited by cyberworlukltd, 29 November 2011, 09:35.
#153
Posted 12 March 2012, 10:00
- Since all of the products were restored from backup, all of the product's date added are exactly the same. So they sorted by the names.
- The names, or rather, there are no names. We just copy the model number in the name field, and they go A-01, A-02, etc. With the higher numbers obviously being the latest.
if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
$HTTP_GET_VARS['sort'] = 0 . 'd';
$listing_sql .= " order by p.products_date_added DESC, p.products_model";
} else {
But it doesn't take care of the latest model issue. How do I sort by date and models?
#154
Posted 12 March 2012, 10:38
oxwivi, on 12 March 2012, 10:00, said:
It sounds like you have no data in your database related to the ordering you want, so its impossible to re-order that way.
I would look at modifying Easy Populate so it uses the original content for 'date added' instead of altering it, have you looked at the Easy Populate thread on this?
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#155
Posted 12 March 2012, 13:01
spooks, on 12 March 2012, 10:38, said:
I would look at modifying Easy Populate so it uses the original content for 'date added' instead of altering it, have you looked at the Easy Populate thread on this?
As a solution, I want to sort first with date, then with models. How can I do that?
#156
Posted 12 March 2012, 13:24
PS If you has auto backup installed (see signature) you could have gone back easily.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#157
Posted 12 March 2012, 14:46
#158
Posted 12 March 2012, 15:07
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#159
Posted 12 March 2012, 15:33
#160
Posted 12 March 2012, 15:49
echo '<hr>' . $listing_sql . '<hr>';
and saying what is shows.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.














