VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: le_gnou on August 18, 2012, 17:54:48 PM

Title: How to get custom fields for an order ?
Post by: le_gnou on August 18, 2012, 17:54:48 PM
Hello,

I need to make a script sending to an API the content of an order when it become "paid".
For some products, i made custom fields and i need to put the choice made by customer in an "array" :

// Game server information
"game_id"     => $infoFromYourAPI["game_id"],
"max_players" => $infoFromYourAPI['Players'],
"pub_priv"    => $infoFromYourAPI["pubpriv"],
"login_path"  => $infoFromYourAPI["no"],
"sv_location" => $infoFromYourAPI["Location"],


How to do that, please ?
Title: Re: How to get custom fields for an order ?
Post by: bytelord on August 18, 2012, 18:19:26 PM
Hello,

If you are familiar with PHP programming and joomla plugins developemt you could use vmpayment plugin and build or change your payment plugin when a payment and  plgVmOnPaymentResponseReceived is fired to post the above data to your game server and of course do some validation.
You can take a look over here: http://dev.virtuemart.net/projects/virtuemart/wiki/Payment_Plugins

Except that and easier you could make a piece of code when the checkout was successful inside your cart to post those data to your server.
I m sure that the API have instructions how should post your data.

Hope helps you out.
Title: Re: How to get custom fields for an order ?
Post by: le_gnou on August 19, 2012, 16:11:29 PM
No, i'm not a PHP developper... I just add a code to the file [website_root]/administrator/components/com_virtuemart/models/orders.php.

I just want to permit to virtuemart sending data to my GameCP API...

I began a "howto" here :

http://forums.gamecp.com/viewtopic.php?f=66&t=6197

But i'm not able to get datas from custom fields i made :(
Title: Re: How to get custom fields for an order ?
Post by: Milbo on August 19, 2012, 16:53:57 PM
Never change the models!

All triggers are there. Important is that you select "Cart attribute" to yes!