Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Need code help. jQuery banner to home page only.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-09-2016, 07:02 AM
 
Katsu Katsu is offline
 

eXpert
  
Join Date: Jun 2012
Posts: 349
 

Default Need code help. jQuery banner to home page only.

I installed a third-party jquery banner but it appears on all pages. I need it to appear on the home page only. I believe I need to add an 'if' statement to /light_responsive/customer/home.tpl. The div class should be wrapped with a smarty snippet:
{if $main eq "catalog" and $current_category.category eq ""}

{/if}
I don't know what to code to enter between the {if ...} and {/if} statements.


Any help is much appreciated.
__________________
4.7.7
Light Responsive
Reply With Quote
  #2  
Old 08-09-2016, 04:15 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Need code help. jQuery banner to home page only.

Your code looks good. Add the the banner code in between. However, you might want to just put it in welcome.tpl or home_page_banner.tpl without the need for the if statement.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following user thanks cherie for this useful post:
Katsu (08-09-2016)
  #3  
Old 08-09-2016, 11:56 PM
 
Katsu Katsu is offline
 

eXpert
  
Join Date: Jun 2012
Posts: 349
 

Default Re: Need code help. jQuery banner to home page only.

Thank you Cherie. That does seem to make sense. Any chance you could point me to the correct spot to insert my banner code?

/light_responsive/customer/main/home_page_banner.tpl:


*}
{if $active_modules.Banner_System and $top_banners ne ''}
{include file="modules/Banner_System/banner_rotator.tpl" banners=$top_banners banner_location='T'}
{elseif $active_modules.Demo_Mode and $active_modules.Banner_System}
{include file="modules/Demo_Mode/banners.tpl"}
{else}
<div class="welcome-img">
<a href="http://www.x-cart.com" target="_blank"><img src="{$AltImagesDir}/custom/welcome_picture.jpg" alt="X-Cart" title="" /></a>
</div>
{/if}
__________________
4.7.7
Light Responsive
Reply With Quote
  #4  
Old 08-10-2016, 01:49 AM
  seyfin's Avatar 
seyfin seyfin is offline
 

X-Cart team
  
Join Date: May 2004
Posts: 1,223
 

Default Re: Need code help. jQuery banner to home page only.

As I can see, the banner code begins with these lines:

Quote:
<!-- ZOOM SLIDER HTML CONTENT START -->
<div id="bannerscollection_zoominout_21">

and ends with these lines:

Quote:
</div>
<p style="margin:0;padding:0;">&nbsp;</p>
<!-- ZOOM SLIDER HTML CONTENT END -->

So, if you need the banners to appear on the home page only, your code should be wrapped with the {if} ... {/if} smarty snippet - see example below:

Quote:
{if $main eq "catalog" and $current_category.category eq ""}
<!-- ZOOM SLIDER HTML CONTENT START -->
<div id="bannerscollection_zoominout_21">

... some skipped banner code ....

</div>
<p style="margin:0;padding:0;">&nbsp;</p>
<!-- ZOOM SLIDER HTML CONTENT END -->
{/if}
__________________
Sincerely yours,
Sergey Fomin
X-Cart team
Chief support group engineer

===

Check this out. Totally revamped X-Cart hosting
http://www.x-cart.com/hosting.html

Follow us:
https://twitter.com/x_cart / https://www.facebook.com/xcart / https://www.instagram.com/xcart
Reply With Quote

The following user thanks seyfin for this useful post:
Katsu (08-15-2016)
  #5  
Old 08-10-2016, 01:00 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Need code help. jQuery banner to home page only.

I would put it within the else/last section:
PHP Code:
{else}
{*
<
div class="welcome-img">
<
a href="http://www.x-cart.com" target="_blank"><img src="{$AltImagesDir}/custom/welcome_picture.jpg" alt="X-Cart" title="" /></a>
</
div>
*}
<!-- 
ZOOM SLIDER HTML CONTENT START -->
<
div id="bannerscollection_zoominout_21">

... 
some skipped banner code ....

</
div>
<
p style="margin:0;padding:0;">&nbsp;</p>
<!-- 
ZOOM SLIDER HTML CONTENT END -->

{/if} 
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following user thanks cherie for this useful post:
Katsu (08-15-2016)
  #6  
Old 08-15-2016, 02:24 AM
 
Katsu Katsu is offline
 

eXpert
  
Join Date: Jun 2012
Posts: 349
 

Default Re: Need code help. jQuery banner to home page only.

That fixed it. Thank you Sergey. Thank you Cherie.
__________________
4.7.7
Light Responsive
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:50 PM.

   

 
X-Cart forums © 2001-2020