X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Completely custom home page (front page) (https://forum.x-cart.com/showthread.php?t=74130)

benlind 06-28-2016 01:33 PM

Completely custom home page (front page)
 
I would like to completely customize my home/front page. I want to retain the main layout of the website (i.e., still use customer/en/body.tpl), but I want to remove the sidebar, add banners/slideshows, rotating quotes, etc. How can I get the front page to use a custom template file instead of having it be just another category list page?

qualiteam 06-29-2016 11:11 PM

Re: Completely custom home page (front page)
 
I guess you mean the default/en/body.tpl template.

In X-Cart 5 there is no a single template that determines the layout.
You can find most of templates that affect the layout under the skins/default/en/layout directory.

main.center.left.tpl and main.center.right.tpl are the two that display sidebars. But instead of changing the templates, you should use isSidebarFirstVisible() and isSidebarSecondVisible() methods in your module (check how these methods are used to hide sidebars during checkout).

Other templates (and widgets) get inserted into the page through @ListChild declaration.
You may find this article useful - it explains how to find what templates/widgets appear on the page and how to alter them or add new ones: http://kb.x-cart.com/display/XDD/Step+2+-+applying+design+changes

benlind 07-27-2016 03:27 PM

Re: Completely custom home page (front page)
 
Thanks for the reply. I understand how to edit templates, but I simply cannot find a template file for the home (front) page. I tried changing main.tpl, body.tpl, and welcome.tpl, but none of those affect only the home page. From what I can tell, the front page is just a special category page, which means that if I edit the categories page template, I will be editing every category's page.

Bottom line: How can I define a custom template for only the home page of the site, and no other page?

qualiteam 07-27-2016 08:53 PM

Re: Completely custom home page (front page)
 
You can check if it is the home page from your custom template:
https://forum.x-cart.com/showthread.php?t=73877

But the better way would be checking this in a widget class that renders the template (if there is one) and changing the template path returned in getDefaultTemplate() method accordingly.

You may also check this article:
http://kb.x-cart.com/display/XDD/How+to+find+out+what+page+is+currently+running


All times are GMT -8. The time now is 11:22 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.