Kryptronic Software Support Forum

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.

#1 08-10-2002 15:01:12

Guest
Guest

Product order

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?

 

#2 08-10-2002 16:27:59

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Product order

Reorder the rows in ./data/tables/product.csv using a text editor.


Nick Hendler

Offline

 

#3 08-10-2002 17:06:27

Will
Member
Registered: 02-26-2003
Posts: 493
Website

Re: Product order

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)


Will

Offline

 

#4 08-10-2002 17:20:56

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Product order

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.


Nick Hendler

Offline

 

#5 08-10-2002 18:58:32

Hilery
Member
Registered: 02-24-2002
Posts: 44
Website

Re: Product order

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

 

#6 08-10-2002 19:13:14

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Product order

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.


Nick Hendler

Offline

 

#7 08-10-2002 19:17:25

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Product order

Woops.  You better include that line within the 'if' statement, not right below the close of it.  Sorry - I just noticed that.


Nick Hendler

Offline

 

#8 08-11-2002 15:35:09

Guest
Guest

Re: Product order

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?

 

#9 08-11-2002 18:47:27

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Product order

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.


Nick Hendler

Offline

 

#10 08-12-2002 06:54:30

Guest
Guest

Re: Product order

and the alphabetically adjust
>the primary key (product_id) field.
>

Not sure I understand what this last part means.

 

#11 08-12-2002 07:24:54

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Product order

Just like you did with the product numbers in CCP4, the product_id will have to be alphabetically ordered in CCP5.


Nick Hendler

Offline

 

Board footer