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)
-   -   How to change the content on the front page? (https://forum.x-cart.com/showthread.php?t=74251)

garys 07-27-2016 07:41 PM

How to change the content on the front page?
 
I have been programming for a living for almost 35 years now and although I never claimed to know everything, I have been able to figure most things out without assistance.

That doesn't seem to be the case with X-Cart 5. I am really struggling with things that, in my mind, should be easy to solve.

I thought it would be a simple thing to replace the Featured Products from the home page with New Arrivals and remove it from the sidebar. The main reason for this is that we want the new products to be featured automatically rather than having to select them manually every week.

It's easy to disable the Featured Products module. It's easy to add my own content to the page through Catalog | Front Page in the admin section.

On the other hand, I have no clue how to add the New Arrivals module to the main content section or remove it from the sidebar. I have tried to figure out what the code is doing but I feel like I'm going around in circles. As soon as I thought I found a solution, it turned out to be a dead end.

I have looked at the page with Webmaster Mode turned on and I can see the FeaturedProducts module entry in the Theme Tweaker. When I double-click the template, I am shown a .tpl file with a few lines of code ... none of which point me to anything that makes sense.

Clearly, I am not understanding the template system that is being used here. I have worked with other scripts that also used templates but was able to figure those out pretty easily. This is pretty discouraging.

Can somebody either help me with this particular issue or at least point me to an example of a similar issue? Telling me "you just have to write a module" isn't particularly helpful because I need to understand the concepts first.

Any help would be very much appreciated.

Thank you.

cflsystems 07-27-2016 08:29 PM

Re: How to change the content on the front page?
 
XC5 is not easy to follow. There is no straight way to explain it as it goes back and forth between php scripts and templates.

I still have hard time in some cases figuring out what's what and where does it come from.

Anyway look at this file - classes/XLite/Module/CDev/ProductAdvisor/View/NewArrivals.php - which shows the new arrivals products on site.

Code:

/**
 * New arrivals block widget
 *
 * @ListChild (list="center.bottom", zone="customer", weight="500")
 * @ListChild (list="sidebar.single", zone="customer", weight="160")
 * @ListChild (list="sidebar.second", zone="customer", weight="110")
 */


ListChild tells the cart where to show the widget.

Take a look at - protected function isVisible() - it tells the cart where and when to show the widget. You can just overwrite this function in your module and remove the sidebar condition.

This is something to start with, you may need to do additional modifications though

qualiteam 07-27-2016 09:22 PM

Re: How to change the content on the front page?
 
Please also check these forum threads:
- https://forum.x-cart.com/showthread.php?t=73877
- https://forum.x-cart.com/showthread.php?t=74130

Quote:

Telling me "you just have to write a module" isn't particularly helpful because I need to understand the concepts first.


Have you checked the documentation for developers at http://kb.x-cart.com/ ?
It explains the concepts and basics and has a lot of examples.

garys 07-28-2016 08:20 AM

Re: How to change the content on the front page?
 
Quote:

Originally Posted by qualiteam
Have you checked the documentation for developers at http://kb.x-cart.com/ ?
It explains the concepts and basics and has a lot of examples.


I do not see a way to access the developers' documentation from that link. It looks like more of a user guide.

After searching around (with Google), I found http://devs.x-cart.com/en/, which appears to be the correct page.

qualiteam 07-28-2016 10:20 PM

Re: How to change the content on the front page?
 
Ouch. You're right. At the moment the XC5 team is updating the documentation portal and the new URL is http://devs.x-cart.com/ (http://kb.x-cart.com/ will be for the end-user documentation only).


All times are GMT -8. The time now is 11:40 PM.

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