Jump to content

Help with "Call to a member function getModuleLink() on string"


Recommended Posts

Hello Guys

Can anybody help me with this problem?

A module i bought for a shop makes this call in one of its TPLs:

href="{$link->getModuleLink('b2bregistration', 'b2b', array(), true)|escape:'htmlall':'UTF-8'}"

The result if the following error:

923074088_Screenshotfrom2022-10-1215-58-48.thumb.png.987e95b42f2e91d1c6ef1165f51f3458.png

 

This issue happens in the hook "displayCustomerAccount". Not every customer is effected. Sofar I have no clue on why which one is affected and another is not.

I dumped $link right before the hook
 

{block name='display_customer_account'}
	{dump($link)}
	{hook h='displayCustomerAccount'}
{/block}

and inside the TPL-File of the module.
 

<a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" href="{$link->getModuleLink('b2bregistration', 'b2b', array(), true)|escape:'htmlall':'UTF-8'}" title="{l s='Create Account as B2B' d='Shop.Theme.Customeraccount'}">
	<span class="link-item">
		<i class="fal fa-suitcase"></i>
		{dump($link)}<br/>
		{l s='Create Account as B2B' d='Shop.Theme.Customeraccount'}
	</span>
</a>

 

These are the Results:

  1. working customer:
    439160662_Screenshotfrom2022-10-1216-04-49.png.1698b233517f8b7d44eeb505e32c4d56.png
  2. not working customer (i removed the function inside the href so the dump gets executed):
    1390951888_Screenshotfrom2022-10-1216-04-58.png.789101ba8324efdc79758f46c7bf718d.png

 

The module in question is the first one to be executed inside the hook.

Does anybody have clues why the Link-Object gets removed for one customer and replaced by the string?
Can anybody give insight on how I might find the place where the Link-Object gets replaced?
How should I best search the code to find Sections which might be responsible?

 

 

Thanks in Advance for your help.

 

Best Regards

Fabian

Link to comment
Share on other sites

14 hours ago, 4you.software said:

Prestashop 1.7

{url entity='module' name='b2bregistration' controller='myController' params=['paramKey1' => $paramValue1]}

or

{$this->context->link->getModuleLink('b2bregistration', 'b2b', [], null, null, null, true)}

The first one helped just fine.

Thanks a lot!

  • Like 1
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...