mhunter Posted July 30, 2003 Posted July 30, 2003 Here's one to scratch your head. I wrote a function to call an external program from my osc: get_new_tax($state, $zip, $new_city, $amt); This function does a calculation and returns the results and I call this from tep_get_tax_rate() In the main function function tep_get_tax_rate(){ the code returns $tax_multiplier. When I manually set this var to 8.25 for example, the amount is calculated and the tax is displayed into the shopping cart app in the correct place. When I assign the value from my new function to the $tax_multiplier var, (8.25 because I echo it out)- the tax amount is missing from the shopping cart in the place it should be. The value is the same both ways. I am returning $tax_multiplier each time back to the program. But I cannot figure out why it wont work when assigning the value: $tax_multiplier = $var_from_function; echo "**" . $tax_multiplier . "**";//this echos **8.25** $tax_multiplier = 8.25;//this echo 8.25 echo "**" . $tax_multiplier . "**";//this echos **8.25** return $tax_multiplier; The last one shows up in my cart application in right place. The first doesnt show at all, but I can get it to echo on screen. Any ideas ???? Here's the two functions: ******************************************************************************** function tep_get_tax_rate(){ global $amt, $city, $rate_mult, $id, $tax_rate, $order, $ver_subtotal, $ver_value, $value, $state, $zip, $id; //$city = "San Antonio"; $amt = $ver_subtotal; $city = $order->delivery['city']; $new_city = str_replace(" ", "", "$city"); $zip = $order->delivery['postcode']; $state_before = $order->delivery['state']; //do query for state $state_query = tep_db_query("SELECT `name`,`abbr` FROM `states` WHERE `name` LIKE '$state_before'"); $state_res = tep_db_fetch_array($state_query); $state = $state_res['abbr']; //echo $amt . $city . $state . $zip; get_new_tax($state, $zip, $new_city, $amt); //this works $tax_multiplier = 0; $tax_multiplier = $rate_mult; // $tax_multiplier = 9.00; echo "here's taxmultiplier: " . "**".$tax_multiplier."**"; //echo "this is rate mult from get_tax: " . $rate_mult . "<br>";//this works return $tax_multiplier; } function get_new_tax($state, $zip, $city, $amt){ global $rate_mult; $b = "ssh -i includes/functions/key/vertex vertex@wolf $state $zip $city COD $amt"; exec($b, $c, $g); $line = $c[4]; $new_rate = substr($line, 26, -10); $rate_mult = $new_rate * 100; return $rate_mult; } ******************************************************** Any suggestions will be appreciated. Thanks Mignon
Recommended Posts
Archived
This topic is now archived and is closed to further replies.