Jump to content

[Solved] Conditional to know if a customer has purchased any item


restaller

Recommended Posts

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 by restaller (see edit history)
Link to comment
Share on other sites

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 by restaller (see edit history)
Link to comment
Share on other sites

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

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