Author |
Topic |
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 25 2007 : 04:42:12
|
Hi Alex,
Yes the products table has a timestamp of when a product is added, in a field called cdateadded. This can be used for checking a time limit for New Arrivals. I agree that there is the possibility that at some point there may be no products to display depending on the time limit set, but you should be able to work this out according to your business ie. what is the longest interval between new products arriving. This solution is not a particularly difficult one to implement - it just involves an added conditional check when random products are called. I am not an expert SQL programmer and I'm sure the wonderful support guys here would help me out if this isn't quite correct, but you could add the following lines to shopaddrandomproducts.asp
line 98 reads: dim wherestr, sortstr add: ,BeginDate,EndDate
line 104 reads: sql="select * from products " & wherestr change to: BeginDate = DateAdd("D", -30, Date()) EndDate = Date() sql = "SELECT * FROM products WHERE (cdateadded >= " & BeginDate & ") AND (cdateadded <= " & EndDate & ")" & wherestr
The -30 is the number of days between the date today and the date that the product was added to the database but it can be changed to whatever you need.
Regards,
Carrol
|
|
|
Alex
VP-CART New User
50 Posts |
Posted - June 26 2007 : 06:31:27
|
Hi Carrol,
I'll give a shot and try it on today. Let me clarify one thing. Does that code change the functionality of ADDRANDOM? You see I need random product pick from featured products in homepage and time based random pick for new arrivals.
Regards,
Alex |
|
|
carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - June 26 2007 : 06:39:08
|
Hi Alex,
the solution for the New Arrivals question earlier on was assumed that random products would be used on one page only and not on the home page. The code changes that I wrote for time limiting the random products will affect all pages where random products are displayed. Take a look at Simon's posting earlier in this thread if you're looking for custom product displays. Their site is pretty good.
Regards,
Carrol |
|
|
Alex
VP-CART New User
50 Posts |
Posted - June 26 2007 : 06:57:35
|
Carrol,
I have just implemented the code. Is there any way to test its operation? I have created content 'New Products' and asociated it with my template which has only [Add_randomproducts].
Now I have product listed on site in New products. That product I created day or two ago. Tried to put -1 to see if it disappears from listing. It did not. I'll try to create new ones today and leave -1 for test sake.
thanks
|
|
|
|
Topic |
|