Carlos Posted January 3, 2020 Share Posted January 3, 2020 Hi, I have read that with $customer.newsletter you can know if a customer is subscribed to the newsletter in Prestashop 1.7 but my website use Prestashop 1.6 How can I get that variable? Link to comment Share on other sites More sharing options...
Carlos Posted January 3, 2020 Author Share Posted January 3, 2020 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 More sharing options...
Carlos Posted January 3, 2020 Author Share Posted January 3, 2020 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now