Page 1 of 1

Payment Plugin - Accessing some fields

Posted: 06 Aug 2017, 06:33
by nzrunner
I am attempting to develop a payment plugin based on the core Paypal Standard plugin. Everything is working nicely, except there are some fields I cannot figure out how to access, as you haven't used them in that plugin.

Any chance you can tell me how I can access: -
  • All the fields for the Order Shipping Address
  • The Shipping Method code
  • The Country Code (I need to pass the payment gateway the value stored as code2 in the country table (e.g. AU))
  • The comment that the user types in the comment field during Checkout

Re: Payment Plugin - Accessing some fields

Posted: 07 Aug 2017, 15:08
by nzrunner
I have just spent an extremely frustrating day installing and configuring Eclipse and getting it to debug some of my code. I have finally got it working and I have to say, it has been worth the effort. I have found answers to several of my questions.

The only field I can't seem to access is the Country Code.

The payment gateway I am sending data to, expects the Country Code to be passed. So for Australia, I need to pass AU, for Great Britain, I need to pass GB, etc.

Is it possible to add that field to the $order array so I can access it in the payment plugin?

Re: Payment Plugin - Accessing some fields

Posted: 08 Aug 2017, 13:53
by Jan
Hi,

offtopic: for me, unfortunately Eclipse is too slow :-( so I use notepad++ (including all possible plugins to get code folding, php syntax checking, etc.)

I will take a look at it, so in payment plugin:
- we need to get info about user's address - country
- we need to get country "alias" - so code(2) should do the trick:

Image

Jan

Re: Payment Plugin - Accessing some fields

Posted: 08 Aug 2017, 14:39
by nzrunner
I have got Eclipse, Phing and Bitbucket all linked together, and I am now editing, debug, building and committing much faster than I used to :-)

Yes, that's exactly it.

I found the necessary code in the file "administrator/components/com_phocacart/libraries/phocacart/order/view.php". Line # 114 is currently: -

Code: Select all

.' c.title AS countrytitle, r.title AS regiontitle
It needs to be changed to: -

Code: Select all

.' c.title AS countrytitle, r.title AS regiontitle, c.code2 AS countrycode'
Hope this helps :-)

Re: Payment Plugin - Accessing some fields

Posted: 12 Aug 2017, 00:05
by Jan
Thank you, Jan

Re: Payment Plugin - Accessing some fields

Posted: 06 Sep 2017, 16:29
by Jan
Hi, implemented in in version 3.0.0 RC9.2
https://www.phoca.cz/download/category/ ... -component

Jan