Code that fires after transaction completed

  • Posts: 1
  • Thank you received: 0
13 years 11 months ago #3853

Hi guys,
We're evaluating Hikashop for a shopping cart, selling software products for download that need to be managed by another plugin.

Can someone point me to an easy way to add some code that fires after a transaction is completed (paid for and they now 'own' the product). This code would tell the other plugin that the buyer now owns the product.

On another side note. I was hoping to add a custom field to the products table, but I can only seem to add to the address table. Is there some trick I'm missing?

Any help would be much appreciated.

Cheers,
Stuart

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #3858

Hi,

We have a documentation which explains how you can create your own plugin with our API: www.hikashop.com/en/support/documentatio...r-documentation.html
You will be able to use the event onAfterOrderUpdate(&$order,&$send_email) to know when an order is updated.

There, you can have something like this:

$config=&hikashop::config();
		$confirmed = $config->get('order_confirmed_status');
		//if order status is not updated skip
		if(!isset($order->order_status)) return true;
		
		$mainframe =& JFactory::getApplication();
		$db =& JFactory::getDBO();
		
		if($order->order_status!=$confirmed){
			return true;
		}
		//The order is confirmed, select all items from this order
		$db->setQuery('SELECT a.order_product_code as product, a.order_product_quantity as quantity FROM `#__hikashop_order_product` as a WHERE a.order_id = '.(int) $order->order_id);
		$allProducts = $db->loadObjectList();

		//your code which do something with the products information

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #3859

With the free version, only the address custom fields can be personnalized.
If you want to create order custom fields, product custom fields or user custom fields, you need to buy either the Essential or the Business edition.
What do you want to do with the custom fields ?

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

Time to create page: 0.054 seconds
Powered by Kunena Forum