Jump to content

Access to Variable newsletter Prestashop 1.6


Carlos

Recommended Posts

Well, after look for several pages I have created an override of FrontController.php  and I have added this code:

 

public function initHeader()
    {
        self::$smarty->assign('customerNewsletter', (int)$customer->newsletter);
        return parent::initHeader();
    }

Now the variable $customerNewsletter is available on header.tpl but always displays 0 for subscribed or not subscribed

 

Any idea how to assign that value?

Link to comment
Share on other sites

Well, I think I have not defined $customer. Now I add this code and it seems is right

 

	public function initHeader()
    {
		$customer = new Customer((int)(self::$cookie->id_customer));
        self::$smarty->assign('customerNewsletter', (int)$customer->newsletter);
        return parent::initHeader();
    }

I have checked with two users and the result is right.

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