Jump to content

How identify current page [Prestashop 1.7]


widepresta

Recommended Posts

Does that not work in 1.7?  Looking at the code, php_self is still defined

 

 

$this->context->controller->php_self 

Work on home page, category page, product page and other.

img-1_2.jpg

 

 

 

It for some reason will not work on my page.

 

img-2_1.jpg

 

 

How do I know if this is my page?

Edited by widepresta (see edit history)
Link to comment
Share on other sites

can you better describe what "your page" is?  what did you create?

 

 

Create class 

class MymoduleCollectionModuleFrontController extends ModuleFrontController
{
    public function initContent()
    {
        parent::initContent();
        $this->context = Context::getContext();

        $this->setTemplate('module:mymodule/views/templates/front/collection.tpl');
    }
}
Link to comment
Share on other sites

Hello,

I have same issue with Tools::getValue(), it always give back NULL.

in my case i call it from hookActionProductUpdate(), where i have extra text field on BO displayAdminProductsExtra.tpl

Link to comment
Share on other sites

 

Create class 

class MymoduleCollectionModuleFrontController extends ModuleFrontController
{
    public function initContent()
    {
        parent::initContent();
        $this->context = Context::getContext();

        $this->setTemplate('module:mymodule/views/templates/front/collection.tpl');
    }
}

you never set the php_self variable.  If you look at all of the core front controllers (like ProductController), they are set their page names.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...