I'm using the Catalog, and on a category page in the catalog the products are being ordered alphabetically by name. I would like to order them by SKU#... is that possible without hardcoding the changes in the module or without creating a new view and build my own "Catalog" links?
The two easiest solutions I see are to put the SKU in the title of the products, or to change one line of code in uc_catalog.module. The line is in theme_uc_catalog_browse() around 589:
<?php
$order = 'n.title';
?>If you change it to
<?php
$order = 'p.model';
?>the products will be ordered by the SKU by default. If you click on the Name or Price column header, tablesort will overwrite it until you visit the page again.
I'm probably going to write a way to order products in some arbitrary way, but I'd also like to hear if there are other fields in the {node} or {uc_products} table that people would like to sort on.
I made the change to the module, and got this error:
user warning: Unknown table 'p' in order clause query: SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM node n INNER JOIN term_node tn ON n.nid = tn.nid WHERE tn.tid = 15 AND n.status = 1 AND n.type IN ("product","spinners","blades","hand_wipes","contrast_decals","components","accessories","tools","kit") ORDER BY p.model LIMIT 0, 10 in /home/gooddayf/public_html/gdfproducts/includes/database.mysql.inc on line 172.
What should I change?
Is there a list of the variable titles for products anywhere? I want to sort by SKU#, but got the error above making the changes that Lyle advised. Is there something wrong with the call to the database? (I'm not a programmer, so I'm not super familiar with the under-workings of Drupal.)
-----
IX
Actually, I had forgotten that the code had been changed there since the last release, so that's what's causing the errors. If you want to brave the development version, go to http://www.ubercart.org/bazaar for instructions.
Otherwise, definitely change it back to stop the error. I think we're getting close to another release, but I also want to wait on Ryan to get back just in case he knows of something that he wants to finish first.
Sorry to cause you these problems.
I'd love to see just some way of easily sorting products by weight assigned to them... like the built in weight in drupal, except that there shouldn't be any limits from -10 to 10 here.
Could I add a custom key to the product type and then sort them all by that product key somehow, as a temporary solution?
Arbitrary product sorting is on my Battle Plans. If all goes well, this will be in alpha8.

