ice-man Posted June 26, 2004 Posted June 26, 2004 Pretty much what the title says. I already know how to sort the product attribute options, but how do you sort the product attributes themselves? Any hints or pointers will be greatly appreciated. THanks.
charmdiva Posted June 26, 2004 Posted June 26, 2004 I have been trying to figure this out myself. I have charms that can be bought in the letters A to Z. I set up an 'initial' attribute and entered the letters in order from A to Z. When you go to the product page, however, they are all out of order in the drop down menu. I can't figure out why. I don't think OSC allows you to sort the order. I believe there is a contribution to do it, but I haven't had time to look into it yet.
♥bruyndoncx Posted June 26, 2004 Posted June 26, 2004 on the product_info.php page find $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 . "'"); Replace with $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 pov.products_options_values_name asc"); KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
ice-man Posted June 27, 2004 Author Posted June 27, 2004 That code will sort the option values alphabetically, yes. But I already know that. What I need is to sort the *attributes*, NOT the option values. Does anyone understand what I'm talking about?
vasttech Posted June 27, 2004 Posted June 27, 2004 Not quite sure I understand where/what you are talking about. Is this right - for example? You have the following attributes for Product A - Size - Color - Model You have the following options for the attributes above: - Size Small Large - Color Black White - Model A B On the product_info page you would like the attributes to listed in alphabetical order as well as the options? If that is what you mean then I have to say mine already get sorted in alphabetical order when they display. Can you clarify what you are looking at or where you are talking about? osCommerce Knowledge Base osCommerce Documentation Contributions
ice-man Posted June 27, 2004 Author Posted June 27, 2004 Hi Jeff, I'm using Attrib Sort contribution to sort the options, but I also want to sort the attributes arbitrarily. So I want to be able to sort like this: - Size - Color - Model or like this: - Model - Size - Color or any other way I want them to sort in. Did I make myself clear this time?
ice-man Posted June 27, 2004 Author Posted June 27, 2004 Anybody? Let me explain again. For example, I want to sell computer systems with the following attributes: Processor, Memory, HD Drive. Now, it only makes sense to have 'Processor' at the top of the list, with Memory and HD Drive come next, like this: - Processor 2.4 GHz 2.8 GHz - Memory 256 MB 512 MB - HD Drive 80 GB 120 GB So my question is, how do I do this?
vasttech Posted June 27, 2004 Posted June 27, 2004 Okay now it is much clearer what you are trying to do. I would take a look at the option sort contribution and try to apply that to the attributes themselves. What you are trying to do is a custom sort so it would require some modifications. One way would be to add a field to the attribute table that you could put a sort order into (i.e. attribute 1 = 1, attribute 3 = 2, etc...), then run the query on the product_info page using that field as the sort by field. Make sense? osCommerce Knowledge Base osCommerce Documentation Contributions
ice-man Posted June 27, 2004 Author Posted June 27, 2004 Yes, perfectly. But I'm not that great with PHP and was hoping there's a contrib that does this. It's such a basic thing, somebody should;ve done this already.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.