Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

Sorting Attributes


59 replies to this topic

#41 ismaiel_c

  • Community Member
  • 22 posts
  • Real Name:Ismaiel

Posted 27 May 2010, 09:09

This a fantastic contributuion but i need the months to come before the years.

Edited by Jan Zonjee, 07 February 2011, 22:49.


#42 jbalter

  • Community Member
  • 3 posts

Posted 22 June 2010, 21:54

You are my hero.... You saved me so much time

#43 ArtWithHeart

  • Community Member
  • 4 posts
  • Real Name:Samantha

Posted 13 July 2010, 02:00

Thank you. SO much. For newbies like me it's small things like this that really help out. Wonderful - in case anyone else is wondering, it works perfectly! Clearly 6 years does not make a difference. Cheers!

#44 geco100

  • Community Member
  • 2 posts
  • Real Name:geco gordon

Posted 24 July 2010, 16:58

View Postdeadmatt, on 05 July 2005, 19:06, said:

Brilliant Just what i was looking for thanks :D

Helps to prevent my customers from automatically choosing the most expensive upgrades because they didnt see the options lol

anyway cheers :thumbsup:
Thank you for posting this

#45 Bramp

  • Community Member
  • 23 posts
  • Real Name:Kel

Posted 16 August 2010, 10:20

View Postrudolfl, on 31 December 2008, 08:15, said:

Use this code:
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pov.products_options_values_name");

This will sort by price first, then by name.

Rudolf

I hope someone can help me I've been trying to get the attributes to be sorted alphabetically but nothing works, tried the above and it did nothing. I've tried a sort order tool but with thousands of attributes it's ridiculous giving them all a number and then having to re-arrange the numbers when new attributes are added(so they are alphabetical). Are there any other ways to either sort attributes alphabetically or an easier way to organize / sort through the attributes?

#46 b2995

  • Community Member
  • 41 posts
  • Real Name:Just Me
  • Gender:Male

Posted 04 September 2010, 15:42

It's the simple things...an obvious step that should have been included in the standard version or added to the configuration. Even in 2010...Thank you! I sorted by Options Value ID in Descending order

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . "order by pa.options_values_id DESC");


#47 gmcaleese

  • Community Member
  • 1 posts
  • Real Name:Gavin

Posted 07 February 2011, 22:38

Im hoping this code works for me like it has for many others. Where do we enter this code?

#48 paul1011

  • Community Member
  • 3 posts
  • Real Name:Paul

Posted 02 March 2011, 21:29

Thanks for this nice simple code change that works. Works for my 2.3 store.

#49 GerryMander

  • Community Member
  • 2 posts
  • Real Name:Martin Gough

Posted 30 March 2011, 21:07

View PostBarefoot Kid, on 23 November 2006, 12:48, said:

