How to pass a variable from one module to another and then into mysql
Posted on 2007-10-06
I'm customizing Zen Cart, an open source shopping cart program based on PHP and MySQL. I really don't know too much about PHP... just enough to alter some code but not really write it. So I'm not sure what you need to help me out, so I'll include as much as I can reckon matters.
I have a variable ($shipping_methods_types) inside a function called quote within a class / module called ups. $shipping_methods_types contains the available UPS methods (not the chosen method - the available methods). For example, it'll contain: 1DA,2DA,GND.
I want to store that value in a field called shipping_allowed in the orders table.
It looks like the place to insert it is in a function called create within a class called order. When the customer places the order, it seems that code runs. There's a portion of the function that seems to take all the variables and insert it into the orders table through $sql_data_array. I've been able to put in a dummy value into the shipping_allowed field by adding this code: $sql_data_array[shipping_allowed] = 'dummy value'; after the long the list of other variables. Just a snippet of that code:
$sql_data_array = array('customers_id' => $_SESSION['customer_id'],
'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
'customers_company' => $this->customer['company'],
'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
$sql_data_array[shipping_allowed] = 'dummy value';
My problem is that I don't know how to pass the real value of $shipping_methods_types from the UPS module to the create function.