View Single Post
  #3  
Old 11-08-2019, 12:27 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Redirecting a customer to a custom page after login, depending on parameter

Quote:
Originally Posted by cflsystems
First make sure this function is fit when someone logs in.
Then dump the Request so you can see what's being passed on.
Then make sure that - $this->performLogin() - is not doing the redirect - in that case your code below will not run.
  • The function is hit when someone logs in, this is certain. Otherwise the my first code (unconditional redirection) wouldn't work
  • $this->performLogin() - is not doing the redirect, for the same reason.
  • Somehow I have been unable to dump what is in \XLite\Core\Request::getInstance() (I elaborate on this later), but then, it seems the parameter isn't passed to the controller at all. That is. if I write
    Code:
    if (isset(_GET['param'])
    it still doesn't work.
So, my parameter isn't passed to the controller. But in the URL, it is there (cart.php?target=login&param=myparam). What can I do with this?


As to my impossible debugging, putting the dump function within the controller,
anywhere during the login process simply makes logging impossible. I also tried to
write a viewer class XLite/Module/VendorID/ModuleID/View/Login.php
Code:
<?php namespace XLite\Module\VendorID\ModuleID\View; /** * @ListChild (list="center", zone="customer", weight="101") */ class Login extends \XLite\View\Login { public static function getAllowedTargets() { $instance = \XLite\Core\Request::getInstance(); $dump = \Doctrine\Common\Util\Debug::dump($instance); echo $dump; return parent::getAllowedTargets(); } public function getParamValue() { return \XLite\Core\Request::getInstance()->param; } protected function getDefaultTemplate() { return 'modules/VendorID/dump.twig'; } }
(this time, the class doesn't have to decorate XLite/View/Login, but I tried both just
in case) echo $dump isn't really in a good place, but the function getAllowedTargets
gets always hit whenever the class is called, so I should get the result of dump
if not visible on the page, at least in the html source code somewhere. The twig file
isn't called, and probably viewer class. So what am I doing wrong again?
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote