Post by X-Rayden » Wed Mar 05, 2008 2:39 am

without a great deal of documentation, it's hard to code for opencart, but mostly easy to understand...

how do we logicly get datas that we need if there is no modules with the code getting that datas...

i need a zone code.

when a zone is setup, we enter a zone code, there is 2 iso codes for country (Canada -> iso_code2 = CA, iso_code3 => CAD) and 1 code for a zone (Quebec => QC)

HOW do we get thoses codes within a checkout?

I'm developping a paiement module for InternetSecure, they accept address data, but need Country Codes and Zonde code to work... frankly i'm at a lost on this one!

User avatar
New member

Posts

Joined
Sat Jan 12, 2008 3:54 am
Location - Québec, Qc, Canada

Post by bruce » Wed Mar 05, 2008 6:13 am

what you need is shown in \catalog\controller\checkout_confirm.php as follows

Code: Select all

		$order->set('shipping_firstname', $address->getFirstName($session->get('shipping_address_id')));
		$order->set('shipping_lastname', $address->getLastName($session->get('shipping_address_id')));
		$order->set('shipping_company', $address->getCompany($session->get('shipping_address_id')));
		$order->set('shipping_address_1', $address->getAddress1($session->get('shipping_address_id')));
		$order->set('shipping_address_2', $address->getAddress2($session->get('shipping_address_id')));
		$order->set('shipping_city', $address->getCity($session->get('shipping_address_id')));
		$order->set('shipping_postcode', $address->getPostCode($session->get('shipping_address_id')));
		$order->set('shipping_zone', $address->getZone($session->get('shipping_address_id')));
		$order->set('shipping_country', $address->getCountry($session->get('shipping_address_id')));
		$order->set('shipping_address_format', $address->getFormat($session->get('shipping_address_id')));
and \library\cart\address.php

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by X-Rayden » Mon Mar 10, 2008 6:43 pm

Thanks, but it wasn't working.

so i've access this data this way :

$this->address->data[$this->address->customer->data['customer_id']]['iso_code_2']

it's working, but i think it now the real good way to do it.. hehehe

User avatar
New member

Posts

Joined
Sat Jan 12, 2008 3:54 am
Location - Québec, Qc, Canada

Post by bruce » Mon Mar 10, 2008 9:16 pm

Just out of interest, could you post some surrounding code to give context, I am interested in what you did and in what php file.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by X-Rayden » Mon Mar 17, 2008 5:24 pm

you mean this code ? :

Code: Select all

$ouput .= '<input type="hidden" name="xxxCompany" value="' .  trim($this->order->get('payment_company')) . ' ' . $this->order->get('lastname') . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxAddress" value="' . trim($this->order->get('payment_address_1')) . ' ' . trim($this->order->get('payment_address_2')) . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxCity" value="' . trim($this->order->get('payment_city')) . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxProvince" value="' . $this->address->data[$this->address->customer->data['customer_id']]['code'] . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxPostal" value="' . trim($this->order->get('payment_postcode')) . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxCountry" value="' . $this->address->data[$this->address->customer->data['customer_id']]['iso_code_2'] . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxEmail" value="' . trim($this->order->get('email')) . '" />' . "\n";
$ouput .= '<input type="hidden" name="xxxVar1" value="' . $this->order->getReference() . '" />' . "\n";
it's in my payment method's fields() fonction.
Last edited by X-Rayden on Mon Mar 17, 2008 5:26 pm, edited 1 time in total.

User avatar
New member

Posts

Joined
Sat Jan 12, 2008 3:54 am
Location - Québec, Qc, Canada

Post by bruce » Mon Mar 17, 2008 9:17 pm

yep, thanks

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm
Who is online

Users browsing this forum: No registered users and 2 guests