this sorts the attribute by price all right but for me it fails to take into account whether theres a + or - sign in front of the price so the smallest prices are listed last :(

If you replace the options_values_price with convert(concat(price_prefix,options_values_price),signed) it will work....

#50 bowco

  • Community Member
  • 1 posts
  • Real Name:Manny

Posted 02 June 2011, 13:22

View PostBramp, on 16 August 2010, 10:20, said:

I hope someone can help me I've been trying to get the attributes to be sorted alphabetically but nothing works, tried the above and it did nothing. I've tried a sort order tool but with thousands of attributes it's ridiculous giving them all a number and then having to re-arrange the numbers when new attributes are added(so they are alphabetical). Are there any other ways to either sort attributes alphabetically or an easier way to organize / sort through the attributes?


Seriously, I know very little about this stuff. I was wrestling with this same problem for days and it was driving me nuts!!! Then I found this post. The only problem was that I didn't want to sort by price but rather alphabetically. Anyway, I used OPs code and changed the following:

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pov.products_options_values_name");


replace pa.options_values_price with pa.options_values_name


The sort seems to be working fine now.

#51 fbas

  • Community Member
  • 7 posts

Posted 07 June 2011, 18:47

View Postdp1726, on 02 April 2007, 19:37, said:

Great idea
But does anybody know how to change the code so that it sorts by model number.
example 1 2 4 7 12 14 18 ect.
Dave

Yes, I was just looking for this very thing when I came across this thread, since Model number is my primary concern.

Because this therad wasn't what I was looking for, I hacked the file myself:

in catalog/index.php, lines 160-164:
        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 ($column_list[$i] == 'PRODUCT_LIST_MODEL') {  //change here
          $HTTP_GET_VARS['sort'] = $i+1 . 'a';
          $listing_sql .= " order by p.products_model, pd.products_name"; //change here
          break;
        }


#52 buddhapi

  • Community Member
  • 3 posts
  • Real Name:Robert

Posted 22 June 2011, 19:13

View Postmitchind, on 29 November 2004, 20:49, said:

I put this in place for myself because it was driving me crazy trying to get the product options displayed in the order I wanted. All the sorting contributions I came across were difficult to implement or changed a lot of code.

All I wanted was something that showed my options in order of price. Or at the very least showed them in the order I entered them.

It's a simple fix that takes less than a minute.

What it does...
First - sorts by price
Second - if price is same (or 0), it sorts based on the order that the option was entered.

File to change ... /catalog/product_info.php

Replace this line
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

With this line
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.products_attributes_id");

Hope someone else will find this useful.


I'd like to have my attributes only appear in the order in which I enter them, I think this code will worked if tweaked a bit, currently I have sizes, some of which add to the base price and some of which subtract from the base
price. any help or tweaks would be greatly appreciated! and thanx in advance.

#53 gfasal

  • Community Member
  • 334 posts
  • Real Name:George
  • Gender:Not Telling
  • Location:Sevilla, Spain

Posted 02 July 2011, 02:18

Has anyone had this problem? - when this mod is applied the search returns nothing.

Am I the only one with this issue?

If not, can anyone post a MOD that fixes the search results issue.
OSC 2.3.1
INSTALLED:Document Manager / Monthly Sales and Tax Returns / Batch Print Invoices / Ultimate HTML EMAILs / AJAX Attribute Manager / OSC PDF Catalog / Move Bookmarks / Sort Order / Easy Populate / Sales Reports / Low Stock Report / Admin: Model # on Category / Product Administration Screen / Mini images in admin / SLiCK reCaptcha / Google + / Beautiful Breadcrumbs / 2.3.1 - Banner Language Mod / ADD New Page / EASY MAP (google) v.3.0 / Who's Online Enhancement for 2.3.1 / Admin Notes / scrambled order number / remove_unused_images / Quantity Select / Unit Weight / Product Specifions (filter results) / AJAX Product Attributes/ Attribute Codes/ Date & Order No. to Invoice/ O.P.I. 2.0 / Attribute Images / Manual Order Editor / Attributes Clone / Order Editor / Create Order / Company VAT No. / Add customer/ CKEditor 2.3.1 / Page Manager / Default images via admin / Percentage Shipping Price / QTPro / Scroll to Top / PDF Invoice / Featured Products / Product Listing Enhancements / AutoBackups / ..Custom Admin Mods /

#54 gfasal

  • Community Member
  • 334 posts
  • Real Name:George
  • Gender:Not Telling
  • Location:Sevilla, Spain

Posted 02 July 2011, 11:26

[quote name='gfasal' timestamp='1309573114' post='1590759']
Has anyone had this problem? - when this mod is applied the search returns nothing


ISSUE SOLVED
OSC 2.3.1
INSTALLED:Document Manager / Monthly Sales and Tax Returns / Batch Print Invoices / Ultimate HTML EMAILs / AJAX Attribute Manager / OSC PDF Catalog / Move Bookmarks / Sort Order / Easy Populate / Sales Reports / Low Stock Report / Admin: Model # on Category / Product Administration Screen / Mini images in admin / SLiCK reCaptcha / Google + / Beautiful Breadcrumbs / 2.3.1 - Banner Language Mod / ADD New Page / EASY MAP (google) v.3.0 / Who's Online Enhancement for 2.3.1 / Admin Notes / scrambled order number / remove_unused_images / Quantity Select / Unit Weight / Product Specifions (filter results) / AJAX Product Attributes/ Attribute Codes/ Date & Order No. to Invoice/ O.P.I. 2.0 / Attribute Images / Manual Order Editor / Attributes Clone / Order Editor / Create Order / Company VAT No. / Add customer/ CKEditor 2.3.1 / Page Manager / Default images via admin / Percentage Shipping Price / QTPro / Scroll to Top / PDF Invoice / Featured Products / Product Listing Enhancements / AutoBackups / ..Custom Admin Mods /

#55 adriantudorache

  • Community Member
  • 2 posts
  • Real Name:adriantudorache
  • Gender:Male

Posted 28 July 2011, 10:33

Thanks! That was very helpfull! :thumbsup:
I am only in the begining with my site

Edited by Jan Zonjee, 28 July 2011, 15:46.


#56 Supertex

  • Community Member
  • 18 posts
  • Real Name:Shawn

Posted 02 August 2011, 22:16

I've got some subcats where the "name" field has numeric values in it, and the default sort is as follows:

1
10
100
11
2
3
4
5
6
7
8
9

Is there a way around this? It should place 10 after 9 without having to enter 9 as "09". That has the potential to be confusing for customers.

Seems like it would be a fairly common question, but I've not seen anything on it yet. Perhaps I'm not searching the correct verbage. I'd really appreciate someone steering me in the right direction.

#57 Acknowledeged74

  • Community Member
  • 99 posts
  • Real Name:Ashley Smith
  • Gender:Female
  • Location:London, UK

Posted 21 August 2011, 11:14

View Postlazykins, on 16 July 2007, 02:18, said:

Yes, I am still looking for a way sort option values by name.
This should be simple. Can a better-coder-than-me tell me if I can modify product_info.php to do this?

I need to control what appears first in the list of product options.

I tried installing McGrath's Sorter/Copier but I think maaaaaybe it isn't fully functional with the latest version of the cart. While I didn't receive any errors, and the copy function worked fine, the sorting feature did nothing. I uninstalled it.

Back to square 1.

Amy

Hi its great that people are providing these sorts of things, thanks.

I have tried this but get an error, when I have tried to add a new attribute to a product, any ideas whats happened ? Error below.

1136 - Column count doesn't match value count at row 1

insert into products_attributes values (null, '31', '4', '33', '0', '+')

[TEP STOP]

-----------


Thanks in advance, I've attached an image of my Product Options page, I've set the 'value price' at 0

Conrad

Attached Files


Edited by Acknowledeged74, 21 August 2011, 11:19.


#58 Fyod

  • Community Member
  • 77 posts
  • Real Name:Fid Fyodor

Posted 08 September 2011, 01:24

Works with Ajax Attributes Manager. Mine went crazy and started sorting opposite.

THANKS!!

#59 gfasal

  • Community Member
  • 334 posts
  • Real Name:George
  • Gender:Not Telling
  • Location:Sevilla, Spain

Posted 11 September 2011, 22:23

View PostAcknowledeged74, on 21 August 2011, 11:14, said:

Hi its great that people are providing these sorts of things, thanks.

I have tried this but get an error, when I have tried to add a new attribute to a product, any ideas whats happened ? Error below.

1136 - Column count doesn't match value count at row 1

insert into products_attributes values (null, '31', '4', '33', '0', '+')

[TEP STOP]

-----------


Thanks in advance, I've attached an image of my Product Options page, I've set the 'value price' at 0

Conrad


YES - I had the same issue

http://forums.oscommerce.com/topic/379509-product-attribute-insert-error/page__fromsearch__1

http://forums.oscommerce.com/topic/379509-product-attribute-insert-error/page__fromsearch__1
OSC 2.3.1
INSTALLED:Document Manager / Monthly Sales and Tax Returns / Batch Print Invoices / Ultimate HTML EMAILs / AJAX Attribute Manager / OSC PDF Catalog / Move Bookmarks / Sort Order / Easy Populate / Sales Reports / Low Stock Report / Admin: Model # on Category / Product Administration Screen / Mini images in admin / SLiCK reCaptcha / Google + / Beautiful Breadcrumbs / 2.3.1 - Banner Language Mod / ADD New Page / EASY MAP (google) v.3.0 / Who's Online Enhancement for 2.3.1 / Admin Notes / scrambled order number / remove_unused_images / Quantity Select / Unit Weight / Product Specifions (filter results) / AJAX Product Attributes/ Attribute Codes/ Date & Order No. to Invoice/ O.P.I. 2.0 / Attribute Images / Manual Order Editor / Attributes Clone / Order Editor / Create Order / Company VAT No. / Add customer/ CKEditor 2.3.1 / Page Manager / Default images via admin / Percentage Shipping Price / QTPro / Scroll to Top / PDF Invoice / Featured Products / Product Listing Enhancements / AutoBackups / ..Custom Admin Mods /

#60 Camelhmpz

  • Community Member
  • 7 posts
  • Real Name:Brent

Posted 30 October 2011, 20:38

Perfect, just what I needed! Still a great solution after all this time. Kudos!

[img]http://forums.oscommerce.com//public/style_emoticons/default/thumbsup.gif[/img]