Diddlyuk Posted March 18, 2018 Share Posted March 18, 2018 (edited) Hi all, I'm trying to setup a loyalty module in prestashop 1.7. So far everything works however i cannot get the amount of points to show on the template discounts.tpl. I currently have this: Discounts: TPL <tr class="alternate_item"> <td colspan="2" class="history_method bold" style="text-align:center;">{l s='Total points available:' mod='loyalty'}</td> <td colspan="2" class="history_method bold" style="text-align:center;"> {$points|intval}</td> <td class="history_method"> </td> Loyalty.php public function hookDisplayMyAccountBlock($params) { include_once(dirname(__FILE__).'/LoyaltyModule.php'); include_once(dirname(__FILE__).'/LoyaltyStateModule.php'); $customer = new Customer((int)$params['id_customer']); if ($customer && !Validate::isLoadedObject($customer)) die($this->l('Incorrect Customer object.')); $details = LoyaltyModule::getAllByIdCustomer((int)$params['id_customer'], (int)$params['cookie']->id_lang); $points = (int)LoyaltyModule::getPointsByCustomer((int)$params['id_customer']); return $this->hookCustomerAccount($params); } And i have added the module to the hook displayMyAccountBlock any help would be greatly apprieciated. Thanks Edited March 18, 2018 by Diddlyuk (see edit history) Link to comment Share on other sites More sharing options...
Diddlyuk Posted March 21, 2018 Author Share Posted March 21, 2018 bump Link to comment Share on other sites More sharing options...
Diddlyuk Posted March 29, 2018 Author Share Posted March 29, 2018 anyone? Link to comment Share on other sites More sharing options...
Rhobur Posted March 31, 2018 Share Posted March 31, 2018 use $this->context->smarty->assign( "variable", value) in your hook (or the hookHeader); then you'll be able to access it in your tpl with $variable. 1 Link to comment Share on other sites More sharing options...
Diddlyuk Posted April 10, 2018 Author Share Posted April 10, 2018 On 31/03/2018 at 11:01 AM, Rho_Bur said: use $this->context->smarty->assign( "variable", value) in your hook (or the hookHeader); then you'll be able to access it in your tpl with $variable. I added the code below to my loyalty.php file but still no joy i'm afraid Loyalty.php $this->context->smarty->assign('cpoints', $points); discounts.tpl <td colspan="2" class="history_method bold" style="text-align:center;">{l s='Total points available:' mod='loyalty'}</td> <td colspan="2" class="history_method bold" style="text-align:center;">{$cpoints|intval}</td> <td class="history_method"> </td> what am i doing wrong? 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