Jump to content

Upgrading a Customer Group when hitting certain threashold


Recommended Posts

hi i am new to prestashop i have 2 questions where i am stuck trying to find how can i add/edit or create this function in.

 

Question 1 Example

In history i had purchased products of more than 200 dollars in total.

So when it reaches 250 dollar it will automatically convert this member group to VIP member group where he has more discounts for the rest of the products.

 

Question 2 Example

Lets i have added a product call VIP membership it can be added to cart. So when a customer buys this product it will be able to detect and convert it to VIP membership.

When i search the forum : I saw in the forum i saw some people saying to use some hook to detect the payment and the id of the product. but i do not know where to edit from. Is it override or Main Class controller?

 

 

Please let me know how can i go about it or where to look into?

 

Very much thanks in advance!

Link to comment
Share on other sites

I would use hookActionPaymentConfirmation.

I'm not sure the customer id is sent over, so you can try this instead
 

$order = new Order((int)$params['id_order']);
 
And access it with $order->id_customer

Then, there should be a method to get the total spent since registration, but I can't remember it on the top of my head. 
Get the total, and if it's > 250, generate a new customer object and add the groups with $customer->addGroups($groups); Please notice groups here must be an array
Link to comment
Share on other sites

×
×
  • Create New...