X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Special Offers on certain pages only - how? (https://forum.x-cart.com/showthread.php?t=73379)

Robwuk 01-08-2016 01:46 AM

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

totaltec 01-08-2016 03:48 AM

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.

Robwuk 01-08-2016 04:37 AM

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

totaltec 01-08-2016 05:12 AM

Re: Special Offers on certain pages only - how?
 
Great. Well if you get stuck feel free to ask questions.

Robwuk 01-08-2016 06:06 AM

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

totaltec 01-08-2016 06:16 AM

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}


Robwuk 01-08-2016 06:50 AM

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

totaltec 01-08-2016 12:56 PM

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.

Robwuk 01-08-2016 01:51 PM

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


All times are GMT -8. The time now is 04:31 AM.

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