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

If Home?

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-31-2015, 07:36 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default If Home?

is there an if home statement?
__________________
xcart 5.1.2
Reply With Quote
  #2  
Old 04-01-2015, 12:22 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: If Home?

Please let us have a bit more details on what you want to achieve.

Do you want to check if it's the home page somewhere inside a custom template? What is the template?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 04-01-2015, 03:06 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: If Home?

Quote:
Originally Posted by qualiteam
Do you want to check if it's the home page somewhere inside a custom template?
I am sure this is what is being asked. In a template or class.
__________________
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
  #4  
Old 04-01-2015, 04:45 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: If Home?

There is no template variable that could say whether it is the home page, or not.
However, doing this check is a somewhat easy task.

In your custom module/theme decorate \XLite\Controller\Customer\ACustomer class and add the following method:
Code:
public function isHomePage() { return 'main' === $this->getTarget(); }

Now you can use this in any storefront template as follows (any of the following will work):

1.
Code:
<div IF="isHomePage()">....your code goes there...</div>

2.
Code:
{if:isHomePage()} ....your code goes there... {end:}
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following 2 users thank qualiteam for this useful post:
ARW VISIONS (04-01-2015), totaltec (04-01-2015)
  #5  
Old 04-02-2015, 12:08 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: If Home?

I don't understand tis portion.
In your custom module/theme decorate \XLite\Controller\Customer\ACustomer class and add the following method:

I have classes/XLiter/Module/TechChicks/ChampionSkin/Main.php

Where do I put

Code:
public function isHomePage() { return 'main' === $this->getTarget(); }
__________________
xcart 5.1.2
Reply With Quote
  #6  
Old 04-03-2015, 03:02 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: If Home?

Make a new class in your module that decorates the class.

Create: classes/XLite/Module/TechChicks/ChampionSkin/Controller/Customer/Customer.php

Code:
<?php namespace XLite\Module\TechChicks\ChampionSkin\Controller\Customer; /** * Customer Controller */ class Customer extends \XLite\Controller\Customer\ACustomer implements \XLite\Base\IDecorator { /** * Check if we are on home page */ public function isHomePage() { return 'main' === $this->getTarget(); } } ?>
__________________
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:
tony_sologubov (04-03-2015)
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 10:15 PM.

   

 
X-Cart forums © 2001-2020