You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I had given the products certain item#'s so that they would appear in a certain order. Now with ccp5 that order is jumbled up. How do I get products to appear as I want them to, rather than this default way?
So, how would we reorder it if it's in SQL?
Will
wwwstnecorp.com
(New cart to be online as soon as I've got it looking right)
Offline
What type of SQL?
If it's MySQL, you could reorder using PHPMyAdmin or some other utility like that which your web host should provide for working directly with the database.
If it's MicroSoft SQL Server, you're going to have to rename the primary key for each item because that db returns everything alphabetically based on the primary key.
Not sure how PostgreSQL works, but I think it's similar to MySQL.
Offline
Well, I have tried converting back to CSV and editing (and I messed it up, thankfully I backup! ;-) ) AND I have also tried reordering with PHPMyAdmin and that didn't work either.
I ended up going into the code and added an ORDER BY statement to the categories and that worked.
My question is what general vicinity of the ste_prod.pl can I ORDER BY product_id? I have been tickering with it for a while now and haven't been able to find at what point it pulls the products so I can ORDER BY the product_id.
Thanks! ;-)
Offline
The best place to put that, rather than trying to find the SQL statement that matches the page (or pages) you're trying to modify is right at the top of the file. Right below the lines:
if ($sql_limit_string ne "") {
$sql_limit_string =~ s/start/$fd_startrow/gs;
$sql_limit_string =~ s/rows/$store_products_to_display_per_page/gs;
} ######### End of if statement.
Add the line:
$sql_limit_string .= "ORDER BY product_id";
Please note, if you're using CSV mode and ORDER BY increases the query time by about 5 times. If you're using an ODBC based driver (MS SQL Server) ORDER BY may result in blowing things up. That's why it wasn't implemented. If you're using MySQL or Postgre SQL, you'll have no worries and virtually no speed loss.
Offline
While you're in there fixing the shipping calculation issue..couldn't you think of a nice little way to make it easier to reorganize the way products are listed? Pretty please?
Maybe in a future release if we can find something portable between all db's that doesn't cause speed loss. For now, the best way to do it is to reorder the products in the db to the way you want them and the alphabetically adjust the primary key (product_id) field.
Offline
and the alphabetically adjust
>the primary key (product_id) field.
>
Not sure I understand what this last part means.