Hikashop (New row in a table after payment)

  • Posts: 1
  • Thank you received: 0
8 years 4 months ago #246155

Hi all. I need just one specific thing. When a costumer has finished the payment of the item, I want to add a new row in the table user_usergroup_map automatically. So i need to do an insert into this table of the database with the id of the costumber and a number of the group. Could someone help me? I would be very grateful. What php I need to change and how.

Thanks in advance :)

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 4 months ago #246170

Hi,

So what you're saying is that you want to add a user group to the user after the purhcase of a product.
If you want to do it for a specific product, you can use the "user group after purchase" setting of the product edition page in the Business edition to configure that.
If you want to do it regardless of what is bought, then a simple mass action via the menu System>Mass action with a trigger "when an order is updated", a filter for confirmed orders, and an action to add a user group will also allow you to do it without any code modification.

And if you really want to do it with code, I recommend not hacking directly in the core files of HikaShop, but instead, create a custom plugin of the group "hikashop" implementing the "onAfterOrderUpdate" trigger so that you can add your PHP code in there. That way, you won't loose your modification each time you update HikaShop.
You can read more about that in our developer documentation:
www.hikashop.com/support/documentation/6...r-documentation.html

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum