Execute specific files or functions

  • Posts: 15
  • Thank you received: 0
11 years 4 months ago #110379

Is it possible to execute specific functions after purchase of certain items - IE, in order to create a digital item shop?
I'd like to be able to create a system that allows people to buy items that get added to their players database/inventory system.

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

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #110380

Yes, you can create a hikashop plugin and implement the onAfterOrderUpdate trigger and check the order_status of the order in it and if it is confirmed, then you can do the processing you need:
www.hikashop.com/en/support/documentatio...l#onAfterOrderUpdate

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

  • Posts: 15
  • Thank you received: 0
11 years 4 months ago #110408

What would be the best way to check if it's certain products - dynamically if possible? For instance, a T-shirt shouldn't trigger an "Add to Inventory" command but a in-game credit purchase should.

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

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #110418

In the $order variable, you will get he id of the order like that:
$order->order_id

So you can simply load the full order like that:
$class = hikashop_get('class.order');
$fullOrder = $class->loadFullOrder($order->order_id);

and then loop on the products list to check the products:
foreach($fullOrder->products as $product){
if($product->order_product_code=='in-game credit product code'){
//custom code
}
}

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

Time to create page: 0.054 seconds
Powered by Kunena Forum