Jump to content

ps_legalcompliance module bug


adohogne

Recommended Posts

Hello,

I hope I'm in the right place to report this bug ^_^

 

I discovered that when you hook the "ps_legalcompliance" module in the "displayCheckoutSubtotalDetails" hook, the module is re-assigning a new value to "$link" smarty variable :

At line 1014 in file ps_legalcompliance.php :

public function hookDisplayCheckoutSubtotalDetails($param)
{
  // Display "under conditions" when the shipping subtotal equals 0
  if ('shipping' === $param['subtotal']['type'] && 0 === $param['subtotal']['amount']) {
    $cms_role_repository = $this->entity_manager->getRepository('CMSRole');
    $cms_page_shipping_and_payment = $cms_role_repository->findOneByName(self::LEGAL_SHIP_PAY);
    $link = $this->context->link->getCMSLink((int)$cms_page_shipping_and_payment->id_cms);

    $this->context->smarty->assign(array('link' => $link));    // <---- HERE IS THE PROBLEM !!
    return $this->display(__FILE__, 'hookDisplayCartPriceBlock_shipping_details.tpl');
  }
}

Everything work fine until you need to hook, below that, another module that needs to access the original "$link" variable (for example "$link->getModuleLink(...)", or any other method from the "$link" object).

It gives me the following error in debug mode :

FATALTHROWABLEERROR IN
SMARTY_INTERNAL_TEMPLATEBASE.PHP(157) : EVAL()'D CODE LINE 28:
CALL TO A MEMBER FUNCTION GETMODULELINK() ON STRING

 

For now, I fix it just by renaming the variable like this :

$this->context->smarty->assign(array('conditions_link' => $link));

 

But I think that should be fixed, because it could easily conflit with other modules.

Thank you,
Best regards,

- Arnaud Dohogne

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...