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

Special Offers on certain pages only - how?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-08-2016, 01:46 AM
 
Robwuk Robwuk is offline
 

Advanced Member
  
Join Date: Apr 2012
Posts: 36
 

Default Special Offers on certain pages only - how?

Is there a way of limiting which pages a module appears on

I want the special offers only to appear on the home page and a few other chosen pages

Im using X-Cart 4.6.6 and the Ideal Reponsive template

Ta

Rob
__________________
X-Cart Gold 4.6.6
Reply With Quote
  #2  
Old 01-08-2016, 03:48 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Special Offers on certain pages only - how?

Surround the code in the template with an if statement. For the home page, there is a commonly used example that I don't have in front of me, but it is something like

{if $main eq 'home' and $cat eq ''}
Do this on home page
{/if}

If main = home -this checks if the variable main is equal to home, which is true on the home page and all of the category pages. That's why we need the second piece: and cat = nothing, to ensure that a category is not set. Combined these two only evaluate to true if on the home page.

To set this up for other pages, you need to do something similar, but I can't suggest anything without knowing what type of page it is. Category page, product page, static page, etc.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #3  
Old 01-08-2016, 04:37 AM
 
Robwuk Robwuk is offline
 

Advanced Member
  
Join Date: Apr 2012
Posts: 36
 

Default Re: Special Offers on certain pages only - how?

That's great, i will give it a go, i now sort of get how it works, my next queries will be multiple pages

im only looking at home page, and special offer page so im guessing this will be offers, and also on a custom page ive added

Cheers

Rob
__________________
X-Cart Gold 4.6.6
Reply With Quote
  #4  
Old 01-08-2016, 05:12 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Special Offers on certain pages only - how?

Great. Well if you get stuck feel free to ask questions.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #5  
Old 01-08-2016, 06:06 AM
 
Robwuk Robwuk is offline
 

Advanced Member
  
Join Date: Apr 2012
Posts: 36
 

Default Re: Special Offers on certain pages only - how?

Thankyou

Iive used the following code, and it vanished from my home page, but appeared on some of my catagories, from what i can see its the catagories that dont have sub catagories.

{if $main eq 'home' and $cat eq ''}
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/new_offers_message.tpl"}
{/if}
{/if}

I dont want any (at present) catagories to show the offers, only the home page and special offers

ive managed to change it to new_arrivals and it worked ok (that was also removing the $cat bit)

Rob
__________________
X-Cart Gold 4.6.6
Reply With Quote
  #6  
Old 01-08-2016, 06:16 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Special Offers on certain pages only - how?

Rob,
Here is the correct Smarty code for you version (I think):
Code:
{if $main eq "catalog" and $current_category.category eq ""} Display on home page {/if}
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
Robwuk (01-08-2016)
  #7  
Old 01-08-2016, 06:50 AM
 
Robwuk Robwuk is offline
 

Advanced Member
  
Join Date: Apr 2012
Posts: 36
 

Default Re: Special Offers on certain pages only - how?

Thanyou, it has solved the main problem of displaying on every page,

however i still get the offers on certain catagories, it would seem that the offer is in relation to a product in that catagory (im assuming) as different offers appear on different catagories, which im guessing is a whole new problem as this i reckon relates to the module alone and not where to show a module on a page or not

Rob

v4.6.6
__________________
X-Cart Gold 4.6.6
Reply With Quote
  #8  
Old 01-08-2016, 12:56 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Special Offers on certain pages only - how?

Rob,
Yes there is nothing like "Show module on page".

Instead there are multiple places throughout the templates where code like you have above is used:
Code:
{if $active_modules.Special_Offers} {include file="modules/Special_Offers/customer/new_offers_message.tpl"} {/if}

Anywhere that the developer who wrote the module needed to make a template change, they would have wrapped a piece of code in an if statement like the one above. Use webmaster mode to inspect the templates on that category page, it should lead you to the template that needs to be edited.

Since you don't want to display the offers on the category pages at all, you can probably just comment that code block out once you find it.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #9  
Old 01-08-2016, 01:51 PM
 
Robwuk Robwuk is offline
 

Advanced Member
  
Join Date: Apr 2012
Posts: 36
 

Default Re: Special Offers on certain pages only - how?

Yes, i figured i would have to add the code in more than one place, i shall have a look using the webmaster mode, thankyou for your help

Rob
__________________
X-Cart Gold 4.6.6
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 12:28 AM.

   

 
X-Cart forums © 2001-2020