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 add custom html to homepage only? (https://forum.x-cart.com/showthread.php?t=75794)

ftorres 11-17-2017 10:26 AM

How to add custom html to homepage only?
 
Hi everyone, I asked this on Stackoverflow but still no answers.

I'm developing an X-Cart 5 site and need to add custom html on the homepage (a.k.a. storefront).

Using the X-Cart development documentation, I created a custom module and added the modifications to the Crisp White template using the @ListChild directive inside my TWIG files.

But, since I used ListChild with list=center.bottom , my custom module shows on every page. We want the code to appear only on the home page.

I have several questions:

1.Which @ListChild values can I use to display the module only on homepage?

2.Is there a website where I can see a list of all the available @ListChild values? I searched in X-Cart documentation and can't find a list of available ListChild positions.

3.If it's not possible using ListChild, I know we can query the current page inside the template. How to test if the current page is the homepage?

Thanks for all the help.

cflsystems 11-17-2017 12:47 PM

Re: How to add custom html to homepage only?
 
https://forum.x-cart.com/showthread.php?t=75705
https://forum.x-cart.com/showthread.php?t=73877

ftorres 11-17-2017 01:13 PM

Re: How to add custom html to homepage only?
 

@cflsystems Thank you. I tried inserting the code found in that thread and still doesn't work. Here is my twig file code, maybe I'm writing something incorrectly

Code:

{##
 # Home Module 3
 #
 # @ListChild (list="center.bottom", weight="600")
 #}
{if:getTarget()=#main#}
<div class="module-cta-full-container container-fluid">
  <div class="row cta-row-module-control">
    <div class="col-md-12 cta-module-full-col">
      <div class="img-cta-wrapper"><a href="#"><img src="images/content/discount-product.jpg"></a></div>
    </div>
  </div>
</div>
{end:}


cflsystems 11-17-2017 03:24 PM

Re: How to add custom html to homepage only?
 
You are trying smarty code while 5.3.x uses twig

This is the thread to follow

https://forum.x-cart.com/showthread.php?t=75705

The other one you can use as a reference what other targets can be used

ftorres 11-20-2017 05:24 AM

Re: How to add custom html to homepage only?
 
@cflsystems Thank you. My mistake. It worked perfectly now!


All times are GMT -8. The time now is 12:19 AM.

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