Payment Plugin - Accessing some fields

Phoca Cart - complex e-commerce extension
User avatar
nzrunner
Phoca Member
Phoca Member
Posts: 33
Joined: 27 Jul 2017, 15:52

Payment Plugin - Accessing some fields

Post 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
User avatar
nzrunner
Phoca Member
Phoca Member
Posts: 33
Joined: 27 Jul 2017, 15:52

Re: Payment Plugin - Accessing some fields

Post 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?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Payment Plugin - Accessing some fields

Post 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
If you find Phoca extensions useful, please support the project
User avatar
nzrunner
Phoca Member
Phoca Member
Posts: 33
Joined: 27 Jul 2017, 15:52

Re: Payment Plugin - Accessing some fields

Post 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 :-)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Payment Plugin - Accessing some fields

Post by Jan »

Thank you, Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Payment Plugin - Accessing some fields

Post by Jan »

Hi, implemented in in version 3.0.0 RC9.2
https://www.phoca.cz/download/category/ ... -component

Jan
If you find Phoca extensions useful, please support the project
Post Reply