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)
-   -   If Home? (https://forum.x-cart.com/showthread.php?t=71736)

ARW VISIONS 03-31-2015 07:36 PM

If Home?
 
is there an if home statement?

qualiteam 04-01-2015 12:22 AM

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?

totaltec 04-01-2015 03:06 AM

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.

qualiteam 04-01-2015 04:45 AM

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:}


ARW VISIONS 04-02-2015 12:08 PM

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();
    }


totaltec 04-03-2015 03:02 AM

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();
    }

}
?>



All times are GMT -8. The time now is 09:00 AM.

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