| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Newest Products | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Newest Products
Cyberactive and I have been working on a module that shows up products added into the shop over the last week and have come up with the code below to show this on your home page.
Try this - it works fine and dandy in 3.2.2 First create a new php file customer/newest.php Code:
This is set to select 5 products added within the last week but you can change the timespan to whatever you like by changing the daterange variable. This is unix time so is calculated in seconds. Second, add into the customer/home.php file after the require featured.php bit Code:
Third, create a newest.tpl template: Code:
You will note in here two extra fields to the languages part, one in labels for the heading to the section then a second one to show if there are no new prodoucts. Fourth - amend home_main.tpl to Code:
Fifth and finally - amended the welcome.tpl template to the following: Code:
Not sure whether this works with 3.3. Enjoy
__________________
ex x-cart guru |
|||||||
#3
|
|||||||
|
|||||||
Cyberactive has taken it on further now - full thread is http://forum.x-cart.com/viewtopic.php?t=1402&highlight=
He has put it in place on his site and it looks really good - would make a good standard module if the x team are watching.
__________________
ex x-cart guru |
|||||||
#4
|
|||||||
|
|||||||
I runs smoothly over here.
And fast too.... I've just changed the query a bit to randomize the results.
__________________
Dennis Shop @ http://www.cyberlease.nl Version shop: 3.4.4 (shop is NOT life anymore) Mods: - Dutch language - Changed payment methods and shipping methods - Package tracking system for Dutch TPGpost. |
|||||||
#5
|
|||||||
|
|||||||
The randomise query is
Code:
Just change the number after LIMIT to show more or less products. Good luck.
__________________
Dennis Shop @ http://www.cyberlease.nl Version shop: 3.4.4 (shop is NOT life anymore) Mods: - Dutch language - Changed payment methods and shipping methods - Package tracking system for Dutch TPGpost. |
|||||||
#6
|
|||||||
|
|||||||
Re: Newest Products
Quote:
Funkydunk, i copied your code (which looks good), but it doesn't run into my site. I got the following errormessage at the top of the page : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site6/fst/var/www/html/config.php on line 288 And i got the following errormessage at the footer of the page : Warning: Smarty error: unable to read template resource: "customer/main/newest.tpl" in /home/virtual/site6/fst/var/www/html/Smarty-2.1.1/Smarty.class.php on line 546 What did I wrong ? |
|||||||
#7
|
|||||||
|
|||||||
Can you post your exact code into the forum and I will have a peek.
Cheers
__________________
ex x-cart guru |
|||||||
#8
|
|||||||
|
|||||||
Quote:
We are running version 3.1.3. Is that the cause of my problem ??? |
|||||||
#9
|
|||||||
|
|||||||
I would say yes... if you upgraded to 3.2.4 or 3.3.1 this would be workable. There seem to be quite a few changes from 3.1 to 3.2 onwards
__________________
ex x-cart guru |
|||||||
#10
|
|||||||
|
|||||||
Just a quick note that if you want this to show up when you are in other sections of the shop, like help.php cart.php then the thing to do is include the newest.php file in those files as per the instructions for home.php.
Code:
__________________
ex x-cart guru |
|||||||
|
|||
X-Cart forums © 2001-2020
|