Back to Easy Shop Support

amjadiqbalkhanniazi28057
amjadiqbalkhanniazi28057

Getting this error on profile page Type error: Argument 1 passed to Cms\Classes\Router::getParameter() must be of the type string, null given, called in /var/www/html/easyshop/modules/cms/classes/Controller.php on line 1398

paulgrafx
paulgrafx

Yes same here after an OctoberCMS update.

If I find the solution I will pass on the code :)

UPDATE: For me the issue related to the following but not sure what effect this will have.

Noting out Line 56 /shop/components/userProfile.php

/*
if ($code = $this->activationCode()) {
$this->onActivate($code);
}
*/

Or to manually add the following to the themes profile page.

[userProfile]
redirectOnLogin = "login"
redirectOnRegister = "login"
productPage = "product"
// Important Part
paramCode = "any-old-value"

Last updated

amjadiqbalkhanniazi28057
amjadiqbalkhanniazi28057

go to plugins/pixel/shop/components/UserProfile.php and comment the following code

 // if ($code = $this->activationCode())
      //     $this->onActivate($code);

it will work

paulgrafx
paulgrafx

Okay I have sorted the issue.

The problem relates to the functions that controls the verification code when registered users have to confirm their email address (Whether this is set to active in config or not). This is not a perfect solution but works. It relates to the plugins/pixel/shop/components/UserProfile.php file.

Another good thing the email verification now works :)

Add the following:

Around line 8.

use Mail;

Change the following function:

public function defineProperties(){
        return [
            'redirectOnLogin' => [
                'title'       => 'Redirect on login',
                'type'        => 'dropdown',
                'default'     => ''
            ],
            'redirectOnRegister' => [
                'title'       => 'Redirect on register',
                'type'        => 'dropdown',
                'default'     => ''
            ],
            'productPage' => [
                'title'       => 'Product page',
                'description' => 'Product detail page',
                'type'        => 'dropdown',
                'default'     => 'product',
            ],
            'paramCode' => [
                'title'       => /*Activation Code Param*/'rainlab.user::lang.account.code_param',
                'description' => /*The page URL parameter used for the registration activation code*/ 'rainlab.user::lang.account.code_param_desc',
                'type'        => 'string',
                'default'     => 'code'
            ]
        ];
    }

And at the end add the following functions.

/**
     * Sends the activation email to a user
     * @param  User $user
     * @return void
     */
    protected function sendActivationEmail($user)
    {
        $code = implode('!', [$user->id, $user->getActivationCode()]);

        $link = $this->makeActivationUrl($code);

        $data = [
            'name' => $user->name,
            'link' => $link,
            'code' => $code
        ];

        Mail::send('rainlab.user::mail.activate', $data, function($message) use ($user) {
            $message->to($user->email, $user->name);
        });
    }

    /**
     * Returns a link used to activate the user account.
     * @return string
     */
    protected function makeActivationUrl($code)
    {
        $params = [
            $this->property('paramCode') => $code
        ];

        if ($pageName = $this->property('activationPage')) {
            $url = $this->pageUrl($pageName, $params);
        }
        else {
            $url = $this->currentPageUrl($params);
        }

        if (strpos($url, $code) === false) {
            $url .= '?activate=' . $code;
        }

        return $url;
    }

Last updated

1-4 of 4