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 01-23-2013 18:13:06

goski
Member
Registered: 09-27-2005
Posts: 115

Sort New Products, Special, Featured Products, Best Sellers

Currently, as I understand it, you set the value of these columns to a 1 if you want to have the product included in one of these categories or leave it as a 0 to not display in these categories.

I would like to set the value of the column from 1 to nnn if the product is to be display then sort the display product according to the value in the column and leave it as a 0 to not display in these categories.

Can someone tell me how to do this and provide any code needed, as my coding skills are limited?  Also, will the code work in Version 7?

Offline

 

#2 01-23-2013 19:55:58

jj1987
Member
From: Orlando, FL
Registered: 07-14-2008
Posts: 502
Website

Re: Sort New Products, Special, Featured Products, Best Sellers

you would update core_tabledefs  "torderby" field where the tid is "ecom_prod"



-James Garrett

Offline

 

#3 01-26-2013 17:36:15

goski
Member
Registered: 09-27-2005
Posts: 115

Re: Sort New Products, Special, Featured Products, Best Sellers

That did not work.  I changed tid to ecom_prod in the torderby field.  Then I changed the value in the newdisp column in the ecom_prod table to 1 through 7 for the seven new products.  The only product displayed in for the New Products category was the one with a value of 1 in the newdisp column.

I didn't really understand what is suppose to occur when you change tid to ecom_prod in the torderby field.  It seems that tid is a column in the core_tabledefs table and ecom_prod is the name of the products table.

Offline

 

#4 01-28-2013 08:37:42

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

Re: Sort New Products, Special, Featured Products, Best Sellers

In the file {private}/apps/ecom/ECOM_Prod/ECOM_Prod.php, in the function prodlist() you will see:

Code:

     $sortfield = 'sortorder';
     $sorttype  = 'ASC';

Change to:

Code:

     $sortfield = 'THE_COLUMN_YOU_WANT_TO_SORT_BY';
     $sorttype  = 'ASC';

Nick Hendler

Offline

 

#5 01-29-2013 15:04:02

goski
Member
Registered: 09-27-2005
Posts: 115

Re: Sort New Products, Special, Featured Products, Best Sellers

That didn't quite do what I wanted.  If I set $sortfield = 'THE_COLUMN_YOU_WANT_TO_SORT_BY', CCP will use that column to sort the products for my normal product display.  I want to use the sortorder column values to sort for my normal product display.  But I want to use the newdisp values to sort products when a customer clicks on the New Product button.

It also appears that the newdisp column only recognizes values of 0 and 1.  If I set a value in the newdisp column to 2 or 3 or 4, those products are not displayed when a customer clicks on the New Product button.

I want to be able to set values in the newdisp column from 1 to 25 (just an example) and have those products, with a value greater than 0, sorted according to the values in the newdisp column when a customer clicks on the New Product button. 

I would also like to have the same capability to use on other columns, letting the values in the column determine which products are displayed and in what order.  So if a customer clicked on the Specials button, the products that would be displayed are the products with a value in the specialsdisp column that is greater than 0.  They would be display in ascending order based on the values in the specialsdisp column.

Offline

 

#6 01-30-2013 08:30:18

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

Re: Sort New Products, Special, Featured Products, Best Sellers

To just use a different sort field for new products listings only, in the file {private}/apps/ecom/ECOM_Prod/ECOM_Prod.php, in the function prodlist() you will see:

Code:

     $sortfield = 'sortorder';
     $sorttype  = 'ASC';

Change to:

Code:

if ($ns == 'prodnew') {

     $sortfield = 'THE_COLUMN_YOU_WANT_TO_SORT_BY';
     $sorttype  = 'ASC';

} else {

     $sortfield = 'sortorder';
     $sorttype  = 'ASC';

} // End of if statement.

Nick Hendler

Offline

 

#7 01-30-2013 13:09:06

goski
Member
Registered: 09-27-2005
Posts: 115

Re: Sort New Products, Special, Featured Products, Best Sellers

That still didn't work.  CCP seems to ignore any products where the value in the newdisp column is greater than 1.

Offline

 

#8 01-31-2013 08:22:20

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

Re: Sort New Products, Special, Featured Products, Best Sellers

That's because the newdisp column is a boolean value (1 or 0).  Perhaps you want to change all of those values in 'newdisp' to 1 or 0 then sort by 'datetimestamp' 'DESC'.


Nick Hendler

Offline

 

#9 01-31-2013 11:40:30

goski
Member
Registered: 09-27-2005
Posts: 115

Re: Sort New Products, Special, Featured Products, Best Sellers

The datetimestamp column is blank on all the rows in my ecom_prod table.  Are you suggesting that I just insert a number into the datetimestamp column and use it to determine the order in which I want my new products displayed?  Example:  If I have five new products to display and I want the golf bag to be shown first, the I would put a 1 in the datetimestamp field.  The product I want shown second would have a 2 in the datetimestamp field.  The other three products would have values 3, 4 and 5 in the datetimestamp field.

I could probably use any column that I'm not currently using such as whlprice and accomplish the same thing.  Changing the dispnew to an integer type would probably make the most sense but I'm not sure what affect that would have on the code that references that column.

Offline

 

#10 02-01-2013 09:18:04

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

Re: Sort New Products, Special, Featured Products, Best Sellers

Let me guess, you're using a spreadsheet and entering values manually.  You should default that column to '1359728236' which is the current time.  Then use RawDBAdmin and 'maintain' the ecom_prod table, and add a new column for your 'newprodsortorder' and sort on that.


Nick Hendler

Offline

 

#11 02-01-2013 17:35:06

goski
Member
Registered: 09-27-2005
Posts: 115

Re: Sort New Products, Special, Featured Products, Best Sellers

You are correct.  I make all my changes to ecom_prod, ecom_cat, ecom_prodoptions and ecom_prodoptionsel using Excel then importing them to their respective tables.
 
For what purpose is the datetimestamp used?

I haven't tried adding the column yet but I was able to control the order of display for the New Products category by using the recurprice column.  Trouble is that the recurprice gets displayed in my product price display.  I'll add the column when I get a little time. 

I am preparing to update the above four tables with 2013 data.  I deleted products, categories, options and option select rows that are no longer available for 2013.  But deleting the rows from the spreadsheet does not delete them from the tables in the database.  I think the easiest approach would be to delete all the rows from each table then import the spreadsheet data.  What is the best way to do this?

Offline

 

#12 02-04-2013 08:28:23

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

Re: Sort New Products, Special, Featured Products, Best Sellers

The datetimestamp column is used for modules like the SiteMap, GoogleBase and NewsRSS to show the last update time.  The best way to delete all rows in the product table prior to doing an import is to execute this statement in Raw DB Admin:

Code:

DELETE FROM ecom_prod

Nick Hendler

Offline

 

Board footer