restaller Posted November 13, 2016 Share Posted November 13, 2016 (edited) Hello everyone, I would like to get a conditional on any template to know if a customer has purchased any item, but I find no variable for this. If someone helps me I would be very grateful. The closest thing I've come across is this: {if !$cookie->isLogged()} But I would like to know whether a customer has bought or not. P.D. I'm sorry if my English is not good Edited November 20, 2016 by restaller (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted November 14, 2016 Share Posted November 14, 2016 Like this?http://nemops.com/prestashop-bought-product-label/#.WCmmHPnx6Uk Link to comment Share on other sites More sharing options...
restaller Posted November 15, 2016 Author Share Posted November 15, 2016 (edited) Like this? http://nemops.com/prestashop-bought-product-label/#.WCmmHPnx6Uk Thanks for answering Nemo. What I wanted to do is create a content in the blockbanner module, and that this content would only be visible if a customer has purchased an item. Thanks to your post I saw the light. I used the getBoughtProducts function like this: $this->smarty->assign('has_bought', $this->context->customer->getBoughtProducts()); And then in the template like this: {if !$has_bought} Content... {/if} Edited November 15, 2016 by restaller (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted November 16, 2016 Share Posted November 16, 2016 Glad to know you managed to do it! Link to comment Share on other sites More sharing options...
restaller Posted November 16, 2016 Author Share Posted November 16, 2016 Glad to know you managed to do it! Hi, Nemo. You would be kind enough to solve a little doubt I have. In the Customer class there is a method called getDefaultGroupId (), this method has the $ id_customer parameter. How could I call this method correctly to get its result? With the getBoughtProducts () method I had it easy because it has no parameter, but with getDefaultGroupId () I could not get its result because I did not know how to call this method. I hope you have understood me. Link to comment Share on other sites More sharing options...
NemoPS Posted November 18, 2016 Share Posted November 18, 2016 use $this->context->customer->id Link to comment Share on other sites More sharing options...
restaller Posted November 18, 2016 Author Share Posted November 18, 2016 use $this->context->customer->id Thanks for your help, it works! I should edit the post as solved, right? Link to comment Share on other sites More sharing options...
NemoPS Posted November 19, 2016 Share Posted November 19, 2016 Yeah that would be good 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