Jump to content
Sign in to follow this  
swissarmyknife

Help with $order object in payment module

Recommended Posts

I'm trying to get my Smart Status contrib to work, but, in checkout_confirmation.php, $order is no longer an object when it reaches my payment module. Yet, in checkout_payment.php, it is an object. :(

 

I basically need to be able to test

$order->info['shipping_method']

or figure out another way of testing whether this order needs to ship.

 

Here's the payment module code:

 

 ?class authorizenetaim {
? ?var $code, $title, $description, $enabled;

// class constructor
? ?function authorizenetaim() {
? ?
? ?	global $order;
? ?  ? ?
? ? ? // TESTING IF OBJECT - RETURNS NO IN CHK_PROC
? ?	if (is_object($order)) {
? ?
? ? ?echo "YEP - it's an object!";
? ?	} else {
? ? ?echo "NOPE";
? ?	}

?$this->code = 'authorizenetaim';
?$this->title = MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_TITLE;
?$this->description = MODULE_PAYMENT_AUTHORIZENETAIM_TEXT_DESCRIPTION;
?$this->enabled = ((MODULE_PAYMENT_AUTHORIZENETAIM_STATUS == 'True') ? true : false);
?$this->error = '';
?
?if ((int)MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID > 0) {
?
?	if ($order->info['shipping_method'] != '') {	
? ?// SHIP ITEM - MARK UNFULFILLED
? ? ?$this->order_status = MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID;
?	} else { 
? ?// DOWNLOAD ONLY ITEM - MARK e-FULFILLED
? ? ?$this->order_status = (MODULE_PAYMENT_AUTHORIZENETAIM_ORDER_STATUS_ID + 3);
?	}
? ? ?	}

? ? ?	if (is_object($order)) $this->update_status();

?// Change made by using ADC Direct Connection
?$this->form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false);
? ?}

 

TIA for any help or pointers you can provide. :)

 

- jeff

Edited by swissarmyknife

Share this post


Link to post
Share on other sites
I basically need to be able to test
$order->info['shipping_method']

or figure out another way of testing whether this order needs to ship.

 

 

It is tested in checkout_shipping.php with this:

 

  if ($order->content_type == 'virtual') {
   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
   $shipping = false;
   $sendto = false;
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 

 

HTH

 

Matti


Matti Ressler

 

We were all once expert at...... nothing

_____

Share this post


Link to post
Share on other sites
It is tested in checkout_shipping.php with this:

 

 ?if ($order->content_type == 'virtual') {
? ?if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
? ?$shipping = false;
? ?$sendto = false;
? ?tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
?}

HTH

 

Matti

 

Thanks, Matti. I'll try to work with that. The reason I'm testing for that is to determine (in the payment modules) which status to write to the db. For instance, for our download orders, I want the status to show fulfilled, but for items needing to be shipped, it should show unfulfilled.

 

And the only place I see that the status is being written is in the payment modules. Yet, I can't retrieve the shipping info there because the $order object is dead once that function is called.

 

Maybe I'm making this way too hard. Any suggestions?

 

Thanks again for your help!

- jeff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×