Category images on front page
Hello, ive been searching for a long time on this and I can't believe its not a standard thing in xcart.
Ive looked at older post which give me some code but not of them work. All I want to do is show a list (which would be blocks, divs etc) of all my main categories. I need it to show the category image and it to link to the category when clicked on...like this basically: http://www.knight-air.co.uk/ I know this bit of code display the subcategories, but how can I change it to use on the home page to display the root categories Code:
{foreach from=$categories item=subcategory} It would be a great idea if there was a knowledge base of snippets of code then people could use it as a reference. Thanks in advance. |
Re: Category images on front page
Hi mekon. This is where we keep our code snippets! Agreed it would be nice if they were organized...
Well I mocked up some code for you. Try adding this to /common_files/customer/main/welcome.tpl PHP Code:
|
Re: Category images on front page
Brilliant Mike, what a star you are.
Before I moved to xcart I used Actinic (now sellerdeck) and they have a knowledge base of tricks etc: http://community.sellerdeck.com/forumdisplay.php?f=27 Which proved really useful for developers. Maybe they will do something similar in the future. Thanks again. M |
Re: Category images on front page
Mike, sorry to bother you
For some reason when I move from the home page to another, then come back the categories are gone. If I run cleanup.php they appear again....until I goto another page and back etc. Any idea what this could be? M |
Re: Category images on front page
Ok, ive tested this in the default templates in 4.5.2, and it does the same.
I also tried it in a 4.4.2 site (same server etc) and it retains them...so something about the code that 4.5.2 doesn't like? |
Re: Category images on front page
|
Re: Category images on front page
Quote:
This is a superstar piece of code and I also do not know why it is not standard in x-cart... I was able to simple drop this code into a static page and voila - there is my category listing! |
Re: Category images on front page
Worked perfectly - in 4.6
Thanks !! |
Re: Category images on front page
Quote:
How did you drop this into a static page ? All it shows is code ? |
Re: Category images on front page
You are to enable Smarty tags in static pages first:
http://help.x-cart.com/index.php?title=X-Cart:Static_Pages |
All times are GMT -8. The time now is 05:36 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.