Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

General Question On Variables


richlewt

Recommended Posts

Hi

I am trying to combine the output from 2 different shipping modules. In the line below:

 

$shipping_method = MODULE_SHIPPING_UKSD_TEXT_WAY . ' ' . $dest_state . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_UKSD_TEXT_UNITS;

 

The variable $dest_state is derived from a different module, I need its output to display in this module, how do I get it to pick up the value of $dest_state ?

thanks

Rich

"May the seam be with you"

Link to comment
Share on other sites

You need to know the class name of the other module, in that module $dest_state should have been defined as a var in the class contructor.

 

You can then reference it with

 

$class_name = 'cod'; // or whatever

$dest_state = $GLOBALS[$class_name]->$dest_state;

 

or you could just declare $dest_state as a global variable in the other module.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Thinking about this some more, you are probably going to have problems getting variables from one shipping module to another.

 

Each class function can be called on different checkout pages and also the sort order will play it's part too.

 

Would it not be easier to copy over the code that calculates $dest_state from one module to another ?

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Hi Ian

I sussed it eventually.

I put $dest_state = $order->delivery['state']; under Class Methods

 

and it worked :D

 

Am learning slowly but getting there!!

thanks

Rich

"May the seam be with you"

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...